summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-11-05 23:07:18 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-11-05 23:18:13 +0100
commit73a5c27cc1751721344886e7518f20ff382265b5 (patch)
treecaed51908ca5e850396ae11aa938f8ad205a6444
parent5e22dcd6225d13359346c45c31691bbe0c0b37d7 (diff)
downloadorg-mode-73a5c27cc1751721344886e7518f20ff382265b5.tar.gz
Fix table editing with an active region
* lisp/org.el (org-self-insert-command): Do not call `backward-delete-char' since it possibly deletes active region. Simplify code. This fixes bug#21838.
-rwxr-xr-xlisp/org.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el
index b216702..d5551c9 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20174,23 +20174,23 @@ overwritten, and the table is not marked as requiring realignment."
((and
(org-table-p)
(progn
- ;; check if we blank the field, and if that triggers align
+ ;; Check if we blank the field, and if that triggers align.
(and (featurep 'org-table) org-table-auto-blank-field
(memq last-command
'(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
- (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |"))
- ;; got extra space, this field does not determine column width
+ (if (or (eq (char-after) ?\s) (looking-at "[^|\n]* |"))
+ ;; Got extra space, this field does not determine
+ ;; column width.
(let (org-table-may-need-update) (org-table-blank-field))
- ;; no extra space, this field may determine column width
+ ;; No extra space, this field may determine column
+ ;; width.
(org-table-blank-field)))
t)
(eq N 1)
- (looking-at "[^|\n]* |"))
- (let (org-table-may-need-update)
- (goto-char (1- (match-end 0)))
- (backward-delete-char 1)
- (goto-char (match-beginning 0))
- (self-insert-command N)))
+ (looking-at "[^|\n]* \\( \\)|"))
+ ;; There is room for insertion without re-aligning the table.
+ (delete-region (match-beginning 1) (match-end 1))
+ (self-insert-command N))
(t
(setq org-table-may-need-update t)
(self-insert-command N)