[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: Juri Linkov
Subject: Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?
Date: Wed, 30 Sep 2009 02:11:37 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

>> (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.

For a long testing period we could make this change now, and remove it
before releasing the next version.  How otherwise we can find all
corner cases.  For instance, using the the setting above exposed
one weird case: during visiting a tar archive it proposes to revert
the just visited archive file.  So visiting a file doesn't work correctly
with default modes besides the standard fundamental-mode.  The following
default value would be better:

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

Juri Linkov

reply via email to

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