unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C mode to hexl mode and back loses color highlighting
@ 2008-02-12 12:54 Chris Moore
  2008-02-12 14:57 ` Juanma Barranquero
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Moore @ 2008-02-12 12:54 UTC (permalink / raw)
  To: emacs-pretest-bug

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C mode to hexl mode and back loses color highlighting
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Juanma Barranquero @ 2008-02-12 14:57 UTC (permalink / raw)
  To: Chris Moore; +Cc: emacs-pretest-bug

On Feb 12, 2008 1:54 PM, Chris Moore <christopher.ian.moore@gmail.com> wrote:

> 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.

             Juanma




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C mode to hexl mode and back loses color highlighting
  2008-02-12 14:57 ` Juanma Barranquero
@ 2008-02-12 16:49   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2008-02-12 16:49 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-pretest-bug, Chris Moore

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-12 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).