unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Clarification needed: syntax-propertize vs font-lock-syntax-table
@ 2015-11-18 18:06 Wedler, Christoph
  2015-11-18 18:37 ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Wedler, Christoph @ 2015-11-18 18:06 UTC (permalink / raw)
  To: emacs-devel@gnu.org

The function `syntax-propertize' sets the syntax-table properties which
shadow the definition from the current syntax-table.  This function
calls the function in syntax-propertize-function whose docstring
explicitly allows to call `syntax-ppss'.

For this to work consistently, it is necessary that `syntax-propertize'
is called with the same (or very similar) syntax-table, at least for the
same buffer areas.  (Yes, I see the Todo at the beginning of syntax.el)
Or do I miss something?

The most prominent call of `syntax-propertize' is inside font-lock,
where the `font-lock-syntax-table' is active.  But there are also many
valid calls of this function (most via `syntax-ppss') where the standard
(syntax-table) is active.  (And there are missing calls - hello imenu.el)

What does this mean?  To be consistent, ...

 * Solution 1: the font-lock syntax table must not differ too much from
   the normal syntax table, i.e., the function in
   syntax-propertize-function should behave the same.  If so, it should
   be probably documented.

 * Solution 2: there is a local variable for an extra syntax table for
   `syntax-propertize'

Any other ideas?

With Solution 1, it would be excellent if the (nth 9 ppss),
parse-partial-sexp, would be made official.  Otherwise, the multi-mode
check in antlr-mode.el (are we in the action of a grammar?) could not
rely on (nth 0 ppss) anymore...

- Christoph




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-24 11:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 18:06 Clarification needed: syntax-propertize vs font-lock-syntax-table Wedler, Christoph
2015-11-18 18:37 ` Dmitry Gutov
2015-11-20 18:24   ` Wedler, Christoph
2015-11-20 18:39     ` Dmitry Gutov
2015-11-23 17:05       ` Wedler, Christoph
2015-11-23 19:01         ` Dmitry Gutov
2015-11-24  8:58           ` Wedler, Christoph
2015-11-24 11:35             ` Dmitry Gutov

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).