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

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

setting the mode of a buffer


From: lee
Subject: setting the mode of a buffer
Date: Fri, 07 Mar 2014 01:10:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi,

how would I set the mode of a buffer along the lines of ...


(with-current-buffer buffer (set-auto-mode t))


... but by setting a particular mode rather calling a function to set
modes which would be automatically set.

The above works, though it seems to be rather inefficient.  I have tried
with (set-auto-mode-0) and got errors because a hook involved with the
mode I was trying to set couldn´t find its function.


In the end, what I´m trying to achieve is to be able to reload a mode
after it has been modified.  To reload it, I´m using (unload-feature),
and that disables the mode for all buffers for which it is enabled.  It
also magically removes an entry in auto-mode-alist for this mode.

When the mode is reloaded, I have to enable it for all relevant buffers
manually.  To avoid having to do this, I´ve finally written a function
that goes through the buffer-list and enables the mode for particular
buffers.  This function uses (set-auto-mode), in lack of a better
alternative.

Perhaps I´m going all wrong about this and there is a better way to
reload a mode?


-- 
Knowledge is volatile and fluid.  Software is power.



reply via email to

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