|
@@ -18301,25 +18301,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will
|
|
|
still be marked for re-alignment if the field did fill the entire column,
|
|
|
because, in this case the deletion might narrow the column."
|
|
|
(interactive "p")
|
|
|
- (org-check-before-invisible-edit 'delete-backward)
|
|
|
- (if (and (org-table-p)
|
|
|
- (eq N 1)
|
|
|
- (string-match "|" (buffer-substring (point-at-bol) (point)))
|
|
|
- (looking-at ".*?|"))
|
|
|
- (let ((pos (point))
|
|
|
- (noalign (looking-at "[^|\n\r]* |"))
|
|
|
- (c org-table-may-need-update))
|
|
|
- (backward-delete-char N)
|
|
|
- (if (not overwrite-mode)
|
|
|
- (progn
|
|
|
- (skip-chars-forward "^|")
|
|
|
- (insert " ")
|
|
|
- (goto-char (1- pos))))
|
|
|
- ;; noalign: if there were two spaces at the end, this field
|
|
|
- ;; does not determine the width of the column.
|
|
|
- (if noalign (setq org-table-may-need-update c)))
|
|
|
- (backward-delete-char N)
|
|
|
- (org-fix-tags-on-the-fly)))
|
|
|
+ (save-match-data
|
|
|
+ (org-check-before-invisible-edit 'delete-backward)
|
|
|
+ (if (and (org-table-p)
|
|
|
+ (eq N 1)
|
|
|
+ (string-match "|" (buffer-substring (point-at-bol) (point)))
|
|
|
+ (looking-at ".*?|"))
|
|
|
+ (let ((pos (point))
|
|
|
+ (noalign (looking-at "[^|\n\r]* |"))
|
|
|
+ (c org-table-may-need-update))
|
|
|
+ (backward-delete-char N)
|
|
|
+ (if (not overwrite-mode)
|
|
|
+ (progn
|
|
|
+ (skip-chars-forward "^|")
|
|
|
+ (insert " ")
|
|
|
+ (goto-char (1- pos))))
|
|
|
+ ;; noalign: if there were two spaces at the end, this field
|
|
|
+ ;; does not determine the width of the column.
|
|
|
+ (if noalign (setq org-table-may-need-update c)))
|
|
|
+ (backward-delete-char N)
|
|
|
+ (org-fix-tags-on-the-fly))))
|
|
|
|
|
|
(defun org-delete-char (N)
|
|
|
"Like `delete-char', but insert whitespace at field end in tables.
|
|
@@ -18328,25 +18329,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will
|
|
|
still be marked for re-alignment if the field did fill the entire column,
|
|
|
because, in this case the deletion might narrow the column."
|
|
|
(interactive "p")
|
|
|
- (org-check-before-invisible-edit 'delete)
|
|
|
- (if (and (org-table-p)
|
|
|
- (not (bolp))
|
|
|
- (not (= (char-after) ?|))
|
|
|
- (eq N 1))
|
|
|
- (if (looking-at ".*?|")
|
|
|
- (let ((pos (point))
|
|
|
- (noalign (looking-at "[^|\n\r]* |"))
|
|
|
- (c org-table-may-need-update))
|
|
|
- (replace-match (concat
|
|
|
- (substring (match-string 0) 1 -1)
|
|
|
- " |"))
|
|
|
- (goto-char pos)
|
|
|
- ;; noalign: if there were two spaces at the end, this field
|
|
|
- ;; does not determine the width of the column.
|
|
|
- (if noalign (setq org-table-may-need-update c)))
|
|
|
- (delete-char N))
|
|
|
- (delete-char N)
|
|
|
- (org-fix-tags-on-the-fly)))
|
|
|
+ (save-match-data
|
|
|
+ (org-check-before-invisible-edit 'delete)
|
|
|
+ (if (and (org-table-p)
|
|
|
+ (not (bolp))
|
|
|
+ (not (= (char-after) ?|))
|
|
|
+ (eq N 1))
|
|
|
+ (if (looking-at ".*?|")
|
|
|
+ (let ((pos (point))
|
|
|
+ (noalign (looking-at "[^|\n\r]* |"))
|
|
|
+ (c org-table-may-need-update))
|
|
|
+ (replace-match (concat
|
|
|
+ (substring (match-string 0) 1 -1)
|
|
|
+ " |"))
|
|
|
+ (goto-char pos)
|
|
|
+ ;; noalign: if there were two spaces at the end, this field
|
|
|
+ ;; does not determine the width of the column.
|
|
|
+ (if noalign (setq org-table-may-need-update c)))
|
|
|
+ (delete-char N))
|
|
|
+ (delete-char N)
|
|
|
+ (org-fix-tags-on-the-fly))))
|
|
|
|
|
|
;; Make `delete-selection-mode' work with org-mode and orgtbl-mode
|
|
|
(put 'org-self-insert-command 'delete-selection t)
|