all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* setting the mode of a buffer
@ 2014-03-07  0:10 lee
  0 siblings, 0 replies; 8+ messages in thread
From: lee @ 2014-03-07  0:10 UTC (permalink / raw)
  To: help-gnu-emacs

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-17 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.16657.1394156425.10748.help-gnu-emacs@gnu.org>
2014-03-07  8:47 ` setting the mode of a buffer Joost Kremers
2014-03-07 11:28   ` lee
     [not found]   ` <mailman.16664.1394193871.10748.help-gnu-emacs@gnu.org>
2014-03-12 22:19     ` Joost Kremers
2014-03-13 12:26       ` Stefan Monnier
2014-03-15 21:12         ` lee
2014-03-15 21:09       ` lee
     [not found]       ` <mailman.17152.1394713615.10748.help-gnu-emacs@gnu.org>
2014-03-17 11:17         ` Joost Kremers
2014-03-07  0:10 lee

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.