* bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed
@ 2016-09-14 9:46 Andreas Röhler
2016-09-14 14:04 ` Noam Postavsky
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2016-09-14 9:46 UTC (permalink / raw)
To: 24434
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 ...))
should indicate "2", but says "1".
When outside a string, `{' is recognized as opener.
GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.14.5) of 2016-08-22
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed
2016-09-14 9:46 bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed Andreas Röhler
@ 2016-09-14 14:04 ` Noam Postavsky
2016-09-15 6:26 ` Andreas Röhler
0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2016-09-14 14:04 UTC (permalink / raw)
To: Andreas Röhler; +Cc: 24434
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 "..."?
>
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed
2016-09-14 14:04 ` Noam Postavsky
@ 2016-09-15 6:26 ` Andreas Röhler
2016-09-15 12:50 ` npostavs
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2016-09-15 6:26 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 24434
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))))))
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed
2016-09-15 6:26 ` Andreas Röhler
@ 2016-09-15 12:50 ` npostavs
0 siblings, 0 replies; 4+ messages in thread
From: npostavs @ 2016-09-15 12:50 UTC (permalink / raw)
To: Andreas Röhler; +Cc: 24434
tags 24434 = notabug
close 24434
quit
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>>>
>>> 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))))))
Okay, looks like everything is functioning as expected, closing.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-15 12:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-14 9:46 bug#24434: [25.1.1] parse-partial-sexp: opening delimiter missed Andreas Röhler
2016-09-14 14:04 ` Noam Postavsky
2016-09-15 6:26 ` Andreas Röhler
2016-09-15 12:50 ` npostavs
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).