GNU bug report logs - #31772
26.1; (thing-at-point 'list) regression

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Sun, 10 Jun 2018 03:59:01 UTC

Severity: normal

Found in version 26.1

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#31772: 26.1; (thing-at-point 'list) regression
Date: Tue, 11 Sep 2018 13:52:42 +0200
On 11.09.2018 13:16, Eli Zaretskii wrote:
>> From:  Leo Liu <sdl.web <at> gmail.com>
>> Cc: 31772 <at> debbugs.gnu.org,  tino.calancha <at> gmail.com
>> Date: Tue, 11 Sep 2018 18:26:36 +0800
>>
>> The difference is on what to return when (up-list -1) fails. They both
>> try to return the sexp at point but the patched behaviour try returning
>> the whole sexp while the one in <= 25.1 cut off the sexp from point.
>>
>> Looking at the code in 25.1 it looks to me the original author had a
>> thinko i.e. he/she meant to write:
>>
>> (if (>= opoint (point))
>>      (cons (point) end))
>>
>> but instead write
>>
>> (if (>= opoint (point))
>>      (cons opoint end))
>>
>> which resulted in some weird cases that you mentioned in previous email.
> 
> Right.
> 
>>> Would it be possible to modify list-at-point so that it keeps the
>>> current behavior, perhaps as an option?  I'd like to find a solution
>>> that doesn't just revert to the old behavior, but allows those who
>>> need the new behavior to have it in some reasonable way.
>>
>> Yes, this can be done. For example:
>>optional ignore-comment-or-string)
>>    "Return the Lisp list at
>> (defun list-at-point (& point, or nil if none is found.
>> If IGNORE-COMMENT-OR-STRING is non-nil comments and strings are
>> treated as white space."
>>    (let ((ppss (and ignore-comment-or-string (syntax-ppss))))
>>      (save-excursion
>>        (goto-char (or (nth 8 ppss) (point)))
>>        (form-at-point 'list 'listp))))
> 
> Would you mind submitting a patch that includes the above, and also
> fixes/augments the tests accordingly?  I think these changes then
> could go into the emacs-26 branch, unless someone raises objections.
> 
> Thanks.
> 
> 
> 



The basic decision to make is to put some section as comment or not.

If code is commented out, it looses its lisp-syntax. It's plain text.
Therefor no lisp-list can exist and no need for a var 
ignore-comment-or-string.




This bug report was last modified 6 years and 252 days ago.

Previous Next


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