GNU bug report logs - #15767
24.3; [patch] electric-indent-mode bug

Previous Next

Package: emacs;

Reported by: Dave Abrahams <dave <at> boostpro.com>

Date: Wed, 30 Oct 2013 23:43:02 UTC

Severity: minor

Tags: patch

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15767 in the body.
You can then email your comments to 15767 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Wed, 30 Oct 2013 23:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dave Abrahams <dave <at> boostpro.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 30 Oct 2013 23:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dave Abrahams <dave <at> boostpro.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; [patch] electric-indent-mode bug
Date: Wed, 30 Oct 2013 16:03:34 -0700
[Message part 1 (text/plain, inline)]
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.


[electric.el.patch (text/x-patch, inline)]
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
[Message part 3 (text/plain, inline)]


In GNU Emacs 24.3.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 AppKit 1138.51)
 of 2013-10-27 on Yukikaze.local
Windowing system distributor `Apple Inc.', version 10.9.0
Configured using:
 `configure '--with-mac'
 '--enable-mac-app=/Users/xin/Documents/emacs-mac-port/build'
 '--prefix=/Users/xin/Documents/emacs-mac-port/build''

Important settings:
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  electric-layout-mode: t
  electric-pair-mode: t
  electric-indent-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  diff-auto-refine-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  override-global-mode: t
  workgroups-mode: t
  nxhtml-menu-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  me-minor-mode: t
  which-function-mode: t
  show-paren-mode: t
  server-mode: t
  global-auto-revert-mode: t
  display-time-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  mac-mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-e C-p C-p C-p C-p C-p C-p C-p C-p C-p C-b SPC l i 
n e - b e g g <backspace> i n - p o s C-b C-b C-b C-b 
i n g b b <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> n n i n g C-n C-e C-p C-e C-, 
C-, C-, C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-e C-n C-b C-SPC C-, C-, 
C-, C-b M-w C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-e C-n C-n C-n C-n C-n 
C-n C-e <return> <tab> ( s e t q SPC l i n e - b e 
M-/ SPC C-y C-e C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-, C-, C-, <backspace> C-. C-. C-. C-d <backspace> 
<backspace> <backspace> <backspace> <backspace> C-x 
C-s C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-e C-p C-p C-e 
C-n C-x C-e <C-return> C-p C-e C-n <backspace> <backspace> 
<backspace> <backspace> SPC { <C-return> C-SPC C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-g C-g C-g M-! g i t SPC d i f f <return> <C-return> 
C-s e l e C-p C-n C-n C-s e l e c t r i c C-a C-SPC 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n M-w <C-return> C-x C-b C-x C-b M-x 
e m a v <backspace> c - <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> r e p o r t - e 
m <tab> <return>

Recent messages:
Mark set
Saving file /Users/dave/src/emacs-mac-port/lisp/electric.el...
Wrote /Users/dave/src/emacs-mac-port/lisp/electric.el
electric-indent-post-self-insert-function
Mark set
Quit [3 times]
Mark saved where search started [2 times]
Mark set
delete-backward-char: Text is read-only
Loading /Users/dave/.emacs.d/el-get/dwamacs/settings/message-settings.el (source)...done

Load-path shadows:
/Users/dave/.emacs.d/el-get/php-mode/php-mode hides /Users/dave/.emacs.d/el-get/nxhtml/related/php-mode
/Users/dave/.emacs.d/el-get/nxhtml/related/csharp-mode hides /Users/dave/.emacs.d/el-get/csharp-mode/csharp-mode
/Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/loaddefs
/Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Users/dave/.emacs.d/el-get/cedet/lisp/cedet/loaddefs
/Users/dave/.emacs.d/el-get/magit/.dir-locals hides /Users/dave/.emacs.d/el-get/el-get/.dir-locals
/Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Applications/Emacs.app/Contents/Resources/lisp/loaddefs
/Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ediff-util hides /Applications/Emacs.app/Contents/Resources/lisp/vc/ediff-util
/Users/dave/.emacs.d/el-get/python/python hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/python
/Users/dave/.emacs.d/el-get/dwamacs/site-lisp/compile hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/compile
/Users/dave/.emacs.d/el-get/nxhtml/util/org-odt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-odt
/Users/dave/.emacs.d/el-get/magit/.dir-locals hides /Applications/Emacs.app/Contents/Resources/lisp/gnus/.dir-locals
/Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ert hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/ert
/Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ert-x hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/ert-x
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-speedbar hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-speedbar
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-opt hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-opt
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-datadebug hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-datadebug
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-custom hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-custom
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-base hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-base
/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/chart hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/chart

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils debug pcase
cedet-edebug edebug mule-util tabify electric cmake-mode thingatpt
dired-aux gnus-dired sh-script smie executable view dabbrev hl-line
shell pcomplete misearch multi-isearch magit-svn sticky-windows recentf
tree-widget jka-compr sb-info info shiny-mode flymake compile comint
ansi-color auto-complete-clang-async magit-bisect magit-key-mode magit
diff-mode log-edit ring pcvs-util add-log proof-site proof-autoloads
pg-vars page-ext ffap url-parse auth-source gnus-util mm-util mail-prsvr
password-cache url-vars auto-complete-config auto-complete popup
use-package bind-key session-settings session system-type-darwin-theme
osx-plist xml .loaddefs workgroups flymake-files flymakemsg
nxhtml-autostart nxhtml-autoload majmodpri vc-git nxhtml-menu
web-autoload nxhtml-base helm-config helm-aliases fill-column-indicator
initsplit cus-edit diminish csharp-mode cc-langs rust-mode modal cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs cm-mode cedet-devel-load warnings eieio-opt find-func
srecode/map semantic/edit srecode/srt-mode srecode/template
srecode/srt-wy semantic/wisent semantic/wisent/wisent srecode/ctxt
srecode/compile srecode/dictionary srecode/table srecode
semantic/canned-configs semantic/ia-sb semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db semantic/ctxt
semantic/format semantic/tag-ls semantic/find semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
cedet-compat inversion ede/speedbar ede/files ede ede/base ede/auto
ede/source eieio-base eieio-speedbar speedbar sb-image ezimage dframe
eieio-custom wid-edit cedet eieio byte-opt eieio-core
cedet-remove-builtin yasnippet advice advice-preload dropdown-list
derived edmacro kmacro el-get el-get-autoloads el-get-list-packages
el-get-notify help-mode el-get-dependencies el-get-build el-get-status
pp el-get-recipes el-get-byte-compile el-get-methods el-get-fossil
el-get-svn el-get-pacman el-get-github-zip el-get-github-tar
el-get-http-zip el-get-http-tar el-get-hg el-get-git-svn el-get-fink
el-get-emacswiki el-get-http el-get-emacsmirror el-get-github el-get-git
el-get-elpa package cl-macs gv el-get-darcs el-get-cvs el-get-bzr
el-get-brew el-get-builtin el-get-apt-get el-get-custom el-get-core
autoload help-fns bytecomp byte-compile cconv cl cl-lib dired-x easymenu
dired easy-mmode which-func imenu paren server ido autorevert time
delsel cus-start cus-load elhome time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel mac-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote mac
multi-tty make-network-process emacs)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Thu, 31 Oct 2013 17:07:01 GMT) Full text and rfc822 format available.

Message #8 received at 15767 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 15767 <at> debbugs.gnu.org
Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
Date: Thu, 31 Oct 2013 13:06:24 -0400
> 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 -----

I must be missing something:
- your patch does not seem to make any difference to your test case.
- I don't understand why you'd expect `f o o {' to end up inserting
  a space between foo and the open brace.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Fri, 01 Nov 2013 03:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 15767 <at> debbugs.gnu.org (full text, mbox):

From: Dave Abrahams <dave <at> boostpro.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: "15767 <at> debbugs.gnu.org" <15767 <at> debbugs.gnu.org>
Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
Date: Thu, 31 Oct 2013 20:27:55 -0700
Sorry, the test case is wrong; you're supposed to type `f o o SPC {'

Sent from my illudium Q-36 explosive space modulator

On Oct 31, 2013, at 10:06 AM, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

>> 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 -----
> 
> I must be missing something:
> - your patch does not seem to make any difference to your test case.
> - I don't understand why you'd expect `f o o {' to end up inserting
>  a space between foo and the open brace.
> 
> 
>        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 04 Nov 2013 20:05:01 GMT) Full text and rfc822 format available.

Notification sent to Dave Abrahams <dave <at> boostpro.com>:
bug acknowledged by developer. (Mon, 04 Nov 2013 20:05:03 GMT) Full text and rfc822 format available.

Message #16 received at 15767-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 15767-done <at> debbugs.gnu.org
Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
Date: Mon, 04 Nov 2013 15:04:31 -0500
>   (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 SPC {'

Thanks.  Your patch defeated a useful case, so I replaced it with the
one below,


        Stefan


--- lisp/electric.el	2013-10-07 18:51:26 +0000
+++ lisp/electric.el	2013-11-04 20:01:20 +0000
@@ -251,9 +251,10 @@
             ;; 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))))
+	      (delete-horizontal-space t)))))
       (unless (or (memq indent-line-function '(indent-to-left-margin))
                   (and electric-indent-inhibit
                        (> pos (line-beginning-position))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Tue, 05 Nov 2013 05:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 15767 <at> debbugs.gnu.org (full text, mbox):

From: Dave Abrahams <dave <at> boostpro.com>
To: 15767 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#15767: closed (Re: bug#15767: 24.3;
 [patch] electric-indent-mode bug)
Date: Mon, 4 Nov 2013 21:06:33 -0800
[Message part 1 (text/plain, inline)]
On Nov 4, 2013, at 12:05 PM, GNU bug Tracking System <help-debbugs <at> gnu.org> wrote:

> Your bug report
> 
> #15767: 24.3; [patch] electric-indent-mode bug
> 
> which was filed against the emacs package, has been closed.
> 
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 15767 <at> debbugs.gnu.org.
> 
> -- 
> 15767: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15767
> GNU Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
> 
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
> Date: November 4, 2013 at 12:04:31 PM PST
> To: Dave Abrahams <dave <at> boostpro.com>
> Cc: 15767-done <at> debbugs.gnu.org
> 
> 
>>  (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 SPC {'
> 
> Thanks.  Your patch defeated a useful case, so I replaced it with the
> one below,


Well, the problem I see is that you left the call to line-beginning-position where it was in the original call.  At that point, point may be on a different line than it started on, so it’s actually getting information about the wrong line.  It’s possible that your patch somehow makes everything work out, but leaving the call to line-beginning-position where it is seems at best fragile to me.
 
> 
>        Stefan
> 
> 
> --- lisp/electric.el	2013-10-07 18:51:26 +0000
> +++ lisp/electric.el	2013-11-04 20:01:20 +0000
> @@ -251,9 +251,10 @@
>             ;; 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))))
> +	      (delete-horizontal-space t)))))
>       (unless (or (memq indent-line-function '(indent-to-left-margin))
>                   (and electric-indent-inhibit
>                        (> pos (line-beginning-position))))
> 
> 
> 
> 
> From: Dave Abrahams <dave <at> boostpro.com>
> Subject: 24.3; [patch] electric-indent-mode bug
> Date: October 30, 2013 at 4:03:34 PM PDT
> To: bug-gnu-emacs <at> gnu.org
> 
> 
> 
> 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.
> 
> 
> 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
> 
> 
> 
> In GNU Emacs 24.3.1 (x86_64-apple-darwin11.4.2, Carbon Version 1.6.0 AppKit 1138.51)
> of 2013-10-27 on Yukikaze.local
> Windowing system distributor `Apple Inc.', version 10.9.0
> Configured using:
> `configure '--with-mac'
> '--enable-mac-app=/Users/xin/Documents/emacs-mac-port/build'
> '--prefix=/Users/xin/Documents/emacs-mac-port/build''
> 
> Important settings:
>  locale-coding-system: utf-8-unix
>  default enable-multibyte-characters: t
> 
> Major mode: Emacs-Lisp
> 
> Minor modes in effect:
>  electric-layout-mode: t
>  electric-pair-mode: t
>  electric-indent-mode: t
>  shell-dirtrack-mode: t
>  recentf-mode: t
>  diff-auto-refine-mode: t
>  global-auto-complete-mode: t
>  auto-complete-mode: t
>  override-global-mode: t
>  workgroups-mode: t
>  nxhtml-menu-mode: t
>  yas-global-mode: t
>  yas-minor-mode: t
>  me-minor-mode: t
>  which-function-mode: t
>  show-paren-mode: t
>  server-mode: t
>  global-auto-revert-mode: t
>  display-time-mode: t
>  delete-selection-mode: t
>  tooltip-mode: t
>  mac-mouse-wheel-mode: t
>  menu-bar-mode: t
>  file-name-shadow-mode: t
>  global-font-lock-mode: t
>  font-lock-mode: t
>  auto-composition-mode: t
>  auto-encryption-mode: t
>  auto-compression-mode: t
>  line-number-mode: t
>  transient-mark-mode: t
> 
> Recent input:
> C-e C-p C-p C-p C-p C-p C-p C-p C-p C-p C-b SPC l i 
> n e - b e g g <backspace> i n - p o s C-b C-b C-b C-b 
> i n g b b <backspace> <backspace> <backspace> <backspace> 
> <backspace> <backspace> n n i n g C-n C-e C-p C-e C-, 
> C-, C-, C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
> C-n C-n C-n C-n C-n C-n C-n C-e C-n C-b C-SPC C-, C-, 
> C-, C-b M-w C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
> C-p C-p C-p C-p C-p C-p C-p C-e C-n C-n C-n C-n C-n 
> C-n C-e <return> <tab> ( s e t q SPC l i n e - b e 
> M-/ SPC C-y C-e C-n C-n C-n C-n C-n C-n C-n C-n C-n 
> C-n C-n C-, C-, C-, <backspace> C-. C-. C-. C-d <backspace> 
> <backspace> <backspace> <backspace> <backspace> C-x 
> C-s C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-e C-p C-p C-e 
> C-n C-x C-e <C-return> C-p C-e C-n <backspace> <backspace> 
> <backspace> <backspace> SPC { <C-return> C-SPC C-p 
> C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
> C-p C-g C-g C-g M-! g i t SPC d i f f <return> <C-return> 
> C-s e l e C-p C-n C-n C-s e l e c t r i c C-a C-SPC 
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
> C-n C-n C-n C-n M-w <C-return> C-x C-b C-x C-b M-x 
> e m a v <backspace> c - <backspace> <backspace> <backspace> 
> <backspace> <backspace> <backspace> r e p o r t - e 
> m <tab> <return>
> 
> Recent messages:
> Mark set
> Saving file /Users/dave/src/emacs-mac-port/lisp/electric.el...
> Wrote /Users/dave/src/emacs-mac-port/lisp/electric.el
> electric-indent-post-self-insert-function
> Mark set
> Quit [3 times]
> Mark saved where search started [2 times]
> Mark set
> delete-backward-char: Text is read-only
> Loading /Users/dave/.emacs.d/el-get/dwamacs/settings/message-settings.el (source)...done
> 
> Load-path shadows:
> /Users/dave/.emacs.d/el-get/php-mode/php-mode hides /Users/dave/.emacs.d/el-get/nxhtml/related/php-mode
> /Users/dave/.emacs.d/el-get/nxhtml/related/csharp-mode hides /Users/dave/.emacs.d/el-get/csharp-mode/csharp-mode
> /Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/loaddefs
> /Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Users/dave/.emacs.d/el-get/cedet/lisp/cedet/loaddefs
> /Users/dave/.emacs.d/el-get/magit/.dir-locals hides /Users/dave/.emacs.d/el-get/el-get/.dir-locals
> /Users/dave/.emacs.d/el-get/cedet/lisp/speedbar/loaddefs hides /Applications/Emacs.app/Contents/Resources/lisp/loaddefs
> /Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ediff-util hides /Applications/Emacs.app/Contents/Resources/lisp/vc/ediff-util
> /Users/dave/.emacs.d/el-get/python/python hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/python
> /Users/dave/.emacs.d/el-get/dwamacs/site-lisp/compile hides /Applications/Emacs.app/Contents/Resources/lisp/progmodes/compile
> /Users/dave/.emacs.d/el-get/nxhtml/util/org-odt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-odt
> /Users/dave/.emacs.d/el-get/magit/.dir-locals hides /Applications/Emacs.app/Contents/Resources/lisp/gnus/.dir-locals
> /Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ert hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/ert
> /Users/dave/.emacs.d/el-get/dwamacs/site-lisp/ert-x hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/ert-x
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-speedbar hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-speedbar
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-opt hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-opt
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-datadebug hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-datadebug
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-custom hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-custom
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-base hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-base
> /Users/dave/.emacs.d/el-get/cedet/lisp/eieio/chart hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/chart
> 
> Features:
> (shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
> mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
> mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils debug pcase
> cedet-edebug edebug mule-util tabify electric cmake-mode thingatpt
> dired-aux gnus-dired sh-script smie executable view dabbrev hl-line
> shell pcomplete misearch multi-isearch magit-svn sticky-windows recentf
> tree-widget jka-compr sb-info info shiny-mode flymake compile comint
> ansi-color auto-complete-clang-async magit-bisect magit-key-mode magit
> diff-mode log-edit ring pcvs-util add-log proof-site proof-autoloads
> pg-vars page-ext ffap url-parse auth-source gnus-util mm-util mail-prsvr
> password-cache url-vars auto-complete-config auto-complete popup
> use-package bind-key session-settings session system-type-darwin-theme
> osx-plist xml .loaddefs workgroups flymake-files flymakemsg
> nxhtml-autostart nxhtml-autoload majmodpri vc-git nxhtml-menu
> web-autoload nxhtml-base helm-config helm-aliases fill-column-indicator
> initsplit cus-edit diminish csharp-mode cc-langs rust-mode modal cc-mode
> cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
> cc-defs cm-mode cedet-devel-load warnings eieio-opt find-func
> srecode/map semantic/edit srecode/srt-mode srecode/template
> srecode/srt-wy semantic/wisent semantic/wisent/wisent srecode/ctxt
> srecode/compile srecode/dictionary srecode/table srecode
> semantic/canned-configs semantic/ia-sb semantic/analyze semantic/sort
> semantic/scope semantic/analyze/fcn semantic/db semantic/ctxt
> semantic/format semantic/tag-ls semantic/find semantic/util-modes
> semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
> cedet-compat inversion ede/speedbar ede/files ede ede/base ede/auto
> ede/source eieio-base eieio-speedbar speedbar sb-image ezimage dframe
> eieio-custom wid-edit cedet eieio byte-opt eieio-core
> cedet-remove-builtin yasnippet advice advice-preload dropdown-list
> derived edmacro kmacro el-get el-get-autoloads el-get-list-packages
> el-get-notify help-mode el-get-dependencies el-get-build el-get-status
> pp el-get-recipes el-get-byte-compile el-get-methods el-get-fossil
> el-get-svn el-get-pacman el-get-github-zip el-get-github-tar
> el-get-http-zip el-get-http-tar el-get-hg el-get-git-svn el-get-fink
> el-get-emacswiki el-get-http el-get-emacsmirror el-get-github el-get-git
> el-get-elpa package cl-macs gv el-get-darcs el-get-cvs el-get-bzr
> el-get-brew el-get-builtin el-get-apt-get el-get-custom el-get-core
> autoload help-fns bytecomp byte-compile cconv cl cl-lib dired-x easymenu
> dired easy-mmode which-func imenu paren server ido autorevert time
> delsel cus-start cus-load elhome time-date tooltip ediff-hook vc-hooks
> lisp-float-type mwheel mac-win tool-bar dnd fontset image regexp-opt
> fringe tabulated-list newcomment lisp-mode register page menu-bar
> rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
> facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
> czech european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
> cus-face macroexp files text-properties overlay sha1 md5 base64 format
> env code-pages mule custom widget hashtable-print-readable backquote mac
> multi-tty make-network-process emacs)
> 
> 

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Tue, 05 Nov 2013 15:45:02 GMT) Full text and rfc822 format available.

Message #22 received at 15767 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 15767 <at> debbugs.gnu.org
Subject: Re: bug#15767: closed (Re: bug#15767: 24.3; [patch]
 electric-indent-mode bug)
Date: Tue, 05 Nov 2013 10:44:59 -0500
> Well, the problem I see is that you left the call to line-beginning-position
> where it was in the original call.  At that point, point may be
> on a different line than it started on, so it’s actually getting information
> about the wrong line.  It’s possible that your patch somehow makes
> everything work out, but leaving the call to line-beginning-position where
> it is seems at best fragile to me.

On the contrary, moving the call like you did was wrong, IMO.  The test
against line-beginning-position is meant to check if pos is on
a previous line, in which case we also need to reindent that previous
line, whereas with your patch it reduces to just check if pos is at
(bolp) which is not as interesting (tho it will often work as well for
the newline case).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15767; Package emacs. (Tue, 05 Nov 2013 15:55:01 GMT) Full text and rfc822 format available.

Message #25 received at 15767 <at> debbugs.gnu.org (full text, mbox):

From: Dave Abrahams <dave <at> boostpro.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: "15767 <at> debbugs.gnu.org" <15767 <at> debbugs.gnu.org>
Subject: Re: bug#15767: closed (Re: bug#15767: 24.3;
 [patch] electric-indent-mode bug)
Date: Tue, 5 Nov 2013 07:54:35 -0800
Ok thanks for making it right then!

Sent from my moss-covered three-handled family gradunza

On Nov 5, 2013, at 7:44 AM, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

>> Well, the problem I see is that you left the call to line-beginning-position
>> where it was in the original call.  At that point, point may be
>> on a different line than it started on, so it’s actually getting information
>> about the wrong line.  It’s possible that your patch somehow makes
>> everything work out, but leaving the call to line-beginning-position where
>> it is seems at best fragile to me.
> 
> On the contrary, moving the call like you did was wrong, IMO.  The test
> against line-beginning-position is meant to check if pos is on
> a previous line, in which case we also need to reindent that previous
> line, whereas with your patch it reduces to just check if pos is at
> (bolp) which is not as interesting (tho it will often work as well for
> the newline case).
> 
> 
>        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 Dec 2013 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.