* parse-partial-sexp confused by temp?
@ 2015-04-29 8:05 Andreas Röhler
2015-04-29 13:38 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2015-04-29 8:05 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
Hi,
at stake is a command which closes forms at point in a general way:
may it be a string, list, loop - whatever.
https://github.com/emacs-berlin/general-close.git
While it works with python-mode meanwhile, the related test fails in a
strangely - see attachement.
Note: the wrong result of parse-partial-sexp does not happen when called
normally - only inside this temp-buffer.
Any ideas?
Thanks,
Andreas
[-- Attachment #2: pps.png --]
[-- Type: image/png, Size: 125907 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: parse-partial-sexp confused by temp?
2015-04-29 8:05 parse-partial-sexp confused by temp? Andreas Röhler
@ 2015-04-29 13:38 ` Stefan Monnier
2015-04-29 15:39 ` Andreas Röhler
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-04-29 13:38 UTC (permalink / raw)
To: help-gnu-emacs
> Any ideas?
First things first: replace (parse-partial-sexp (point-min) (point))
with (syntax-ppss) which will do the same but more efficiently (caches
the intermediate results and shares this cache with other users such as
font-lock), and will know to run `syntax-propertize' if the major mode
said so.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: parse-partial-sexp confused by temp?
2015-04-29 13:38 ` Stefan Monnier
@ 2015-04-29 15:39 ` Andreas Röhler
2015-04-29 22:25 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2015-04-29 15:39 UTC (permalink / raw)
To: help-gnu-emacs
Am 29.04.2015 um 15:38 schrieb Stefan Monnier:
>> Any ideas?
> First things first: replace (parse-partial-sexp (point-min) (point))
> with (syntax-ppss) which will do the same but more efficiently (caches
> the intermediate results and shares this cache with other users such as
> font-lock), and will know to run `syntax-propertize' if the major mode
> said so.
>
>
> Stefan
>
>
Thanks responding.
However, this would not explain the wrong result saying inside a string.
Came across an error in other context, where it turned out
syntax-ppss
did read only from beginning of line, which was wrong.
So abondoned it, using
(parse-partial-sexp since.
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: parse-partial-sexp confused by temp?
2015-04-29 15:39 ` Andreas Röhler
@ 2015-04-29 22:25 ` Stefan Monnier
2015-04-30 7:57 ` Andreas Röhler
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-04-29 22:25 UTC (permalink / raw)
To: help-gnu-emacs
> However, this would not explain the wrong result saying inside a string.
The syntax-propertize part could.
> Came across an error in other context, where it turned out syntax-ppss
> did read only from beginning of line,
Hard to believe. Have you reported it as a bug?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: parse-partial-sexp confused by temp?
2015-04-29 22:25 ` Stefan Monnier
@ 2015-04-30 7:57 ` Andreas Röhler
2015-04-30 12:19 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2015-04-30 7:57 UTC (permalink / raw)
To: help-gnu-emacs
Am 30.04.2015 um 00:25 schrieb Stefan Monnier:
>> However, this would not explain the wrong result saying inside a string.
> The syntax-propertize part could.
>
>> Came across an error in other context, where it turned out syntax-ppss
>> did read only from beginning of line,
> Hard to believe. Have you reported it as a bug?
>
>
Not yet. Will investigate it next time.
Will have a closer look at this (syntax.el):
(if (and old-pos (> old-pos pos)) (setq old-pos nil))
;; Use the OLD-POS if usable and close. Don't update the `last' cache.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: parse-partial-sexp confused by temp?
2015-04-30 7:57 ` Andreas Röhler
@ 2015-04-30 12:19 ` Stefan Monnier
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-04-30 12:19 UTC (permalink / raw)
To: help-gnu-emacs
>>> Came across an error in other context, where it turned out syntax-ppss
>>> did read only from beginning of line,
> Not yet. Will investigate it next time.
syntax-ppss is what font-lock uses, so if font-lock gets it right,
syntax-ppss should also get it right (and quickly since the act of
font-locking should have filled the cache already).
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-30 12:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-29 8:05 parse-partial-sexp confused by temp? Andreas Röhler
2015-04-29 13:38 ` Stefan Monnier
2015-04-29 15:39 ` Andreas Röhler
2015-04-29 22:25 ` Stefan Monnier
2015-04-30 7:57 ` Andreas Röhler
2015-04-30 12:19 ` Stefan Monnier
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).