[plug] global-font-lock-mode not activating colourisation when executed from .emacs

Jim Householder nofixed at westnet.com.au
Tue Feb 1 22:49:40 WST 2005


Russell Steicke wrote:
> On Tue, Feb 01, 2005 at 05:49:35PM +0800, Cameron Patrick wrote:
> 
>>David Buddrige wrote:
>>
>>
>>>However, being a lazy sort, I really would prefer it if emacs would 
>>>activate this feature for me, rather than my having to type it every time I 
>>>load my perl source code, so I edited my .emacs file, and added the line: 
>>>
>>>(setq global-font-lock-mode t) 
>>
>>That's not the why my .emacs has it; I have a snippet that looks like:
>>
>>(custom-set-variables
>>  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
>>  ;; Your init file should contain only one such instance.
>> '(c-basic-offset 8)
>>[...snip...]
>> '(global-font-lock-mode t nil (font-lock))
>>[...snip...]
>> '(user-mail-address "cameron at patrick.wattle.id.au"))
>>
>>I believe that I enabled it using M-x customize and drilling down
>>through the utterly counterintuitive menu system.
> 
> 
> Or just this:
> 
>   (global-font-lock-mode 1)
> 
> Your problem is that global-font-mode has both a function binding and
> a variable binding.  The code that does font locking seems to set the
> global-font-lock-mode variable, but not read it.  So you need to call
> the function to turn on fonts.
> 
> You can get the documentation for the global-font-lock-mode function
> with
> 
>   C-h f global-font-lock-mode RET
> 
> And for the global-font-lock-mode variable with
> 
>   C-h v global-font-lock-mode RET
> 
> 

For what it's worth, this is my .emacs code:
    (defun turn-on-font-lock ()
      (font-lock-mode 1))

    (require 'font-lock)
    (global-font-lock-mode t)

    (setq font-lock-maximum-decoration t)
    (eval-after-load "font-lock"
                     '(add-to-list 'c-font-lock-keywords-3
                                   '("\\<FILE\\>" . font-lock-type-face)))

I'm not sure how much is actually needed.  It has evolved since I started with version 19.34.
 
HTH
Jim



More information about the plug mailing list