From: lee <lee@yun.yagibdah.de>
To: help-gnu-emacs@gnu.org
Subject: setting the mode of a buffer
Date: Fri, 07 Mar 2014 01:10:44 +0100 [thread overview]
Message-ID: <8738iukgvv.fsf@yun.yagibdah.de> (raw)
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.
next reply other threads:[~2014-03-07 0:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 0:10 lee [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738iukgvv.fsf@yun.yagibdah.de \
--to=lee@yun.yagibdah.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.