From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alexander Pohoyda Newsgroups: gmane.emacs.devel Subject: Re: (font-lock-mode 1) does not always force font-lock Date: 18 Nov 2003 22:13:34 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <873cclwfb5.fsf@oak.pohoyda.family> References: <87vfqffbwe.fsf@oak.pohoyda.family> <8765iephzh.fsf@oak.pohoyda.family> <87y8v9epmv.fsf@oak.pohoyda.family> <87ismcb5ek.fsf@oak.pohoyda.family> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069190365 15467 80.91.224.253 (18 Nov 2003 21:19:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Nov 2003 21:19:25 +0000 (UTC) Cc: alex@emacswiki.org, hniksic@xemacs.org, monnier@IRO.UMontreal.CA, rms@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Nov 18 22:19:21 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMDFp-0006c5-00 for ; Tue, 18 Nov 2003 22:19:21 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMDFo-0004kV-00 for ; Tue, 18 Nov 2003 22:19:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMEC2-0007py-R2 for emacs-devel@quimby.gnus.org; Tue, 18 Nov 2003 17:19:30 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AME9T-00070S-Vd for emacs-devel@gnu.org; Tue, 18 Nov 2003 17:16:51 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AME7w-0006hq-8Q for emacs-devel@gnu.org; Tue, 18 Nov 2003 17:15:48 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.24) id 1AME7t-0006gX-H3 for emacs-devel@gnu.org; Tue, 18 Nov 2003 17:15:13 -0500 Original-Received: (qmail 31982 invoked by uid 65534); 18 Nov 2003 21:13:44 -0000 Original-Received: from p508425DC.dip0.t-ipconnect.de (EHLO oak.pohoyda.family) (80.132.37.220) by mail.gmx.net (mp023) with SMTP; 18 Nov 2003 22:13:44 +0100 X-Authenticated: #14602519 Original-Received: from oak.pohoyda.family (oak.pohoyda.family [127.0.0.1]) by oak.pohoyda.family (8.12.9/8.12.9) with ESMTP id hAILDgVE001704; Tue, 18 Nov 2003 22:13:42 +0100 (CET) (envelope-from alexander.pohoyda@gmx.net) Original-Received: (from apog@localhost) by oak.pohoyda.family (8.12.9/8.12.9/Submit) id hAILDYab001700; Tue, 18 Nov 2003 22:13:34 +0100 (CET) (envelope-from alexander.pohoyda@gmx.net) X-Authentication-Warning: oak.pohoyda.family: apog set sender to alexander.pohoyda@gmx.net using -f Original-To: emacs-devel@gnu.org In-Reply-To: Original-Lines: 51 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17893 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17893 Richard Stallman writes: > i think that explicit call to font-lock-mode shd apply to all > buffers. instead global-font-lock-mode should check to avoid temp bufs. > someone want to do it? Please excuse me that it took so long. Here's the patch. Note that it avoids invisible, not temp buffers. Index: font-core.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/font-core.el,v retrieving revision 1.23 diff -u -r1.23 font-core.el --- font-core.el 1 Sep 2003 15:45:12 -0000 1.23 +++ font-core.el 18 Nov 2003 21:02:45 -0000 @@ -149,10 +149,6 @@ your own function which is called when `font-lock-mode' is toggled via `font-lock-function'. " nil nil nil - ;; 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) ?\ )) - (setq font-lock-mode nil)) (funcall font-lock-function font-lock-mode) ;; Arrange to unfontify this buffer if we change major mode later. (if font-lock-mode @@ -282,8 +278,14 @@ :group 'font-lock) (defun turn-on-font-lock-if-enabled () - (unless (and (eq (car-safe font-lock-global-modes) 'not) - (memq major-mode (cdr font-lock-global-modes))) + (unless (or + ;; we don't have a display (we're running a batch job) + noninteractive + ;; the buffer is invisible (the name starts with a space) + (eq (aref (buffer-name) 0) ?\ ) + ;; this mode is in the list which is negative + (and (eq (car-safe font-lock-global-modes) 'not) + (memq major-mode (cdr font-lock-global-modes)))) (let (inhibit-quit) (turn-on-font-lock)))) -- Alexander Pohoyda PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72 15 54 5F 62 20 23 C6 44