@@ -16131,18 +16131,19 @@ front of the next \"|\" separator, to keep the table aligned. The table will
1613116131still be marked for re-alignment if the field did fill the entire column,
1613216132because, in this case the deletion might narrow the column."
1613316133 (interactive "p")
16134- (save-match-data
16135- (org-fold-check-before-invisible-edit 'delete-backward)
16136- (if (and (= N 1)
16137- (not overwrite-mode)
16138- (not (org-region-active-p))
16139- (not (eq (char-before) ?|))
16140- (save-excursion (skip-chars-backward " \t") (not (bolp)))
16141- (looking-at-p ".*?|")
16142- (org-at-table-p))
16143- (progn (forward-char -1) (org-delete-char 1))
16144- (backward-delete-char N)
16145- (org-fix-tags-on-the-fly))))
16134+ (org-fold-core-ignore-modifications
16135+ (save-match-data
16136+ (org-fold-check-before-invisible-edit 'delete-backward)
16137+ (if (and (= N 1)
16138+ (not overwrite-mode)
16139+ (not (org-region-active-p))
16140+ (not (eq (char-before) ?|))
16141+ (save-excursion (skip-chars-backward " \t") (not (bolp)))
16142+ (looking-at-p ".*?|")
16143+ (org-at-table-p))
16144+ (progn (forward-char -1) (org-delete-char 1))
16145+ (backward-delete-char N)
16146+ (org-fix-tags-on-the-fly)))))
1614616147
1614716148(defun org-delete-char (N)
1614816149 "Like `delete-char', but insert whitespace at field end in tables.
@@ -16151,30 +16152,31 @@ front of the next \"|\" separator, to keep the table aligned. The table will
1615116152still be marked for re-alignment if the field did fill the entire column,
1615216153because, in this case the deletion might narrow the column."
1615316154 (interactive "p")
16154- (save-match-data
16155- (org-fold-check-before-invisible-edit 'delete)
16156- (cond
16157- ((or (/= N 1)
16158- (eq (char-after) ?|)
16159- (save-excursion (skip-chars-backward " \t") (bolp))
16160- (not (org-at-table-p)))
16161- (delete-char N)
16162- (org-fix-tags-on-the-fly))
16163- ((looking-at ".\\(.*?\\)|")
16164- (let* ((update? org-table-may-need-update)
16165- (noalign (looking-at-p ".*? |")))
16166- (delete-char 1)
16167- (org-table-with-shrunk-field
16168- (save-excursion
16169- ;; Last space is `org-table-separator-space', so insert
16170- ;; a regular one before it instead.
16171- (goto-char (- (match-end 0) 2))
16172- (insert " ")))
16173- ;; If there were two spaces at the end, this field does not
16174- ;; determine the width of the column.
16175- (when noalign (setq org-table-may-need-update update?))))
16176- (t
16177- (delete-char N)))))
16155+ (org-fold-core-ignore-modifications
16156+ (save-match-data
16157+ (org-fold-check-before-invisible-edit 'delete)
16158+ (cond
16159+ ((or (/= N 1)
16160+ (eq (char-after) ?|)
16161+ (save-excursion (skip-chars-backward " \t") (bolp))
16162+ (not (org-at-table-p)))
16163+ (delete-char N)
16164+ (org-fix-tags-on-the-fly))
16165+ ((looking-at ".\\(.*?\\)|")
16166+ (let* ((update? org-table-may-need-update)
16167+ (noalign (looking-at-p ".*? |")))
16168+ (delete-char 1)
16169+ (org-table-with-shrunk-field
16170+ (save-excursion
16171+ ;; Last space is `org-table-separator-space', so insert
16172+ ;; a regular one before it instead.
16173+ (goto-char (- (match-end 0) 2))
16174+ (insert " ")))
16175+ ;; If there were two spaces at the end, this field does not
16176+ ;; determine the width of the column.
16177+ (when noalign (setq org-table-may-need-update update?))))
16178+ (t
16179+ (delete-char N))))))
1617816180
1617916181;; Make `delete-selection-mode' work with Org mode and Orgtbl mode
1618016182(put 'org-self-insert-command 'delete-selection
0 commit comments