[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: font lock with functions
From: |
Stefan Monnier |
Subject: |
Re: font lock with functions |
Date: |
Tue, 31 Mar 2020 09:20:37 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> - It is very easy during testing to completely hang your Emacs session
> if one of the font-lock functions hangs. One usually needs to kill
> Emacs in this case.
`jit-lock-debug-mode` might be helpful there.
If it's not good enough for your situation, please `M-x report-emacs-bug`.
> We should try to get this into ELPA and advertise it in the manual:
>
> https://github.com/Lindydancer/font-lock-studio
Agreed.
> On a more general note: When you use functions for font-locking, I often
> find myself in the position that I'm more or less writing a parser, and
> I could readily tell font-lock how to fontify several parts of the
> buffer with different faces. However, AFAICS, this is not possible with
> current font-lock?
You can't use the `font-lock-keywords` special syntax for that, but you
can still do it (by hand). E.g.
(defvar foo-font-lock-keywords
`(("someregexp" (1 'foo-face) (2 'bar-face))
(my-parsing-function)))
(defun my-parsing-function (limit)
...
(while ...
(put-text-property x y 'face 'foobar-face)
...)
;; Return nil if you don't want font-lock to call you again right away
;; to "look for the next match".
nil)
-- Stefan
- Re: emacs rendering comparisson between emacs23 and emacs26.3, (continued)
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Eli Zaretskii, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Stefan Monnier, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Eli Zaretskii, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Dmitry Gutov, 2020/03/29
- emacs-tree-sitter and font-lock (was: emacs rendering comparisson between emacs23 and emacs26.3), Stefan Monnier, 2020/03/29
- Re: emacs-tree-sitter and font-lock, Dmitry Gutov, 2020/03/29
- font lock with functions (was: emacs rendering comparisson between emacs23 and emacs26.3), David Engster, 2020/03/31
- Re: font lock with functions, Adam Porter, 2020/03/31
- Re: font lock with functions,
Stefan Monnier <=
- Re: font lock with functions, Dmitry Gutov, 2020/03/31
- Re: font lock with functions, Stefan Monnier, 2020/03/31
- Re: font lock with functions, Dmitry Gutov, 2020/03/31
- Re: font lock with functions, Stephen Leake, 2020/03/31
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Dmitry Gutov, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Eli Zaretskii, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Dmitry Gutov, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, 조성빈, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Eli Zaretskii, 2020/03/29
- Re: emacs rendering comparisson between emacs23 and emacs26.3, Richard Stallman, 2020/03/29