[Top][All Lists]
[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: |
Stefan Monnier |
Subject: |
Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist? |
Date: |
Fri, 25 Sep 2009 10:16:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
>> 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))))
That's also an alternative, yes.
So how 'bout the following:
- we (setq-default major-mode ..) along the lines of the above proposal.
- we get rid of the special case "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')."
- but we only do that for Emacs-24.
The reason why I want to delay it to Emacs-24, is because I'm worried
that it may introduce bugs in very rare corner cases which will only
show up after a long testing period.
Stefan
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, (continued)
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Deniz Dogan, 2009/09/22
- RE: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Drew Adams, 2009/09/22
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Kevin Rodgers, 2009/09/23
- RE: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Drew Adams, 2009/09/23
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Juri Linkov, 2009/09/24
- RE: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Drew Adams, 2009/09/24
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Stefan Monnier, 2009/09/24
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Juri Linkov, 2009/09/25
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?,
Stefan Monnier <=
- Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?, Juri Linkov, 2009/09/29