From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: C mode to hexl mode and back loses color highlighting Date: Tue, 12 Feb 2008 11:49:58 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202835041 14207 80.91.229.12 (12 Feb 2008 16:50:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Feb 2008 16:50:41 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, Chris Moore To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 12 17:51:04 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JOyLA-0007VE-Vt for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2008 17:50:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOyKh-00061g-KM for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2008 11:50:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOyKZ-0005wy-GO for emacs-devel@gnu.org; Tue, 12 Feb 2008 11:50:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOyKY-0005wL-Nw for emacs-devel@gnu.org; Tue, 12 Feb 2008 11:50:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOyKY-0005wF-J9 for emacs-devel@gnu.org; Tue, 12 Feb 2008 11:50:02 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOyKY-00062m-Fg for emacs-devel@gnu.org; Tue, 12 Feb 2008 11:50:02 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JOyKX-0005k0-U1 for emacs-pretest-bug@gnu.org; Tue, 12 Feb 2008 11:50:02 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JOyKV-00061w-1P for emacs-pretest-bug@gnu.org; Tue, 12 Feb 2008 11:50:02 -0500 Original-Received: from vpn-132-204-232-187.acd.umontreal.ca ([132.204.232.187] helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JOyKU-00061o-NI for emacs-pretest-bug@gnu.org; Tue, 12 Feb 2008 11:49:58 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 6D4BBB40DF; Tue, 12 Feb 2008 11:49:58 -0500 (EST) In-Reply-To: (Juanma Barranquero's message of "Tue, 12 Feb 2008 15:57:00 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 1202 seconds by postgrey-1.27 at monty-python; Tue, 12 Feb 2008 11:49:58 EST X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88883 gmane.emacs.pretest.bugs:21051 Archived-At: >> In the current CVS trunk: >> >> * run emacs -Q >> * visit a C source file - notice the comments are red >> * M-x hexl-mode RET - switch to hexl mode >> * C-c C-c - switch back to C mode >> * notice the comments are no longer red > This is not specific to the trunk, it happens with EMACS_22_BASE too. I've installed the following fix on the 22 branch. Stefan 2008-02-12 Stefan Monnier * font-lock.el (font-lock-set-defaults): Unset previously set variables when needed. Index: lisp/font-lock.el =================================================================== RCS file: /sources/emacs/emacs/lisp/font-lock.el,v retrieving revision 1.317.2.5 diff -u -r1.317.2.5 font-lock.el --- lisp/font-lock.el 7 Jan 2008 02:44:46 -0000 1.317.2.5 +++ lisp/font-lock.el 12 Feb 2008 16:48:46 -0000 @@ -1777,13 +1777,16 @@ (cdr-safe (assq major-mode font-lock-removed-keywords-alist)))) (set (make-local-variable 'font-lock-defaults) defaults) ;; Syntactic fontification? - (when (nth 1 defaults) - (set (make-local-variable 'font-lock-keywords-only) t)) + (if (nth 1 defaults) + (set (make-local-variable 'font-lock-keywords-only) t) + (kill-local-variable 'font-lock-keywords-only)) ;; Case fold during regexp fontification? - (when (nth 2 defaults) - (set (make-local-variable 'font-lock-keywords-case-fold-search) t)) + (if (nth 2 defaults) + (set (make-local-variable 'font-lock-keywords-case-fold-search) t) + (kill-local-variable 'font-lock-keywords-case-fold-search)) ;; Syntax table for regexp and syntactic fontification? - (when (nth 3 defaults) + (if (null (nth 3 defaults)) + (kill-local-variable 'font-lock-syntax-table) (set (make-local-variable 'font-lock-syntax-table) (copy-syntax-table (syntax-table))) (dolist (selem (nth 3 defaults)) @@ -1794,9 +1797,10 @@ (mapcar 'identity (car selem)))) (modify-syntax-entry char syntax font-lock-syntax-table))))) ;; Syntax function for syntactic fontification? - (when (nth 4 defaults) + (if (nth 4 defaults) (set (make-local-variable 'font-lock-beginning-of-syntax-function) - (nth 4 defaults))) + (nth 4 defaults)) + (kill-local-variable 'font-lock-beginning-of-syntax-function)) ;; Variable alist? (dolist (x (nthcdr 5 defaults)) (set (make-local-variable (car x)) (cdr x)))