unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gdobbins <gdobbins@protonmail.com>
To: 26187@debbugs.gnu.org
Subject: bug#26187: Bug in indent-sexp
Date: Sun, 19 Mar 2017 21:18:09 -0400	[thread overview]
Message-ID: <edMndW2R6yeReqnOzTcnnOjIXQP11nlOH5iS8FbaHpSHzsqYGXO9JRYjF6ZbSKEnNY0hg-xORHOReNQpi1pd6PrwwAYSLzeNY-bls1FHEcU=@protonmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 318 bytes --]

The refactor of indent-sexp in commit 3ee3995d105ff02f0fac540757431d36cb45c6c7 broke the assumption

;; If ENDPOS is nil, it is safe not to scan before point
;; since every line we indent is more deeply nested than point is.

thereby breaking functionality in paredit. The attached patch fixes this.

-- Graham Dobbins

[-- Attachment #1.2: Type: text/html, Size: 719 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-lisp-mode.el-indent-sexp-Fix-null-en.patch --]
[-- Type: text/x-patch; name="0001-lisp-emacs-lisp-lisp-mode.el-indent-sexp-Fix-null-en.patch", Size: 1284 bytes --]

From aac47fbcdc6175ead9caf9f903f24100a2805ccc Mon Sep 17 00:00:00 2001
From: Graham Dobbins <gdobbins@protonmail.com>
Date: Sun, 19 Mar 2017 21:06:18 -0400
Subject: [PATCH] * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Fix null endpos
 case

---
 lisp/emacs-lisp/lisp-mode.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index eb07c18b03..d6293c0304 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1083,7 +1083,8 @@ indent-sexp
          (init-depth (car state))
          (next-depth init-depth)
          (last-depth init-depth)
-         (last-syntax-point (point)))
+         (last-syntax-point (point))
+         (real-endpos endpos))
     (unless endpos
       ;; Get error now if we don't have a complete sexp after point.
       (save-excursion (forward-sexp 1)
@@ -1116,6 +1117,8 @@ indent-sexp
                 last-depth (- last-depth next-depth)
                 next-depth init-depth))
         (forward-line 1)
+        (when (and (not real-endpos) (<= next-depth init-depth))
+          (goto-char endpos))
         (when (< (point) endpos)
           (let ((depth-delta (- next-depth last-depth)))
             (cond ((< depth-delta 0)
-- 
2.12.0


             reply	other threads:[~2017-03-20  1:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  1:18 Gdobbins [this message]
2017-03-20 13:20 ` bug#26187: Bug in indent-sexp npostavs
2017-03-20 20:00   ` Gdobbins
2017-03-21  3:22     ` npostavs
2017-03-21  4:24       ` Gdobbins
2017-03-22  0:49 ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='edMndW2R6yeReqnOzTcnnOjIXQP11nlOH5iS8FbaHpSHzsqYGXO9JRYjF6ZbSKEnNY0hg-xORHOReNQpi1pd6PrwwAYSLzeNY-bls1FHEcU=@protonmail.com' \
    --to=gdobbins@protonmail.com \
    --cc=26187@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).