diff --git a/lisp/font-core.el b/lisp/font-core.el index f70c42bb03..09e55bcfb1 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -266,6 +266,12 @@ turn-on-font-lock-if-desired (let (inhibit-quit) (turn-on-font-lock)))) +(defun run-fontification-functions (pos) + ;; XXX: Apply narrowing around here. + ;; (pcase-exhaustive font-lock-large-files + ;; ...) + (run-hook-with-args 'fontification-functions pos)) + (define-globalized-minor-mode global-font-lock-mode font-lock-mode turn-on-font-lock-if-desired ;; What was this :extra-args thingy for? --Stef diff --git a/src/xdisp.c b/src/xdisp.c index 1e8f70b2db..ce90aeefbc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4381,53 +4381,18 @@ handle_fontified_prop (struct it *it) NILP (prop) && IT_CHARPOS (*it) < Z)) { specpdl_ref count = SPECPDL_INDEX (); - Lisp_Object val; struct buffer *obuf = current_buffer; ptrdiff_t begv = BEGV, zv = ZV; bool old_clip_changed = current_buffer->clip_changed; bool saved_inhibit_flag = it->f->inhibit_clear_image_cache; - val = Vfontification_functions; - specbind (Qfontification_functions, Qnil); - eassert (it->end_charpos == ZV); /* Don't allow Lisp that runs from 'fontification-functions' clear our face and image caches behind our back. */ it->f->inhibit_clear_image_cache = true; - if (!CONSP (val) || EQ (XCAR (val), Qlambda)) - safe_call1 (val, pos); - else - { - Lisp_Object fns, fn; - - fns = Qnil; - - for (; CONSP (val); val = XCDR (val)) - { - fn = XCAR (val); - - if (EQ (fn, Qt)) - { - /* A value of t indicates this hook has a local - binding; it means to run the global binding too. - In a global value, t should not occur. If it - does, we must ignore it to avoid an endless - loop. */ - for (fns = Fdefault_value (Qfontification_functions); - CONSP (fns); - fns = XCDR (fns)) - { - fn = XCAR (fns); - if (!EQ (fn, Qt)) - safe_call1 (fn, pos); - } - } - else - safe_call1 (fn, pos); - } - } + safe_call1 (intern ("run-fontification-functions"), pos); it->f->inhibit_clear_image_cache = saved_inhibit_flag; unbind_to (count, Qnil);