Subject: bug#13973: Subject: 24.3; thingatpt.el, end-of-sexp

From: Andreas Röhler <[email-masked]>
Date: Fri, 27 Aug 2021 20:44:33 +0200

On 26.08.21 16:05, Lars Ingebrigtsen wrote:
> Andreas Röhler <[email-masked]> 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?
>