bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31772: 26.1; (thing-at-point 'list) regression


From: Leo Liu
Subject: bug#31772: 26.1; (thing-at-point 'list) regression
Date: Tue, 11 Sep 2018 18:26:36 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (macOS 10.12.6)

On 2018-09-11 11:31 +0300, Eli Zaretskii wrote:
[snipped 13 lines]
> Thanks.  Can you summarize how the behavior with your patch will be
> different from what we had in Emacs 25 and before?

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.

[snipped 6 lines]
> 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:

(defun list-at-point (&optional ignore-comment-or-string)
  "Return the Lisp list at 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))))

>
> Thanks.

Thanks. -Leo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]