aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-11-04 15:04:25 -0500
committerStefan Monnier2013-11-04 15:04:25 -0500
commit0ade65b530469a4c6a7d22d3be14f62f0ae8a790 (patch)
treebe52705202e5ce47fd236c0f76f9705863d2131a
parentef9dd188afe8f2bb8837e8be90a8c7d8c357320b (diff)
downloademacs-0ade65b530469a4c6a7d22d3be14f62f0ae8a790.tar.gz
emacs-0ade65b530469a4c6a7d22d3be14f62f0ae8a790.zip
* lisp/electric.el (electric-indent-post-self-insert-function):
Only delete trailing whitepsace if it is indeed trailing. Fixes: debbugs:15767
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/electric.el12
2 files changed, 9 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b5aa974c10c..c4f5efd371e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-11-04 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * electric.el (electric-indent-post-self-insert-function):
4 Only delete trailing whitepsace if it is indeed trailing (bug#15767).
5
12013-11-04 Helmut Eller <eller.helmut@gmail.com> 62013-11-04 Helmut Eller <eller.helmut@gmail.com>
2 7
3 * emacs-lisp/cl-indent.el (with-compilation-unit): Add rule (bug#15782). 8 * emacs-lisp/cl-indent.el (with-compilation-unit): Add rule (bug#15782).
diff --git a/lisp/electric.el b/lisp/electric.el
index b62de874b93..1f95e68dbf5 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -251,9 +251,10 @@ Python does not lend itself to fully automatic indentation.")
251 ;; whereas we need `move after insertion', so we do the 251 ;; whereas we need `move after insertion', so we do the
252 ;; save/restore by hand. 252 ;; save/restore by hand.
253 (goto-char before) 253 (goto-char before)
254 ;; Remove the trailing whitespace after indentation because 254 (when (eolp)
255 ;; indentation may (re)introduce the whitespace. 255 ;; Remove the trailing whitespace after indentation because
256 (delete-horizontal-space t)))) 256 ;; indentation may (re)introduce the whitespace.
257 (delete-horizontal-space t)))))
257 (unless (or (memq indent-line-function '(indent-to-left-margin)) 258 (unless (or (memq indent-line-function '(indent-to-left-margin))
258 (and electric-indent-inhibit 259 (and electric-indent-inhibit
259 (> pos (line-beginning-position)))) 260 (> pos (line-beginning-position))))
@@ -270,7 +271,6 @@ This is a global minor mode. When enabled, it reindents whenever
270the hook `electric-indent-functions' returns non-nil, or you 271the hook `electric-indent-functions' returns non-nil, or you
271insert a character from `electric-indent-chars'." 272insert a character from `electric-indent-chars'."
272 :global t 273 :global t
273 :group 'electricity
274 (if (not electric-indent-mode) 274 (if (not electric-indent-mode)
275 (remove-hook 'post-self-insert-hook 275 (remove-hook 'post-self-insert-hook
276 #'electric-indent-post-self-insert-function) 276 #'electric-indent-post-self-insert-function)
@@ -294,7 +294,6 @@ insert a character from `electric-indent-chars'."
294(defcustom electric-pair-pairs 294(defcustom electric-pair-pairs
295 '((?\" . ?\")) 295 '((?\" . ?\"))
296 "Alist of pairs that should be used regardless of major mode." 296 "Alist of pairs that should be used regardless of major mode."
297 :group 'electricity
298 :version "24.1" 297 :version "24.1"
299 :type '(repeat (cons character character))) 298 :type '(repeat (cons character character)))
300 299
@@ -304,7 +303,6 @@ When inserting a closing paren character right before the same character,
304just skip that character instead, so that hitting ( followed by ) results 303just skip that character instead, so that hitting ( followed by ) results
305in \"()\" rather than \"())\". 304in \"()\" rather than \"())\".
306This can be convenient for people who find it easier to hit ) than C-f." 305This can be convenient for people who find it easier to hit ) than C-f."
307 :group 'electricity
308 :version "24.1" 306 :version "24.1"
309 :type 'boolean) 307 :type 'boolean)
310 308
@@ -410,7 +408,6 @@ closing parenthesis. \(Likewise for brackets, etc.)
410 408
411See options `electric-pair-pairs' and `electric-pair-skip-self'." 409See options `electric-pair-pairs' and `electric-pair-skip-self'."
412 :global t 410 :global t
413 :group 'electricity
414 (if electric-pair-mode 411 (if electric-pair-mode
415 (progn 412 (progn
416 (add-hook 'post-self-insert-hook 413 (add-hook 'post-self-insert-hook
@@ -463,7 +460,6 @@ positive, and disable it otherwise. If called from Lisp, enable
463the mode if ARG is omitted or nil. 460the mode if ARG is omitted or nil.
464The variable `electric-layout-rules' says when and how to insert newlines." 461The variable `electric-layout-rules' says when and how to insert newlines."
465 :global t 462 :global t
466 :group 'electricity
467 (if electric-layout-mode 463 (if electric-layout-mode
468 (add-hook 'post-self-insert-hook 464 (add-hook 'post-self-insert-hook
469 #'electric-layout-post-self-insert-function) 465 #'electric-layout-post-self-insert-function)