[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 <monnier@iro.umontreal.ca> 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
mentioned.
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
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
Re: XKCD/541 compliance, anyone?, Marcin Borkowski, 2015/01/02
Re: XKCD/541 compliance, anyone?,
Marcin Borkowski <=
- Re: XKCD/541 compliance, anyone?, Stefan Monnier, 2015/01/07
- Re: XKCD/541 compliance, anyone?, Marcin Borkowski, 2015/01/07
- Re: XKCD/541 compliance, anyone?, Stefan Monnier, 2015/01/07
- Re: XKCD/541 compliance, anyone?, Marcin Borkowski, 2015/01/07
- Message not available
- Re: XKCD/541 compliance, anyone?, Stefan Monnier, 2015/01/07
- Re: XKCD/541 compliance, anyone?, Marcin Borkowski, 2015/01/08