emacs-devel
[Top][All Lists]
Advanced

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

Re: Fontification partly broken in some modes


From: Alan Mackenzie
Subject: Re: Fontification partly broken in some modes
Date: Sun, 26 Feb 2012 01:47:46 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Tassilo, Yidong,

On Sat, Feb 25, 2012 at 09:46:33PM +0100, Tassilo Horn wrote:
> Alan Mackenzie <address@hidden> writes:

> Hi Alan,

> >> The same applies to rcirc prompts, but only those in channel buffers
> >> that I customized to

> >>   (setq rcirc-prompt "%t> ")

> >> i.e., channel name and then ">".  In server buffers, the prompts are
> >> just ">" and those are fontified in `rcirc-prompt' face...

> >> Everything else seems to be fontified correctly.  Does anyone see
> >> that, too?

> > Is there any chance you could send me a recipe to reproduce either of the
> > above (with any pertinent config files)?

> Sure, rcirc is a bit easier to reproduce:

>   1. emacs -Q --eval '(setq rcirc-prompt "%t> ")'
>   2. M-x rcirc RET    ;; Will connect to freenode
>   3. /join #foobar

Thanks, that was most helpful.

> Now in the buffer for that channel the prompt

>   #foobar>

> is not fontified in `rcirc-prompt' face although it should be.  The
> prompt of the *irc.freenode.net* buffer is fontified correctly.

Please try the following patch and let me know it works:


=== modified file 'lisp/font-core.el'
*** lisp/font-core.el   2012-02-23 18:51:22 +0000
--- lisp/font-core.el   2012-02-26 01:29:08 +0000
***************
*** 138,144 ****
  your own function which is called when `font-lock-mode' is toggled via
  `font-lock-function'. "
    nil nil nil
!   :after-hook (if font-lock-mode (font-lock-initial-fontify))
    ;; Don't turn on Font Lock mode if we don't have a display (we're running a
    ;; batch job) or if the buffer is invisible (the name starts with a space).
    (when (or noninteractive (eq (aref (buffer-name) 0) ?\s))
--- 138,145 ----
  your own function which is called when `font-lock-mode' is toggled via
  `font-lock-function'. "
    nil nil nil
!   :after-hook (if (and font-lock-mode (font-lock-spec-present t))
!                 (font-lock-initial-fontify))
    ;; Don't turn on Font Lock mode if we don't have a display (we're running a
    ;; batch job) or if the buffer is invisible (the name starts with a space).
    (when (or noninteractive (eq (aref (buffer-name) 0) ?\s))
***************
*** 166,171 ****
--- 167,182 ----
                                      '(font-lock-face)))
      (restore-buffer-modified-p modp)))
  
+ (defun font-lock-spec-present (mode)
+   "Is there enough specification to do fontification at all?"
+   (or font-lock-defaults
+       (if (boundp 'font-lock-keywords) font-lock-keywords)
+       (and mode
+          (boundp 'font-lock-set-defaults)
+          font-lock-set-defaults
+          font-lock-major-mode
+          (not (eq font-lock-major-mode major-mode)))))
+ 
  (defvar font-lock-set-defaults)
  (defun font-lock-default-function (mode)
    ;; Turn on Font Lock mode.
***************
*** 192,204 ****
  
    ;; Only do hard work if the mode has specified stuff in
    ;; `font-lock-defaults'.
!   (when (or font-lock-defaults
!           (if (boundp 'font-lock-keywords) font-lock-keywords)
!           (and mode
!                (boundp 'font-lock-set-defaults)
!                font-lock-set-defaults
!                font-lock-major-mode
!                (not (eq font-lock-major-mode major-mode))))
      (font-lock-mode-internal mode)))
  
  (defun turn-on-font-lock ()
--- 203,209 ----
  
    ;; Only do hard work if the mode has specified stuff in
    ;; `font-lock-defaults'.
!   (when (font-lock-spec-present mode)
      (font-lock-mode-internal mode)))
  
  (defun turn-on-font-lock ()


> Bye,
> Tassilo

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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