From: Alan Mackenzie <acm@muc.de>
To: Tassilo Horn <tassilo@member.fsf.org>, Chong Yidong <cyd@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Fontification partly broken in some modes
Date: Sun, 26 Feb 2012 01:47:46 +0000 [thread overview]
Message-ID: <20120226014746.GA3377@acm.acm> (raw)
In-Reply-To: <87d392zlna.fsf@thinkpad.tsdh.de>
Tassilo, Yidong,
On Sat, Feb 25, 2012 at 09:46:33PM +0100, Tassilo Horn wrote:
> Alan Mackenzie <acm@muc.de> 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).
next prev parent reply other threads:[~2012-02-26 1:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 10:41 Fontification partly broken in some modes Tassilo Horn
2012-02-25 10:51 ` Chong Yidong
2012-02-25 13:16 ` Alan Mackenzie
2012-02-25 18:19 ` Alan Mackenzie
2012-02-25 20:46 ` Tassilo Horn
2012-02-26 1:47 ` Alan Mackenzie [this message]
2012-02-26 4:52 ` Chong Yidong
2012-02-26 13:08 ` Alan Mackenzie
2012-02-26 16:45 ` Chong Yidong
2012-02-26 19:15 ` Tassilo Horn
2012-02-25 19:03 ` Thierry Volpiatto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120226014746.GA3377@acm.acm \
--to=acm@muc.de \
--cc=cyd@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tassilo@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.