all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Juanma Barranquero" <lekktu@gmail.com>
Cc: emacs-pretest-bug@gnu.org, Chris Moore <christopher.ian.moore@gmail.com>
Subject: Re: C mode to hexl mode and back loses color highlighting
Date: Tue, 12 Feb 2008 11:49:58 -0500	[thread overview]
Message-ID: <jwvejbiazmz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <f7ccd24b0802120657j1f3160b2maaa074d680aa6bf@mail.gmail.com> (Juanma Barranquero's message of "Tue, 12 Feb 2008 15:57:00 +0100")

>> 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  <monnier@iro.umontreal.ca>

	* 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)))




      reply	other threads:[~2008-02-12 16:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 12:54 C mode to hexl mode and back loses color highlighting Chris Moore
2008-02-12 14:57 ` Juanma Barranquero
2008-02-12 16:49   ` Stefan Monnier [this message]

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=jwvejbiazmz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=christopher.ian.moore@gmail.com \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=lekktu@gmail.com \
    /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.