diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-12-07 10:36:08 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-12-07 10:36:08 -0500 |
commit | a733fc371502abdee5522daf40fa983de4015a41 (patch) | |
tree | 800aced49844fb9a4f074d919d8c8a10595de7df /lisp/electric.el | |
parent | f2f6365c7453e5a568fd4028bb87031f691df8b7 (diff) | |
download | emacs-a733fc371502abdee5522daf40fa983de4015a41.tar.gz |
* lisp/electric.el (electric-indent-post-self-insert-function):
Delete trailing newlines even if we don't reindent.
Diffstat (limited to 'lisp/electric.el')
-rw-r--r-- | lisp/electric.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/electric.el b/lisp/electric.el index 0ea8cb30010..3ffd94d7e12 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -217,15 +217,15 @@ Returns nil when we can't find this char." (not (nth 8 (save-excursion (syntax-ppss pos))))) ;; For newline, we want to reindent both lines and basically behave like ;; reindent-then-newline-and-indent (whose code we hence copied). - (when (and (< (1- pos) (line-beginning-position)) - ;; Don't reindent the previous line if the indentation - ;; function is not a real one. - (not (memq indent-line-function - '(indent-relative indent-relative-maybe)))) + (when (< (1- pos) (line-beginning-position)) (let ((before (copy-marker (1- pos) t))) (save-excursion - (goto-char before) - (indent-according-to-mode) + (unless (memq indent-line-function + '(indent-relative indent-relative-maybe)) + ;; 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 |