GNU bug report logs - #26187
Bug in indent-sexp

Previous Next

Package: emacs;

Reported by: Gdobbins <gdobbins <at> protonmail.com>

Date: Mon, 20 Mar 2017 06:07:02 UTC

Severity: normal

Tags: fixed, patch

Done: npostavs <at> users.sourceforge.net

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 26187 in the body.
You can then email your comments to 26187 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#26187; Package emacs. (Mon, 20 Mar 2017 06:07:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gdobbins <gdobbins <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 20 Mar 2017 06:07:03 GMT) Full text and rfc822 format available.

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

From: Gdobbins <gdobbins <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Bug in indent-sexp
Date: Sun, 19 Mar 2017 21:18:09 -0400
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
[0001-lisp-emacs-lisp-lisp-mode.el-indent-sexp-Fix-null-en.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26187; Package emacs. (Mon, 20 Mar 2017 13:20:02 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Gdobbins <gdobbins <at> protonmail.com>
Cc: 26187 <at> debbugs.gnu.org
Subject: Re: bug#26187: Bug in indent-sexp
Date: Mon, 20 Mar 2017 09:20:25 -0400
Gdobbins <gdobbins <at> protonmail.com> writes:

> 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.

Could you post the scenario which is broken?  I have a another pending
change to indent-sexp for Bug#25122 [1] which actually removes the
rescanning completely, but I'm not sure if that would rebreak this
scenario or fix it...

[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?att=1;bug=25122;msg=74;filename=v2-0001-Don-t-reparse-the-sexp-in-indent-sexp-Bug-25122.patch




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26187; Package emacs. (Mon, 20 Mar 2017 20:01:02 GMT) Full text and rfc822 format available.

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

From: Gdobbins <gdobbins <at> protonmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 26187 <at> debbugs.gnu.org
Subject: Re: bug#26187: Bug in indent-sexp
Date: Mon, 20 Mar 2017 16:00:49 -0400
[Message part 1 (text/plain, inline)]
Sure. In the form:

(defun lisp-indent-defform (state _indent-point)
(goto-char (car (cdr state)))
(forward-line 1)
(if (> (point) (car (cdr (cdr state))))|
(progn
(goto-char (car (cdr state)))

(+ lisp-body-indent (current-column)))))

where | is point, call indent-sexp and the result will be

(defun lisp-indent-defform (state _indent-point)
(goto-char (car (cdr state)))
(forward-line 1)
(if (> (point) (car (cdr (cdr state))))|
(progn
(goto-char (car (cdr state)))

(+ lisp-body-indent (current-column)))))

which is incorrect.

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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26187; Package emacs. (Tue, 21 Mar 2017 03:21:01 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Gdobbins <gdobbins <at> protonmail.com>
Cc: 26187 <at> debbugs.gnu.org
Subject: Re: bug#26187: Bug in indent-sexp
Date: Mon, 20 Mar 2017 23:22:00 -0400
tags 26187 patch
quit

Gdobbins <gdobbins <at> protonmail.com> writes:

> Sure. In the form:
> 
> (defun lisp-indent-defform (state _indent-point)
>   (goto-char (car (cdr state)))
>   (forward-line 1)
>   (if (> (point) (car (cdr (cdr state))))|
>       (progn
>         (goto-char (car (cdr state)))
>         (+ lisp-body-indent (current-column)))))
> 
> where | is point, call indent-sexp and the result will be
> 
> (defun lisp-indent-defform (state _indent-point)
>   (goto-char (car (cdr state)))
>   (forward-line 1)
>   (if (> (point) (car (cdr (cdr state))))|
> (progn
>   (goto-char (car (cdr state)))
>   (+ lisp-body-indent (current-column)))))
> 
> which is incorrect.

Hmm, the original behaviour is that no indentation happens at all which
seems kind of odd to me.  But that's better than breaking things I
guess.  Have you done copyright assignment for Emacs, or should I mark
your patch as a tiny change?




Added tag(s) patch. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Tue, 21 Mar 2017 03:21:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26187; Package emacs. (Tue, 21 Mar 2017 04:25:02 GMT) Full text and rfc822 format available.

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

From: Gdobbins <gdobbins <at> protonmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 26187 <at> debbugs.gnu.org
Subject: Re: bug#26187: Bug in indent-sexp
Date: Tue, 21 Mar 2017 00:24:23 -0400
[Message part 1 (text/plain, inline)]
I have not yet done a copyright assignment.

-- Graham Dobbins

-------- Original Message --------
Subject: Re: bug#26187: Bug in indent-sexp
Local Time: March 20, 2017 11:20 PM
UTC Time: March 21, 2017 3:20 AM
From: npostavs <at> users.sourceforge.net
To: Gdobbins <gdobbins <at> protonmail.com>
26187 <at> debbugs.gnu.org

tags 26187 patch
quit

Gdobbins <gdobbins <at> protonmail.com> writes:

> Sure. In the form:
>
> (defun lisp-indent-defform (state _indent-point)
> (goto-char (car (cdr state)))
> (forward-line 1)
> (if (> (point) (car (cdr (cdr state))))|
> (progn
> (goto-char (car (cdr state)))
> (+ lisp-body-indent (current-column)))))
>
> where | is point, call indent-sexp and the result will be
>
> (defun lisp-indent-defform (state _indent-point)
> (goto-char (car (cdr state)))
> (forward-line 1)
> (if (> (point) (car (cdr (cdr state))))|
> (progn
> (goto-char (car (cdr state)))
> (+ lisp-body-indent (current-column)))))
>
> which is incorrect.

Hmm, the original behaviour is that no indentation happens at all which
seems kind of odd to me. But that's better than breaking things I
guess. Have you done copyright assignment for Emacs, or should I mark
your patch as a tiny change?
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26187; Package emacs. (Wed, 22 Mar 2017 00:49:02 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Gdobbins <gdobbins <at> protonmail.com>
Cc: 26187 <at> debbugs.gnu.org
Subject: Re: bug#26187: Bug in indent-sexp
Date: Tue, 21 Mar 2017 20:49:42 -0400
tags 26187 fixed
close 26187 
quit

Gdobbins <gdobbins <at> protonmail.com> writes:

> 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.
>

Pushed to master [1: bcb6c7b7cd], added test in [2: 0b60d7657a].

1: 2017-03-21 20:45:31 -0400 bcb6c7b7cd954fc653fe54c20aa4a5d8dd97d76d
  * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Fix null endpos case

2: 2017-03-21 20:45:32 -0400 0b60d7657a2d9e5f9a233032643b0f3ce55420ee
  * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-subsexp): Test for Bug#26187




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 22 Mar 2017 00:49:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 26187 <at> debbugs.gnu.org and Gdobbins <gdobbins <at> protonmail.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 22 Mar 2017 00:49:04 GMT) Full text and rfc822 format available.

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

This bug report was last modified 8 years and 156 days ago.

Previous Next


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