GNU bug report logs -
#13973
thingatpt.el and end-of-sexp in python-mode
Previous Next
Full log
View this message in rfc822 format
On 26.08.21 16:05, Lars Ingebrigtsen wrote:
> Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>
>>>> Maybe put the Python code below at the top of some buffer and run the
>>>> test delivered below:
>>>>
>>>> # Python
>>>>
>>>> def main():
>>>> """Some hint"""
>>>> if len(sys.argv) == 1:
>>>> usage()
>>>>
>>>> ;; Elisp
>>>> (defun forward-sexp-text ()
>>>> (interactive)
>>>> (goto-char 30 )
>>>> (forward-sexp))
>>> By that goto-char, do you mean the "S" character?
>> No, sorry, the 5th double-quote of the triple-quoted-string.
> That gives me
>
> forward-sexp: Scan error: "Unbalanced parentheses", 40, 86
>
> which I think is the right thing?
If inside a string, forward-sexp --or end-of-- should reach the end of
this string.
BTW end-of-sexp is declared obsolete meanwhile. Below an adapted test.
(defun my-thing-at-point--end-of-sexp-test ()
(interactive)
(goto-char (point-max))
(search-backward "\"" nil t 6)
;; the only one ending correctly behind the string
(thing-at-point--end-of-sexp)
(goto-char (point-max))
(search-backward "\"" nil t 6)
(forward-char 4)
(thing-at-point--end-of-sexp)
(goto-char (point-max))
(search-backward "\"" nil t 3)
(thing-at-point--end-of-sexp)
(goto-char (point-max))
(search-backward "\"" nil t 2)
(thing-at-point--end-of-sexp))
and here the Python code to test again:
def main():
"""Some hint"""
if len(sys.argv) == 1:
usage()
>
> This bug report started with thingatpt. What is the real thingatpt use
> case that doesn't work in triple-quoted strings?
>
This bug report was last modified 3 years and 40 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.