From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Fontification partly broken in some modes Date: Sun, 26 Feb 2012 01:47:46 +0000 Message-ID: <20120226014746.GA3377@acm.acm> References: <87hayfyz31.fsf@thinkpad.tsdh.de> <20120225181929.GA2691@acm.acm> <87d392zlna.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1330220923 16402 80.91.229.3 (26 Feb 2012 01:48:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 26 Feb 2012 01:48:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tassilo Horn , Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 26 02:48:42 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S1TE6-0001kh-S3 for ged-emacs-devel@m.gmane.org; Sun, 26 Feb 2012 02:48:39 +0100 Original-Received: from localhost ([::1]:43093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1TE6-0005bm-Ft for ged-emacs-devel@m.gmane.org; Sat, 25 Feb 2012 20:48:38 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1TDy-0005bW-Ns for emacs-devel@gnu.org; Sat, 25 Feb 2012 20:48:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1TDs-0006bY-W1 for emacs-devel@gnu.org; Sat, 25 Feb 2012 20:48:30 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:38891 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1TDs-0006bQ-Mn for emacs-devel@gnu.org; Sat, 25 Feb 2012 20:48:24 -0500 Original-Received: (qmail 80889 invoked by uid 3782); 26 Feb 2012 01:48:23 -0000 Original-Received: from acm.muc.de (pD95199F9.dip.t-dialin.net [217.81.153.249]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 26 Feb 2012 02:48:21 +0100 Original-Received: (qmail 3431 invoked by uid 1000); 26 Feb 2012 01:47:46 -0000 Content-Disposition: inline In-Reply-To: <87d392zlna.fsf@thinkpad.tsdh.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148786 Archived-At: Tassilo, Yidong, On Sat, Feb 25, 2012 at 09:46:33PM +0100, Tassilo Horn wrote: > Alan Mackenzie 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).