diff options
author | Bastien Guerry <bzg@altern.org> | 2012-12-23 17:31:41 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-12-23 17:31:41 +0100 |
commit | f0a64ab3b5c46c8c7b1c838de2ed20511357e43d (patch) | |
tree | a7467d9860810fe54dbfb4136900b3dac8499789 | |
parent | c2e662cf7977fd7ca8794f5e72dd0ff844e1138d (diff) | |
download | org-mode-f0a64ab3b5c46c8c7b1c838de2ed20511357e43d.tar.gz |
org-table.el: Use `org-delete-backward-char' which doesn't modify match data anymore
* org-table.el (org-table-fedit-lisp-indent)
(orgtbl-self-insert-command): Use `org-delete-backward-char'
instead of `backward-delete-char'.
* org.el (org-delete-backward-char, org-delete-char): Save
match data.
-rw-r--r-- | lisp/org-table.el | 4 | ||||
-rw-r--r-- | lisp/org.el | 78 |
2 files changed, 42 insertions, 40 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el index c7d6176..61107d7 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3580,7 +3580,7 @@ With prefix ARG, apply the new formulas to the table." (beginning-of-line 1) (insert ind)) (goto-char (point-max)) - (backward-delete-char 1))) + (org-delete-backward-char 1))) (goto-char beg)) (t nil)))) @@ -4235,7 +4235,7 @@ overwritten, and the table is not marked as requiring realignment." (looking-at "[^|\n]* +|")) (let (org-table-may-need-update) (goto-char (1- (match-end 0))) - (backward-delete-char 1) + (org-delete-backward-char 1) (goto-char (match-beginning 0)) (self-insert-command N)) (setq org-table-may-need-update t) diff --git a/lisp/org.el b/lisp/org.el index 4d755c5..44633eb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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) |