From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: 24.3; [patch] electric-indent-mode bug Resent-From: Dave Abrahams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2013 23:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 15767@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.138317656811056 (code B ref -1); Wed, 30 Oct 2013 23:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Oct 2013 23:42:48 +0000 Received: from localhost ([127.0.0.1]:53739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfPS-0002sF-Ag for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53164) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfPQ-0002s2-6Q for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbfPE-0003Ci-KM for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbfPE-0003CW-Gg for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbfP8-00048O-3d for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbfP1-00039O-BK for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:26 -0400 Received: from [2620:149:4:1503:e089:acbb:2b8:b499] (port=51680 helo=fripp.apple.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1VbfOr-00036s-50 for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:19 -0400 Received: by da0603a-dhcp217.apple.com (Postfix, from userid 501) id 8984F1AE2EF5; Wed, 30 Oct 2013 16:03:34 -0700 (PDT) From: Dave Abrahams Date: Wed, 30 Oct 2013 16:03:34 -0700 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=electric.el.patch 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 --=-=-= Content-Type: text/plain 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 i n - p o s C-b C-b C-b C-b i n g b b 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 ( 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-, C-. C-. C-. C-d 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-p C-e C-n SPC { 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 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-x C-b C-x C-b M-x e m a v c - r e p o r t - e m 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) --=-=-=-- From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: 24.3; [patch] electric-indent-mode bug Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Oct 2013 17:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dave Abrahams Cc: 15767@debbugs.gnu.org Received: via spool by 15767-submit@debbugs.gnu.org id=B15767.138323919321609 (code B ref 15767); Thu, 31 Oct 2013 17:07:01 +0000 Received: (at 15767) by debbugs.gnu.org; 31 Oct 2013 17:06:33 +0000 Received: from localhost ([127.0.0.1]:55202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbvhY-0005cS-Tf for submit@debbugs.gnu.org; Thu, 31 Oct 2013 13:06:33 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:8146) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbvhW-0005cB-Oo for 15767@debbugs.gnu.org; Thu, 31 Oct 2013 13:06:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFsoXfp/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFsoXfp/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="36777188" Received: from 108-161-119-233.dsl.teksavvy.com (HELO pastel.home) ([108.161.119.233]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 31 Oct 2013 13:06:25 -0400 Received: by pastel.home (Postfix, from userid 20848) id 0D1DC611E1; Thu, 31 Oct 2013 13:06:25 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Thu, 31 Oct 2013 13:06:24 -0400 In-Reply-To: (Dave Abrahams's message of "Wed, 30 Oct 2013 16:03:34 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > 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 From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: 24.3; [patch] electric-indent-mode bug Resent-From: Dave Abrahams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2013 03:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: "15767@debbugs.gnu.org" <15767@debbugs.gnu.org> Received: via spool by 15767-submit@debbugs.gnu.org id=B15767.138327648222218 (code B ref 15767); Fri, 01 Nov 2013 03:28:02 +0000 Received: (at 15767) by debbugs.gnu.org; 1 Nov 2013 03:28:02 +0000 Received: from localhost ([127.0.0.1]:56105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc5Oz-0005mD-HW for submit@debbugs.gnu.org; Thu, 31 Oct 2013 23:28:01 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:33038) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc5Ox-0005ly-91 for 15767@debbugs.gnu.org; Thu, 31 Oct 2013 23:27:59 -0400 Received: by mail-ie0-f181.google.com with SMTP id ar20so6358118iec.26 for <15767@debbugs.gnu.org>; Thu, 31 Oct 2013 20:27:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:in-reply-to:mime-version :content-transfer-encoding:content-type:message-id:cc:from:subject :date:to; bh=HjshqaHrn8R7Vr9NFhoru4q5As1OfgCLiyiTN7p0XkI=; b=XxX24B+M8Fqkdbe/m7FdmGg8sYqqFZczoK+Rgmv7LHtEFxg/XcA3xPbUFQ0PD5r/gg 8c4pjilX6u5JacKbiVmifkGtsrUnZBiE8WTd4V8+0t1ZDd4yqKgFmmIEXZUdZo6S6sPc AfLQHUxrfV993gEU+Wj1p4LD4/QK+UA89HK/NpVSYXwUQTyTsKwNikI9I1J96xjmeOog uKrsA0wq+y+OtWMZdSvizED2o/wldG7zZJRFrQprnYW7+Iul59kVmqwmZ7Fe6v+CFnNz +eS0VcuakiAFqAxT4x2hX0rtQU8a3RBXQle3ctX6p+52eWwIUoI+xukI9MCJk1UGCqjw kJnA== X-Gm-Message-State: ALoCoQlpDt/HrzmbjGjt0aik+WKRkz6lbTw5uTDxpSaLt3ELr97KCwjUNXKXrTYbyNZ/OsTgc2hs X-Received: by 10.42.70.5 with SMTP id d5mr519847icj.39.1383276473649; Thu, 31 Oct 2013 20:27:53 -0700 (PDT) Received: from [192.168.188.128] (107-219-149-247.lightspeed.sntcca.sbcglobal.net. [107.219.149.247]) by mx.google.com with ESMTPSA id p5sm2087924igj.10.2013.10.31.20.27.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Oct 2013 20:27:53 -0700 (PDT) References: In-Reply-To: Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <5F6E093A-E25D-4A4B-82E6-D4AD99616CE7@boostpro.com> X-Mailer: iPad Mail (11B511) From: Dave Abrahams Date: Thu, 31 Oct 2013 20:27:55 -0700 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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 wrot= e: >> 1. emacs -Q >> 2. eval the following: >=20 >> (electric-indent-mode) >> (electric-layout-mode) >> (setq electric-indent-chars (append "{}" electric-indent-chars)) >> (setq electric-layout-rules '((?\{ . after) (?\} . before))) >=20 >> 3. type `f o o {' >=20 >> Result expected: a buffer containing >> ----- schnipp ----- >> foo { >=20 >> ----- schnapp ----- >=20 >> Result received: a buffer containing >> ----- schnipp ----- >> foo{ >=20 >> ----- schnapp ----- >=20 > 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. >=20 >=20 > Stefan From unknown Thu Jun 19 14:05:19 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dave Abrahams Subject: bug#15767: closed (Re: bug#15767: 24.3; [patch] electric-indent-mode bug) Message-ID: References: X-Gnu-PR-Message: they-closed 15767 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 15767@debbugs.gnu.org Date: Mon, 04 Nov 2013 20:05:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1383595503-17917-1" This is a multi-part message in MIME format... ------------=_1383595503-17917-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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@debbugs.gnu.org. --=20 15767: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15767 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1383595503-17917-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15767-done) by debbugs.gnu.org; 4 Nov 2013 20:04:44 +0000 Received: from localhost ([127.0.0.1]:34619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdQOB-0004eO-PG for submit@debbugs.gnu.org; Mon, 04 Nov 2013 15:04:44 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:7157) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdQO9-0004eA-Vj for 15767-done@debbugs.gnu.org; Mon, 04 Nov 2013 15:04:42 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFxLzd/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFxLzd/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="37072884" Received: from 69-196-188-221.dsl.teksavvy.com (HELO pastel.home) ([69.196.188.221]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 Nov 2013 15:04:35 -0500 Received: by pastel.home (Postfix, from userid 20848) id 0BCEA60D75; Mon, 4 Nov 2013 15:04:32 -0500 (EST) From: Stefan Monnier To: Dave Abrahams Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug Message-ID: References: Date: Mon, 04 Nov 2013 15:04:31 -0500 In-Reply-To: (Dave Abrahams's message of "Wed, 30 Oct 2013 16:03:34 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15767-done Cc: 15767-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > (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)))) ------------=_1383595503-17917-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 Oct 2013 23:42:48 +0000 Received: from localhost ([127.0.0.1]:53739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfPS-0002sF-Ag for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53164) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfPQ-0002s2-6Q for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbfPE-0003Ci-KM for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbfPE-0003CW-Gg for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:42:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbfP8-00048O-3d for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbfP1-00039O-BK for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:26 -0400 Received: from [2620:149:4:1503:e089:acbb:2b8:b499] (port=51680 helo=fripp.apple.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1VbfOr-00036s-50 for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2013 19:42:19 -0400 Received: by da0603a-dhcp217.apple.com (Postfix, from userid 501) id 8984F1AE2EF5; Wed, 30 Oct 2013 16:03:34 -0700 (PDT) From: Dave Abrahams To: bug-gnu-emacs@gnu.org Subject: 24.3; [patch] electric-indent-mode bug Date: Wed, 30 Oct 2013 16:03:34 -0700 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=electric.el.patch 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 --=-=-= Content-Type: text/plain 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 i n - p o s C-b C-b C-b C-b i n g b b 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 ( 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-, C-. C-. C-. C-d 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-p C-e C-n SPC { 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 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-x C-b C-x C-b M-x e m a v c - r e p o r t - e m 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) --=-=-=-- ------------=_1383595503-17917-1-- From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: closed (Re: bug#15767: 24.3; [patch] electric-indent-mode bug) Resent-From: Dave Abrahams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Nov 2013 05:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 15767@debbugs.gnu.org Cc: Stefan Monnier Received: via spool by 15767-submit@debbugs.gnu.org id=B15767.138362801217144 (code B ref 15767); Tue, 05 Nov 2013 05:07:02 +0000 Received: (at 15767) by debbugs.gnu.org; 5 Nov 2013 05:06:52 +0000 Received: from localhost ([127.0.0.1]:34921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdYqo-0004SQ-N7 for submit@debbugs.gnu.org; Tue, 05 Nov 2013 00:06:52 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:48090) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdYqk-0004SB-Lm for 15767@debbugs.gnu.org; Tue, 05 Nov 2013 00:06:49 -0500 Received: by mail-ie0-f174.google.com with SMTP id qd12so14097496ieb.5 for <15767@debbugs.gnu.org>; Mon, 04 Nov 2013 21:06:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=DsSbF+RtRseYRJHhEkIH94cWdEXZjhByPMXqQ856rkQ=; b=PehdOcCcLKKT4MG6FeFtJJEtpLD7SjHzzbyj4hJYpZbiuP/zdGSKBqEXMKZJLKGjZj KOdlvZ5g37Jtg0rQAzBTtp3N3kOL4uBEmVfK0/OxNmRaxawqD8M/V47IqdZ7tk5n0zVh 3UJxK9EqYP2k8OwY69DkN1fWADpj1KX3pUwcSz+jS0+/guYPC2r5eUOYepW5xU+hyME4 030hl0eOhHoUHUfrmne75fVjdxqgA9KfsH0Vjsq/hslqhXW034eM615h1N7FUIE4fbhQ E3UyHN2wRfO0FjaScj6iI6NZaoJXk4IJROPxtdomPXomfNk0TQk7fj6Z+L1nIrdwQM0B 4d5A== X-Gm-Message-State: ALoCoQmRe3qm9asldsF16x+b2Gyrfnsq7AHXS7kT2k0dLU2G91MIOXtVBtQQbIwwmxyKSqovORVo X-Received: by 10.50.13.104 with SMTP id g8mr14661517igc.30.1383627999998; Mon, 04 Nov 2013 21:06:39 -0800 (PST) Received: from papi.luannocracy.com (107-219-149-247.lightspeed.sntcca.sbcglobal.net. [107.219.149.247]) by mx.google.com with ESMTPSA id q6sm19949839igi.0.2013.11.04.21.06.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Nov 2013 21:06:35 -0800 (PST) Content-Type: multipart/alternative; boundary="Apple-Mail=_49F9BE8B-38F4-42EC-BAC3-3E0D74739C67" Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) From: Dave Abrahams In-Reply-To: Date: Mon, 4 Nov 2013 21:06:33 -0800 Message-Id: <04CD2009-757D-471D-8338-325882009851@boostpro.com> References: X-Mailer: Apple Mail (2.1822) X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --Apple-Mail=_49F9BE8B-38F4-42EC-BAC3-3E0D74739C67 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Nov 4, 2013, at 12:05 PM, GNU bug Tracking System = wrote: > Your bug report >=20 > #15767: 24.3; [patch] electric-indent-mode bug >=20 > which was filed against the emacs package, has been closed. >=20 > The explanation is attached below, along with your original report. > If you require more details, please reply to 15767@debbugs.gnu.org. >=20 > --=20 > 15767: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15767 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems >=20 > From: Stefan Monnier > Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug > Date: November 4, 2013 at 12:04:31 PM PST > To: Dave Abrahams > Cc: 15767-done@debbugs.gnu.org >=20 >=20 >> (electric-indent-mode) >> (electric-layout-mode) >> (setq electric-indent-chars (append "{}" electric-indent-chars)) >> (setq electric-layout-rules '((?\{ . after) (?\} . before))) >=20 >> 3. type `f o o SPC {' >=20 > 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=92s = actually getting information about the wrong line. It=92s 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. =20 >=20 > Stefan >=20 >=20 > --- 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)))) >=20 >=20 >=20 >=20 > From: Dave Abrahams > Subject: 24.3; [patch] electric-indent-mode bug > Date: October 30, 2013 at 4:03:34 PM PDT > To: bug-gnu-emacs@gnu.org >=20 >=20 >=20 > 1. emacs -Q > 2. eval the following: >=20 > (electric-indent-mode) > (electric-layout-mode) > (setq electric-indent-chars (append "{}" electric-indent-chars)) > (setq electric-layout-rules '((?\{ . after) (?\} . before))) >=20 > 3. type `f o o {' >=20 > Result expected: a buffer containing > ----- schnipp ----- > foo { >=20 > ----- schnapp ----- >=20 > Result received: a buffer containing > ----- schnipp ----- > foo{ >=20 > ----- schnapp ----- >=20 > Patch is enclosed that fixes the problem. >=20 >=20 > 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 >=20 >=20 >=20 > 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=3D/Users/xin/Documents/emacs-mac-port/build' > '--prefix=3D/Users/xin/Documents/emacs-mac-port/build'' >=20 > Important settings: > locale-coding-system: utf-8-unix > default enable-multibyte-characters: t >=20 > Major mode: Emacs-Lisp >=20 > 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 >=20 > 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=20 > n e - b e g g i n - p o s C-b C-b C-b C-b=20 > i n g b b =20 > n n i n g C-n C-e C-p C-e C-,=20 > C-, C-, C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n=20 > C-n C-n C-n C-n C-n C-n C-n C-e C-n C-b C-SPC C-, C-,=20 > 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=20 > 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=20 > C-n C-e ( s e t q SPC l i n e - b e=20 > M-/ SPC C-y C-e C-n C-n C-n C-n C-n C-n C-n C-n C-n=20 > C-n C-n C-, C-, C-, C-. C-. C-. C-d =20 > C-x=20 > 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=20 > 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=20 > C-n C-x C-e C-p C-e C-n =20 > SPC { C-SPC C-p=20 > 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=20 > C-p C-g C-g C-g M-! g i t SPC d i f f =20 > 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=20 > 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=20 > 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=20 > C-n C-n C-n C-n M-w C-x C-b C-x C-b M-x=20 > e m a v c - =20 > r e p o r t - e=20 > m >=20 > 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 >=20 > 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 >=20 > 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) >=20 >=20 --Apple-Mail=_49F9BE8B-38F4-42EC-BAC3-3E0D74739C67 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
On Nov 4, 2013, at 12:05 PM, GNU bug = Tracking System <help-debbugs@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@debbugs.gnu.org.

--=
15767: http://debbu= gs.gnu.org/cgi/bugreport.cgi?bug=3D15767
GNU Bug Tracking = System
Contact help-debbugs@gnu.org with = problems

From: Stefan= Monnier <monnier@iro.umontreal.ca><= br>
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@boostpro.com>


=  (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=92s actually getting information about the = wrong line.  It=92s 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.
=             (g= oto-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))
=             &n= bsp;     (and electric-indent-inhibit
=             &n= bsp;          (> = pos (line-beginning-position))))




From: Dave Abrahams <dave@boostpro.com>
Subject: 24.3; [patch] electric-indent-mode = bug
Date: October 30, 2013 at 4:03:34 PM = PDT



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-ex= cursion
=             &n= bsp;(goto-char pos)
+ =             (s= etq line-beginning-pos (line-beginning-position))
=             &n= bsp;(let ((act (or (run-hook-with-args-until-success
=             &n= bsp;           &nbs= p;    'electric-indent-functions
=             &n= bsp;           &nbs= p;    last-command-event)
@@ -231,7 +232,7 @@ = point right after that char, and it should return t to cause = indentation,
=             &n= bsp;       (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-excursio= n
=             (u= nless (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=3D/Users/xin/Documents/emacs-mac-port/build'
= '--prefix=3D/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-se= lf-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/.emac= s.d/el-get/cedet/lisp/speedbar/loaddefs hides = /Users/dave/.emacs.d/el-get/cedet/lisp/cedet/loaddefs
/Users/dave/.emac= s.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/.e= macs.d/el-get/dwamacs/site-lisp/ediff-util hides = /Applications/Emacs.app/Contents/Resources/lisp/vc/ediff-util
/Users/da= ve/.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
/User= s/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/d= ave/.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<= br>/Users/dave/.emacs.d/el-get/cedet/lisp/eieio/eieio-opt hides = /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-opt
/U= sers/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

Fe= atures:
(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)



= --Apple-Mail=_49F9BE8B-38F4-42EC-BAC3-3E0D74739C67-- From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: closed (Re: bug#15767: 24.3; [patch] electric-indent-mode bug) Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Nov 2013 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dave Abrahams Cc: 15767@debbugs.gnu.org Received: via spool by 15767-submit@debbugs.gnu.org id=B15767.138366630116769 (code B ref 15767); Tue, 05 Nov 2013 15:45:02 +0000 Received: (at 15767) by debbugs.gnu.org; 5 Nov 2013 15:45:01 +0000 Received: from localhost ([127.0.0.1]:35928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdioO-0004MP-JT for submit@debbugs.gnu.org; Tue, 05 Nov 2013 10:45:00 -0500 Received: from relais.videotron.ca ([24.201.245.36]:14220) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdioN-0004MH-9P for 15767@debbugs.gnu.org; Tue, 05 Nov 2013 10:44:59 -0500 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Received: from ceviche.home ([24.201.53.56]) by VL-VM-MR005.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MVS005S3RQY1200@VL-VM-MR005.ip.videotron.ca> for 15767@debbugs.gnu.org; Tue, 05 Nov 2013 10:44:58 -0500 (EST) Received: by ceviche.home (Postfix, from userid 20848) id 9C7C76609C; Tue, 05 Nov 2013 10:44:59 -0500 (EST) From: Stefan Monnier Message-id: References: <04CD2009-757D-471D-8338-325882009851@boostpro.com> Date: Tue, 05 Nov 2013 10:44:59 -0500 In-reply-to: <04CD2009-757D-471D-8338-325882009851@boostpro.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Content-transfer-encoding: quoted-printable X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Well, the problem I see is that you left the call to line-beginning-posit= ion > where it was in the original call. At that point, point may be > on a different line than it started on, so it=E2=80=99s actually getting = information > about the wrong line. It=E2=80=99s 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 From unknown Thu Jun 19 14:05:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15767: closed (Re: bug#15767: 24.3; [patch] electric-indent-mode bug) Resent-From: Dave Abrahams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Nov 2013 15:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15767 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: "15767@debbugs.gnu.org" <15767@debbugs.gnu.org> Received: via spool by 15767-submit@debbugs.gnu.org id=B15767.138366689017661 (code B ref 15767); Tue, 05 Nov 2013 15:55:01 +0000 Received: (at 15767) by debbugs.gnu.org; 5 Nov 2013 15:54:50 +0000 Received: from localhost ([127.0.0.1]:35936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vdixs-0004ak-Nc for submit@debbugs.gnu.org; Tue, 05 Nov 2013 10:54:49 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36015) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vdixp-0004aU-U6 for 15767@debbugs.gnu.org; Tue, 05 Nov 2013 10:54:46 -0500 Received: by mail-pd0-f174.google.com with SMTP id z10so8618002pdj.5 for <15767@debbugs.gnu.org>; Tue, 05 Nov 2013 07:54:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=DlO4luWZOpV5kAsAARM07ix84Dlk+oGqpMdWgYZ+Ksc=; b=nKrSOWcKrPbY4ptY8aJApgj91mqEBu2uQ0oEEfGPFgJOuiEWU4Ndqc78EMPLAUHGQS HpTcEX36JdP2oQNLSYbYe0GiEBsXYNqNvtgw7aYZ+5i3VgTufuzMT0LFAJbOFM91dduz UIpqPDfyzBHZ7Wqc1N7L8BhPrsYbAkNrBKpcnDHBwdfZb1Eyd+othtmIHQOzffa4Y1+e Tg9dKtJtDv939/aJ7O1EOvSqNtnsm7jMI8KolAKbEogq49bhbnM/0GtAqkNC2Hek/HJ4 I4P+2dBh6nmD3KyJGQ8cC1mlAy/zzG6rpHRYoN6x1tg/OPXjwV95w8Vim1uTQhVWkqGd N2MQ== X-Gm-Message-State: ALoCoQkgX621BSB5ZAhRh7jKWfPu7u/Lod1LXrW3TQ0UIbam0jc/dRT+wJCdT6N7htoqYQ1ItOVp X-Received: by 10.68.244.2 with SMTP id xc2mr23625830pbc.58.1383666879378; Tue, 05 Nov 2013 07:54:39 -0800 (PST) Received: from [10.55.104.97] (mobile-166-137-187-098.mycingular.net. [166.137.187.98]) by mx.google.com with ESMTPSA id ka3sm35371137pbc.32.2013.11.05.07.54.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Nov 2013 07:54:37 -0800 (PST) References: <04CD2009-757D-471D-8338-325882009851@boostpro.com> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: <2C2AC8FE-5322-4A31-BD6B-404472991EF0@boostpro.com> X-Mailer: iPhone Mail (11B511) From: Dave Abrahams Date: Tue, 5 Nov 2013 07:54:35 -0800 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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 wrote:= >> Well, the problem I see is that you left the call to line-beginning-posit= ion >> where it was in the original call. At that point, point may be >> on a different line than it started on, so it=E2=80=99s actually getting i= nformation >> about the wrong line. It=E2=80=99s possible that your patch somehow make= s >> everything work out, but leaving the call to line-beginning-position wher= e >> it is seems at best fragile to me. >=20 > 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). >=20 >=20 > Stefan