From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs mode line suggestions
Date: Tue, 18 Nov 2008 02:32:00 -0700 [thread overview]
Message-ID: <gfu22h$edr$1@ger.gmane.org> (raw)
In-Reply-To: <20081117234605.GC9335@muc.de>
Alan Mackenzie wrote:
>> Usually, creating a new file with C-x C-f already switches on the right
>> mode. And even if Emacs somehow gets this wrong, it's a one-time event
>> for that buffer.
>
> However, if I create a new buffer with C-x C-b foo.c, it starts in
> Fundamental Mode, not C Mode. Is there a good reason for this, or did it
> just happen? It irritates me quite a bit, but not quite enough to bring
> me to fixing it. ;-)
I think the reason is that auto-mode-alist applies only to file names.
I suppose it is arguable whether that is a good reason or not, but
"fixing" it to apply to buffer names would be a pretty far-reaching
change.
Maybe this would work for you:
(defadvice switch-to-buffer (around interactive-normal-mode activate)
"When called interactively to create a new buffer not visiting a file,
temporarily bind `buffer-file-name' and call `normal-mode'."
(let ((existing-buffer (get-buffer (ad-get-arg 0))))
ad-do-it
(when (and (interactive-p)
(null existing-buffer)
(null buffer-file-name))
(let ((buffer-file-name (expand-file-name (buffer-name))))
(normal-mode)))))
--
Kevin Rodgers
Denver, Colorado, USA
next prev parent reply other threads:[~2008-11-18 9:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.215.1226562978.26697.help-gnu-emacs@gnu.org>
2008-11-14 23:18 ` emacs mode line suggestions Xah
2008-11-15 1:02 ` xahlee
2008-11-15 9:23 ` Eli Zaretskii
[not found] ` <mailman.423.1226741023.26697.help-gnu-emacs@gnu.org>
2008-11-16 1:54 ` Xah
2008-11-16 18:12 ` Ian Eure
2008-11-18 9:39 ` Kevin Rodgers
2008-11-18 23:25 ` Xavier Maillard
2008-11-16 21:40 ` Eli Zaretskii
[not found] ` <mailman.518.1226859137.26697.help-gnu-emacs@gnu.org>
2008-11-16 18:20 ` Richard Riley
2008-11-16 23:12 ` Ian Eure
2008-11-17 8:37 ` Paul R
2008-11-17 15:45 ` Drew Adams
[not found] ` <mailman.604.1226937124.26697.help-gnu-emacs@gnu.org>
2008-11-17 16:11 ` Richard Riley
2008-11-17 18:53 ` Drew Adams
2008-11-17 19:10 ` Richard Riley
2008-11-17 19:57 ` Drew Adams
2008-11-17 20:53 ` Eli Zaretskii
[not found] ` <mailman.621.1226951870.26697.help-gnu-emacs@gnu.org>
2008-11-17 21:42 ` Richard Riley
2008-11-18 0:55 ` Drew Adams
[not found] ` <mailman.641.1226969742.26697.help-gnu-emacs@gnu.org>
2008-11-18 1:08 ` Richard Riley
2008-11-18 2:55 ` Drew Adams
2008-11-17 23:37 ` Alan Mackenzie
2008-11-18 7:52 ` Paul R
2008-11-18 13:48 ` Alan Mackenzie
[not found] ` <mailman.543.1226877138.26697.help-gnu-emacs@gnu.org>
2008-11-16 23:35 ` Richard Riley
2008-11-16 22:45 ` Xah
[not found] ` <mailman.536.1226871605.26697.help-gnu-emacs@gnu.org>
2008-11-16 23:17 ` Xah
2008-11-17 20:39 ` Eli Zaretskii
2008-11-17 23:46 ` Alan Mackenzie
2008-11-18 0:31 ` Lennart Borgman
2008-11-18 9:32 ` Kevin Rodgers [this message]
2008-11-18 9:58 ` Alan Mackenzie
[not found] ` <mailman.633.1226964831.26697.help-gnu-emacs@gnu.org>
2008-11-18 9:46 ` Fabrice Niessen
[not found] ` <mailman.623.1226954396.26697.help-gnu-emacs@gnu.org>
2008-11-17 22:09 ` Xah
2008-11-18 2:33 ` B. T. Raven
2008-11-18 3:24 ` Xah
2008-11-18 4:58 ` B. T. Raven
2008-11-18 6:54 ` Richard Riley
2008-11-18 4:11 ` Eli Zaretskii
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='gfu22h$edr$1@ger.gmane.org' \
--to=kevin.d.rodgers@gmail.com \
--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.