From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Holger Sparr Newsgroups: gmane.emacs.help Subject: Re: view-mode dismissed when changing major mode Date: Wed, 02 May 2007 14:27:15 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1178110022 25264 80.91.229.12 (2 May 2007 12:47:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 May 2007 12:47:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 02 14:46:58 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HjEER-0008Cx-0h for geh-help-gnu-emacs@m.gmane.org; Wed, 02 May 2007 14:46:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HjEKq-0007lN-4e for geh-help-gnu-emacs@m.gmane.org; Wed, 02 May 2007 08:53:32 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-X-Trace: news.dfncis.de 1dU+afwWWaI2Hvuk9IcNdw8TpKP50DM312f0XPtqpVb8sS Mail-Copies-To: never User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux) Cancel-Lock: sha1:m3875KzJL3rIV2pXp41VE4GiERM= Original-Xref: shelby.stanford.edu gnu.emacs.help:147887 X-Mailman-Approved-At: Wed, 02 May 2007 08:47:39 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:43490 Archived-At: Johan schrieb am 27.04.2007: > Holger Sparr 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