[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r117095: * lisp/electric.el (electric-indent-post
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs-24 r117095: * lisp/electric.el (electric-indent-post-self-insert-function): Don't use |
Date: |
Fri, 09 May 2014 18:03:27 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117095
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17449
author: Philipp Rumpf <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-05-09 14:03:21 -0400
message:
* lisp/electric.el (electric-indent-post-self-insert-function): Don't use
`pos' after modifying the buffer.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/electric.el electric.el-20091113204419-o5vbwnq5f7feedwu-47
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-05-09 16:51:17 +0000
+++ b/lisp/ChangeLog 2014-05-09 18:03:21 +0000
@@ -1,3 +1,8 @@
+2014-05-09 Philipp Rumpf <address@hidden> (tiny change)
+
+ * electric.el (electric-indent-post-self-insert-function): Don't use
+ `pos' after modifying the buffer (bug#17449).
+
2014-05-09 Stefan Monnier <address@hidden>
* subr.el (function-put): Add function.
=== modified file 'lisp/electric.el'
--- a/lisp/electric.el 2014-05-05 19:04:40 +0000
+++ b/lisp/electric.el 2014-05-09 18:03:21 +0000
@@ -259,29 +259,30 @@
(unless (eq act 'do-indent) (nth 8 (syntax-ppss))))))))
;; For newline, we want to reindent both lines and basically behave like
;; reindent-then-newline-and-indent (whose code we hence copied).
- (when (<= pos (line-beginning-position))
- (let ((before (copy-marker (1- pos) t)))
- (save-excursion
- (unless (or (memq indent-line-function
- electric-indent-functions-without-reindent)
- electric-indent-inhibit)
- ;; Don't reindent the previous line if the indentation function
- ;; is not a real one.
+ (let ((at-newline (<= pos (line-beginning-position))))
+ (when at-newline
+ (let ((before (copy-marker (1- pos) t)))
+ (save-excursion
+ (unless (or (memq indent-line-function
+ electric-indent-functions-without-reindent)
+ electric-indent-inhibit)
+ ;; Don't reindent the previous line if the indentation function
+ ;; is not a real one.
+ (goto-char before)
+ (indent-according-to-mode))
+ ;; We are at EOL before the call to indent-according-to-mode, and
+ ;; after it we usually are as well, but not always. We tried to
+ ;; address it with `save-excursion' but that uses a normal marker
+ ;; whereas we need `move after insertion', so we do the
+ ;; save/restore by hand.
(goto-char before)
- (indent-according-to-mode))
- ;; We are at EOL before the call to indent-according-to-mode, and
- ;; after it we usually are as well, but not always. We tried to
- ;; address it with `save-excursion' but that uses a normal marker
- ;; whereas we need `move after insertion', so we do the
- ;; save/restore by hand.
- (goto-char before)
- (when (eolp)
- ;; Remove the trailing whitespace after indentation because
- ;; indentation may (re)introduce the whitespace.
- (delete-horizontal-space t)))))
- (unless (and electric-indent-inhibit
- (> pos (line-beginning-position)))
- (indent-according-to-mode)))))
+ (when (eolp)
+ ;; Remove the trailing whitespace after indentation because
+ ;; indentation may (re)introduce the whitespace.
+ (delete-horizontal-space t)))))
+ (unless (and electric-indent-inhibit
+ (not at-newline))
+ (indent-according-to-mode))))))
(put 'electric-indent-post-self-insert-function 'priority 60)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r117095: * lisp/electric.el (electric-indent-post-self-insert-function): Don't use,
Stefan Monnier <=