[Top][All Lists]

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

Re: XKCD/541 compliance, anyone?

From: Marcin Borkowski
Subject: Re: XKCD/541 compliance, anyone?
Date: Wed, 07 Jan 2015 23:09:25 +0100

On 2015-01-01, at 18:07, Stefan Monnier <> wrote:

> Beware: syntax-propertize-function might already be in use, in which
> case you should probably use add-function to combine the two.

I think I'll just use the easiest solution: signal an error or warning
if syntax-propertize-function is non-nil.  As I wrote, in modes this is
going to be useful it’s probably nil anyway.

>> However, it did not work (in text mode); my make-smileys-punctuation
>> seems not even to get called.
> Right, syntax-propertization is done lazily, so if nothing calls
> syntax-propertize, then that's that.  Usually the main triggers for
> syntax-propertize are syntax-ppss and font-lock, but neither is likely
> to be used in text-mode.  So you'll probably need to arrange for font-lock to
> be enabled *and* for font-lock-keywords-only not to be set to t.

Now this question remains: how to ensure that syntax-propertize is
getting called everywhere?  Is (syntax-propertize (point-max)) the best
idea?  (In fact, probably rather something like (save-restriction
(widen) (syntax-propertize (point-max))) would be better.)  This way,
I wouldn’t even have to ensure that font-lock is enabled or
font-lock-keywords-only is set to nil.

The reason I'm asking is that I do not want to assume that font-lock is
in use; otherwise I could also e.g. call (font-lock-fontify-buffer).

Curiously enough, doing M-: (syntax-ppss) RET did the trick, but only
for a few lines.  I guess this is because of the “laziness” you

Now one problem remains.  I’d like to mark all the smileys with a greyed
font.  Are “font lock keywords” the right tool for that?  (Also, it
might be interesting to use the “prettifying” mode to display them as
Unicode smileys.)

>         Stefan


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

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