From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Hrvoje Niksic Newsgroups: gmane.emacs.devel Subject: Re: (font-lock-mode 1) does not always force font-lock Date: Fri, 24 Oct 2003 00:30:17 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066948442 28546 80.91.224.253 (23 Oct 2003 22:34:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Oct 2003 22:34:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Oct 24 00:34:00 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 1ACo1o-0007xD-00 for ; Fri, 24 Oct 2003 00:34:00 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ACo1n-0002ey-00 for ; Fri, 24 Oct 2003 00:34:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ACnzu-0002BF-Mx for emacs-devel@quimby.gnus.org; Thu, 23 Oct 2003 18:32:02 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ACnyS-0001nj-Gm for emacs-devel@gnu.org; Thu, 23 Oct 2003 18:30:32 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ACnxv-0001eP-SQ for emacs-devel@gnu.org; Thu, 23 Oct 2003 18:30:30 -0400 Original-Received: from [213.191.128.10] (helo=mxout.iskon.hr) by monty-python.gnu.org with smtp (Exim 4.24) id 1ACnxv-0001eG-Cg for emacs-devel@gnu.org; Thu, 23 Oct 2003 18:29:59 -0400 Original-Received: (qmail 4427 invoked from network); 24 Oct 2003 00:29:57 +0200 Original-Received: from mx.iskon.hr (qmailr@213.191.128.11) by mxout.iskon.hr with SMTP; 24 Oct 2003 00:29:57 +0200 Original-Received: (qmail 9511 invoked from network); 24 Oct 2003 00:29:57 +0200 X-Remote-IP: 213.191.139.219 Original-Received: from hniksic.iskon.hr (213.191.139.219) by mx.iskon.hr with SMTP; 24 Oct 2003 00:29:57 +0200 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu, 23 Oct 2003 14:38:38 -0400") User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) 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:17389 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17389 Richard Stallman writes: > This returns nil because `(font-lock-mode 1)' does not force > font-lock, contrary to the docstring which, in GNU Emacs 21.2.1, > states: > > With arg, turn Font Lock mode off if and only if arg is a > non-positive number; if arg is nil, toggle Font Lock mode; > anything else turns Font Lock on. > > I assume the problem is that the buffer is that the buffer in > question is temporary. > > that seems like a bug to me. perhaps it is a consequence of a > feature meant for some other case. It was probably meant to prevent unwanted fontification of temporary buffers for users who turn on font-lock from a global hook or who use global-font-lock-mode. The idea is correct, but the place is wrong. The code that excludes temporary buffers from font-lock should be in global-font-lock-mode or perhaps in turn-on-font-lock, but not in font-lock-mode proper. > what code tests this? I don't have the sources handy. It seems that the code recognizes the buffer as temporary by checking for names that begins with space. For instance, this works (returns t): (let ((newbuf (generate-new-buffer "*foo*"))) (with-current-buffer newbuf (c-mode) (font-lock-mode 1) (prog1 font-lock-mode (kill-buffer (current-buffer))))) Change "*foo*" to " *foo*", and it no longer works, i.e. it returns nil. > can u suggest a patch? I don't have a patch, sorry.