* integration with Python mode
@ 2007-01-06 21:23 Paul Pogonyshev
2007-01-07 15:49 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Paul Pogonyshev @ 2007-01-06 21:23 UTC (permalink / raw)
Hi,
I'd like to build support of Python mode into my Typesetter minor
mode [1]. In particular, I don't want it to insert special characters
outside of Python strings (and maybe comments.) How do I determine if
the point is inside a string in Python mode? Is there a better way
than checking 'face property?
Paul
[1] https://gna.org/projects/typesetter-el/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-06 21:23 integration with Python mode Paul Pogonyshev
@ 2007-01-07 15:49 ` Stefan Monnier
2007-01-07 17:08 ` Paul Pogonyshev
2007-01-07 17:22 ` Paul Pogonyshev
0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-01-07 15:49 UTC (permalink / raw)
Cc: emacs-devel
> I'd like to build support of Python mode into my Typesetter minor
> mode [1]. In particular, I don't want it to insert special characters
> outside of Python strings (and maybe comments.) How do I determine if
> the point is inside a string in Python mode?
How do you do it in other major modes? I don't think python-mode is special
in this respect.
> Is there a better way than checking 'face property?
How 'bout (nth 3 (syntax-ppss <pos>)) ?
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 15:49 ` Stefan Monnier
@ 2007-01-07 17:08 ` Paul Pogonyshev
2007-01-07 19:11 ` Stefan Monnier
2007-01-07 17:22 ` Paul Pogonyshev
1 sibling, 1 reply; 9+ messages in thread
From: Paul Pogonyshev @ 2007-01-07 17:08 UTC (permalink / raw)
Cc: Stefan Monnier
Stefan Monnier wrote:
> > I'd like to build support of Python mode into my Typesetter minor
> > mode [1]. In particular, I don't want it to insert special characters
> > outside of Python strings (and maybe comments.) How do I determine if
> > the point is inside a string in Python mode?
>
> How do you do it in other major modes? I don't think python-mode is special
> in this respect.
Well, I heavily depend on major mode. Typesetter mode converts normal
characters like " and - to typographically valid punctuation characters,
like “”, ‘’ or — etc. Of course, such characters must not be inserted
in contexts that don't expect them, e.g. outside strings in programming
modes.
> > Is there a better way than checking 'face property?
>
> How 'bout (nth 3 (syntax-ppss <pos>)) ?
Thanks. Documentation says it parses Lisp syntax, however. Will it
give proper results in Python buffers?
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 15:49 ` Stefan Monnier
2007-01-07 17:08 ` Paul Pogonyshev
@ 2007-01-07 17:22 ` Paul Pogonyshev
2007-01-07 19:13 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Paul Pogonyshev @ 2007-01-07 17:22 UTC (permalink / raw)
Cc: Stefan Monnier
Stefan Monnier wrote:
> How 'bout (nth 3 (syntax-ppss <pos>)) ?
BTW, there is `syntax-ppss-context', which seems to be more high-level.
However, it is not documented. Can I still use it or should it be
considered private?
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 17:08 ` Paul Pogonyshev
@ 2007-01-07 19:11 ` Stefan Monnier
2007-01-07 19:58 ` Paul Pogonyshev
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-01-07 19:11 UTC (permalink / raw)
Cc: emacs-devel
>> > I'd like to build support of Python mode into my Typesetter minor
>> > mode [1]. In particular, I don't want it to insert special characters
>> > outside of Python strings (and maybe comments.) How do I determine if
>> > the point is inside a string in Python mode?
>>
>> How do you do it in other major modes? I don't think python-mode is special
>> in this respect.
> Well, I heavily depend on major mode.
That doesn't tell me "how you do it" in other major modes.
E.g. how do you do it in C mode?
>> > Is there a better way than checking 'face property?
>> How 'bout (nth 3 (syntax-ppss <pos>)) ?
> Thanks. Documentation says it parses Lisp syntax, however.
Report it as a documentation bug.
> Will it give proper results in Python buffers?
It's used by font-lock. Try it,
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 17:22 ` Paul Pogonyshev
@ 2007-01-07 19:13 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-01-07 19:13 UTC (permalink / raw)
Cc: emacs-devel
>> How 'bout (nth 3 (syntax-ppss <pos>)) ?
> BTW, there is `syntax-ppss-context', which seems to be more high-level.
> However, it is not documented. Can I still use it or should it be
> considered private?
I don't recommend its use,
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 19:11 ` Stefan Monnier
@ 2007-01-07 19:58 ` Paul Pogonyshev
2007-01-07 22:18 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Paul Pogonyshev @ 2007-01-07 19:58 UTC (permalink / raw)
Cc: Stefan Monnier
Stefan Monnier wrote:
> >> > I'd like to build support of Python mode into my Typesetter minor
> >> > mode [1]. In particular, I don't want it to insert special characters
> >> > outside of Python strings (and maybe comments.) How do I determine if
> >> > the point is inside a string in Python mode?
> >>
> >> How do you do it in other major modes? I don't think python-mode is special
> >> in this respect.
>
> > Well, I heavily depend on major mode.
>
> That doesn't tell me "how you do it" in other major modes.
> E.g. how do you do it in C mode?
I use `c-in-literal' and `c-literal-limits'. If `syntax-ppss'
works with all modes (i.e. more generic), I should use that one
instead, of course.
> >> > Is there a better way than checking 'face property?
> >> How 'bout (nth 3 (syntax-ppss <pos>)) ?
> > Thanks. Documentation says it parses Lisp syntax, however.
>
> Report it as a documentation bug.
Uh, can it be just fixed, without additional bureacracy? AFAIK
there isn't even a bug tracker for Emacs, though I may be wrong
here.
> > Will it give proper results in Python buffers?
>
> It's used by font-lock. Try it,
OK, I already did.
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 19:58 ` Paul Pogonyshev
@ 2007-01-07 22:18 ` Stefan Monnier
2007-01-07 22:35 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-01-07 22:18 UTC (permalink / raw)
Cc: emacs-devel
>> >> > I'd like to build support of Python mode into my Typesetter minor
>> >> > mode [1]. In particular, I don't want it to insert special characters
>> >> > outside of Python strings (and maybe comments.) How do I determine if
>> >> > the point is inside a string in Python mode?
>> >> How do you do it in other major modes? I don't think python-mode is special
>> >> in this respect.
>> > Well, I heavily depend on major mode.
>> That doesn't tell me "how you do it" in other major modes.
>> E.g. how do you do it in C mode?
> I use `c-in-literal' and `c-literal-limits'. If `syntax-ppss'
> works with all modes (i.e. more generic), I should use that one
> instead, of course.
syntax-ppss should work with more or less all modes, but it may not be
100% in all modes, depending on how faithfully syntax-tables can express the
language's lexical rules.
>> >> > Is there a better way than checking 'face property?
>> >> How 'bout (nth 3 (syntax-ppss <pos>)) ?
>> > Thanks. Documentation says it parses Lisp syntax, however.
>> Report it as a documentation bug.
> Uh, can it be just fixed, without additional bureacracy?
Yes, except I'm not sure how to fix it, so it's better to bring it to the
attention of other people.
> AFAIK there isn't even a bug tracker for Emacs, though I may be
> wrong here.
M-x report-emacs-bug will send an email to the proper place. Much quicker
to use than a bug-tracker.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: integration with Python mode
2007-01-07 22:18 ` Stefan Monnier
@ 2007-01-07 22:35 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-07 22:35 UTC (permalink / raw)
Cc: emacs-devel, Paul Pogonyshev
Stefan Monnier wrote:
> syntax-ppss should work with more or less all modes, but it may not be
> 100% in all modes, depending on how faithfully syntax-tables can express the
> language's lexical rules.
Except modes like nxml-mode which does their own parsing IIUC.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-01-07 22:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-06 21:23 integration with Python mode Paul Pogonyshev
2007-01-07 15:49 ` Stefan Monnier
2007-01-07 17:08 ` Paul Pogonyshev
2007-01-07 19:11 ` Stefan Monnier
2007-01-07 19:58 ` Paul Pogonyshev
2007-01-07 22:18 ` Stefan Monnier
2007-01-07 22:35 ` Lennart Borgman (gmail)
2007-01-07 17:22 ` Paul Pogonyshev
2007-01-07 19:13 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.