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

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

bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed


From: Andreas Röhler
Subject: bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed
Date: Thu, 15 Sep 2016 08:26:30 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0



On 14.09.2016 16:04, Noam Postavsky wrote:
tag 24434 moreinfo
quit

On Wed, Sep 14, 2016 at 5:46 AM, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
python-mode, problem seems not restricted to.

When after curly bracket in example below from
https://docs.python.org/3/library/string.html#formatstrings
6.1.3. Format String Syntax:

str.format("Bring me a {

depth-in-paren. i.e.

(nth 0 (parse-partial-sexp ...))
This bug report is a bit incomplete, what do you put for "..."?

(point-min) (point)


should indicate "2", but says "1".

When outside a string, `{' is recognized as opener.
I think this is correct, parse-partial-sexp detects whether it's in a
string-literal or not. If you want to parse the contents of the string
literal, FROM should be inside the literal.

Thanks. This works for me:

(defun in-string-interpolation-maybe ()
  (let ((pps (parse-partial-sexp (point-min) (point))))
(and (nth 3 pps) (nth 3 (parse-partial-sexp (1+ (nth 8 pps)) (point))))))







reply via email to

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