* bug#15766: 24.3; [patch] electric-indent-mode-bug
@ 2013-10-30 23:16 Dave Abrahams
2013-10-30 23:51 ` Glenn Morris
0 siblings, 1 reply; 2+ messages in thread
From: Dave Abrahams @ 2013-10-30 23:16 UTC (permalink / raw)
To: 15766
[-- Attachment #1.1: Type: text/plain, Size: 466 bytes --]
1. emacs -Q
2. eval the following:
(electric-indent-mode)
(electric-layout-mode)
(setq electric-indent-chars (append "{}" electric-indent-chars))
(setq electric-layout-rules '((?\{ . after) (?\} . before)))
3. type `f o o {'
Result expected: a buffer containing
----- schnipp -----
foo {
----- schnapp -----
Result received: a buffer containing
----- schnipp -----
foo{
----- schnapp -----
Patch is enclosed that fixes the problem.
--
Dave Abrahams
[-- Attachment #1.2: Type: text/html, Size: 3243 bytes --]
[-- Attachment #2: electric.el.patch --]
[-- Type: application/octet-stream, Size: 1548 bytes --]
diff --git a/lisp/electric.el b/lisp/electric.el
index 58b8e10..e4257b2 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -212,7 +212,7 @@ point right after that char, and it should return t to cause indentation,
;; electric-pair-mode wrapping a region with a pair of parens.
;; There might be a way to get it working by analyzing buffer-undo-list, but
;; it looks challenging.
- (let (pos)
+ (let (pos line-beginning-pos)
(when (and
electric-indent-mode
;; Don't reindent while inserting spaces at beginning of line.
@@ -221,6 +221,7 @@ point right after that char, and it should return t to cause indentation,
(setq pos (electric--after-char-pos))
(save-excursion
(goto-char pos)
+ (setq line-beginning-pos (line-beginning-position))
(let ((act (or (run-hook-with-args-until-success
'electric-indent-functions
last-command-event)
@@ -231,7 +232,7 @@ point right after that char, and it should return t to cause indentation,
(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 (< (1- pos) (line-beginning-position))
+ (when (< (1- pos) line-beginning-pos)
(let ((before (copy-marker (1- pos) t)))
(save-excursion
(unless (memq indent-line-function
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#15766: 24.3; [patch] electric-indent-mode-bug
2013-10-30 23:16 bug#15766: 24.3; [patch] electric-indent-mode-bug Dave Abrahams
@ 2013-10-30 23:51 ` Glenn Morris
0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-10-30 23:51 UTC (permalink / raw)
To: Dave Abrahams; +Cc: 15766
This is a literal duplicate of
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15767
and will be deleted.
Please send any further correspondence on this to 15767@debbugs.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-30 23:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 23:16 bug#15766: 24.3; [patch] electric-indent-mode-bug Dave Abrahams
2013-10-30 23:51 ` Glenn Morris
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.