emacs-devel
[Top][All Lists]
Advanced

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

Re: new buffer - should its mode reflect its name when the name matches


From: Juri Linkov
Subject: Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?
Date: Fri, 25 Sep 2009 12:04:05 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

> I'm not opposed to such a change but I think it would need to come
> together with a cleanup of the "default-major-mode" thingy: currently,
> the major-mode of a buffer is either set (in set-buffer-major-mode) as
> (default-value 'major-mode) or (if that's nil) is inherited from the
> major-mode of the current-buffer (unless that major-mode has the
> `mode-class' property set to `special').
>
> In practice, for 99% of the users, (default-value 'major-mode) is
> fundamental-mode, so the rest is very rarely used, which can lead to
> corner-case bugs, of course.

Using (setq-default major-mode 'normal-mode) would be a good default.
Currently this runs into an infinite recursion.  However, the following
succeeds:

(setq-default major-mode
              (lambda () (let ((buffer-file-name (buffer-name)))
                           (set-auto-mode))))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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