help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: view-mode dismissed when changing major mode


From: Holger Sparr
Subject: Re: view-mode dismissed when changing major mode
Date: Wed, 02 May 2007 14:27:15 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux)

Johan schrieb am 27.04.2007:

> Holger Sparr <address@hidden> writes:
>
>> When opening a file with view-file and then switching to a different
>> major mode to get some fontification the view-mode is dismmissed.
>>
>> Is this intended behavior?
>
> Yes.
>
>     (defun view-mode-enable ()
>       "Turn on View mode."
>       ;; Always leave view mode before changing major mode.
>       ;; This is to guarantee that the buffer-read-only variable is restored.
>       (add-hook 'change-major-mode-hook 'view-mode-disable nil t)
>       [...]


Then I'd suggest a function 'View-fontify-buffer-according-to' and make
it available in the view-mode-map.  

This function should ask for a major mode for fontification, apply the
fontification and enable the view-mode afterwards.

This would make it handy to view files which do not match a regular
expression in auto-mode-alist.


Holger


reply via email to

[Prev in Thread] Current Thread [Next in Thread]