diff options
| author | Stefan Monnier | 2010-12-07 10:36:08 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-07 10:36:08 -0500 |
| commit | a733fc371502abdee5522daf40fa983de4015a41 (patch) | |
| tree | 800aced49844fb9a4f074d919d8c8a10595de7df | |
| parent | f2f6365c7453e5a568fd4028bb87031f691df8b7 (diff) | |
| download | emacs-a733fc371502abdee5522daf40fa983de4015a41.tar.gz emacs-a733fc371502abdee5522daf40fa983de4015a41.zip | |
* lisp/electric.el (electric-indent-post-self-insert-function):
Delete trailing newlines even if we don't reindent.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/electric.el | 14 |
2 files changed, 17 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 45683ec186d..372730323c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2010-12-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * electric.el (electric-indent-post-self-insert-function): | ||
| 4 | Delete trailing newlines even if we don't reindent. | ||
| 5 | |||
| 1 | 2010-12-06 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2010-12-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 8 | * minibuffer.el (completion-at-point): Remove the `arg'. | ||
| 9 | * bindings.el (complete-symbol): Move back from minibuffer.el. | ||
| 10 | |||
| 11 | 2010-12-06 Deniz Dogan <deniz.a.m.dogan@gmail.com> | ||
| 12 | |||
| 3 | * simple.el (just-one-space): Delete newlines for negative arg. | 13 | * simple.el (just-one-space): Delete newlines for negative arg. |
| 4 | 14 | ||
| 5 | 2010-12-06 Stefan Monnier <monnier@iro.umontreal.ca> | 15 | 2010-12-06 Stefan Monnier <monnier@iro.umontreal.ca> |
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." | |||
| 217 | (not (nth 8 (save-excursion (syntax-ppss pos))))) | 217 | (not (nth 8 (save-excursion (syntax-ppss pos))))) |
| 218 | ;; For newline, we want to reindent both lines and basically behave like | 218 | ;; For newline, we want to reindent both lines and basically behave like |
| 219 | ;; reindent-then-newline-and-indent (whose code we hence copied). | 219 | ;; reindent-then-newline-and-indent (whose code we hence copied). |
| 220 | (when (and (< (1- pos) (line-beginning-position)) | 220 | (when (< (1- pos) (line-beginning-position)) |
| 221 | ;; Don't reindent the previous line if the indentation | ||
| 222 | ;; function is not a real one. | ||
| 223 | (not (memq indent-line-function | ||
| 224 | '(indent-relative indent-relative-maybe)))) | ||
| 225 | (let ((before (copy-marker (1- pos) t))) | 221 | (let ((before (copy-marker (1- pos) t))) |
| 226 | (save-excursion | 222 | (save-excursion |
| 227 | (goto-char before) | 223 | (unless (memq indent-line-function |
| 228 | (indent-according-to-mode) | 224 | '(indent-relative indent-relative-maybe)) |
| 225 | ;; Don't reindent the previous line if the indentation function | ||
| 226 | ;; is not a real one. | ||
| 227 | (goto-char before) | ||
| 228 | (indent-according-to-mode)) | ||
| 229 | ;; We are at EOL before the call to indent-according-to-mode, and | 229 | ;; We are at EOL before the call to indent-according-to-mode, and |
| 230 | ;; after it we usually are as well, but not always. We tried to | 230 | ;; after it we usually are as well, but not always. We tried to |
| 231 | ;; address it with `save-excursion' but that uses a normal marker | 231 | ;; address it with `save-excursion' but that uses a normal marker |