Skip to content

Commit a79a742

Browse files
committed
Revert "org.el: Improve performance of deletion commands"
This reverts commit 46df681. The optimization broke folding fragility checks.
1 parent c66bdb0 commit a79a742

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

lisp/org.el

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16156,19 +16156,18 @@ front of the next \"|\" separator, to keep the table aligned. The table will
1615616156
still be marked for re-alignment if the field did fill the entire column,
1615716157
because, in this case the deletion might narrow the column."
1615816158
(interactive "p")
16159-
(org-fold-core-ignore-modifications
16160-
(save-match-data
16161-
(org-fold-check-before-invisible-edit 'delete-backward)
16162-
(if (and (= N 1)
16163-
(not overwrite-mode)
16164-
(not (org-region-active-p))
16165-
(not (eq (char-before) ?|))
16166-
(save-excursion (skip-chars-backward " \t") (not (bolp)))
16167-
(looking-at-p ".*?|")
16168-
(org-at-table-p))
16169-
(progn (forward-char -1) (org-delete-char 1))
16170-
(backward-delete-char N)
16171-
(org-fix-tags-on-the-fly)))))
16159+
(save-match-data
16160+
(org-fold-check-before-invisible-edit 'delete-backward)
16161+
(if (and (= N 1)
16162+
(not overwrite-mode)
16163+
(not (org-region-active-p))
16164+
(not (eq (char-before) ?|))
16165+
(save-excursion (skip-chars-backward " \t") (not (bolp)))
16166+
(looking-at-p ".*?|")
16167+
(org-at-table-p))
16168+
(progn (forward-char -1) (org-delete-char 1))
16169+
(backward-delete-char N)
16170+
(org-fix-tags-on-the-fly))))
1617216171

1617316172
(defun org-delete-char (N)
1617416173
"Like `delete-char', but insert whitespace at field end in tables.
@@ -16177,31 +16176,30 @@ front of the next \"|\" separator, to keep the table aligned. The table will
1617716176
still be marked for re-alignment if the field did fill the entire column,
1617816177
because, in this case the deletion might narrow the column."
1617916178
(interactive "p")
16180-
(org-fold-core-ignore-modifications
16181-
(save-match-data
16182-
(org-fold-check-before-invisible-edit 'delete)
16183-
(cond
16184-
((or (/= N 1)
16185-
(eq (char-after) ?|)
16186-
(save-excursion (skip-chars-backward " \t") (bolp))
16187-
(not (org-at-table-p)))
16188-
(delete-char N)
16189-
(org-fix-tags-on-the-fly))
16190-
((looking-at ".\\(.*?\\)|")
16191-
(let* ((update? org-table-may-need-update)
16192-
(noalign (looking-at-p ".*? |")))
16193-
(delete-char 1)
16194-
(org-table-with-shrunk-field
16195-
(save-excursion
16196-
;; Last space is `org-table-separator-space', so insert
16197-
;; a regular one before it instead.
16198-
(goto-char (- (match-end 0) 2))
16199-
(insert " ")))
16200-
;; If there were two spaces at the end, this field does not
16201-
;; determine the width of the column.
16202-
(when noalign (setq org-table-may-need-update update?))))
16203-
(t
16204-
(delete-char N))))))
16179+
(save-match-data
16180+
(org-fold-check-before-invisible-edit 'delete)
16181+
(cond
16182+
((or (/= N 1)
16183+
(eq (char-after) ?|)
16184+
(save-excursion (skip-chars-backward " \t") (bolp))
16185+
(not (org-at-table-p)))
16186+
(delete-char N)
16187+
(org-fix-tags-on-the-fly))
16188+
((looking-at ".\\(.*?\\)|")
16189+
(let* ((update? org-table-may-need-update)
16190+
(noalign (looking-at-p ".*? |")))
16191+
(delete-char 1)
16192+
(org-table-with-shrunk-field
16193+
(save-excursion
16194+
;; Last space is `org-table-separator-space', so insert
16195+
;; a regular one before it instead.
16196+
(goto-char (- (match-end 0) 2))
16197+
(insert " ")))
16198+
;; If there were two spaces at the end, this field does not
16199+
;; determine the width of the column.
16200+
(when noalign (setq org-table-may-need-update update?))))
16201+
(t
16202+
(delete-char N)))))
1620516203

1620616204
;; Make `delete-selection-mode' work with Org mode and Orgtbl mode
1620716205
(put 'org-self-insert-command 'delete-selection

0 commit comments

Comments
 (0)