Trying to disable the fontification of strings in fundamental-mode
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
Trying to disable the fontification of strings in fundamental-mode         


Author: Davin Pearson
Date: Sep 11, 2008 21:30

I am trying to turn off the fonfication of strings in
fundamental
mode. The following code appears to turn it off in *all* modes,
not
just fundamental mode. What do I need to do to restrict
the
suppressing of the fontification of strings to just fundamental
mode?

(defadvice fundamental-mode (before my-remove-strings
activate)
(if (eq major-mode 'fundamental-
mode)
(setq font-lock-string-face
nil)))
Show full article (0.57Kb)
3 Comments
Re: Trying to disable the fontification of strings in fundamental-mode         


Author: Nikolaj Schumacher
Date: Sep 12, 2008 01:57

Davin Pearson gmail.com> wrote:
> What do I need to do to restrict the suppressing of the fontification
> of strings to just fundamental mode?

First of all, don't use advice for this! Use hooks, which are cleaner
and safer.

Second of all, setq changes the variable globally, so naturally it is
disabled everywhere. You need to make the variable buffer-local.

(defun my-fundamental-mode-hook ()
(set (make-variable-buffer-local 'font-lock-string-face) nil))

(add-hook 'fundamental-mode-hook 'my-fundamental-mode-hook)

regards,
Nikolaj Schumacher
no comments
Re: Trying to disable the fontification of strings in fundamental-mode         


Author: Davin Pearson
Date: Sep 12, 2008 19:48

On Sep 12, 8:57 pm, Nikolaj Schumacher wrote:
> Davin Pearson gmail.com> wrote:
>> What do I need to do to restrict the suppressing of the fontification
>> of strings to just fundamental mode?
>
> First of all, don't use advice for this!  Use hooks, which are cleaner
> and safer.
>
> Second of all, setq changes the variable globally, so naturally it is
> disabled everywhere.  You need to make the variable buffer-local.
>
> (defun my-fundamental-mode-hook ()
>   (set (make-variable-buffer-local 'font-lock-string-face) nil))
>
> (add-hook 'fundamental-mode-hook 'my-fundamental-mode-hook)

The above code doesn't work as there is no Emacs hook called
fundamental-mode-hook

Following your advice about local variables I also tried the
following:
Show full article (1.20Kb)
no comments
Re: Trying to disable the fontification of strings in fundamental-mode         


Author: Davin Pearson
Date: Sep 12, 2008 19:57

I managed to get the following code to work:
> (defadvice fundamental-mode (after my-remove-strings
> activate)
>   (if (eq major-mode 'fundamental-
> mode)
>       (set (make-variable-buffer-local 'font-lock-string-face) nil)))

I don't see the problem about using advice. I use advice all of the
time in Emacs.
no comments