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: Stefan Monnier
Subject: Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist?
Date: Thu, 24 Sep 2009 20:38:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> ***************
> *** 1190,1197 ****
>                 (set (make-local-variable 'icomplete-with-completion-tables)
>                      (cons rbts-completion-table
>                            icomplete-with-completion-tables))))
> !       (read-buffer prompt (other-buffer (current-buffer))
> !                    (confirm-nonexistent-file-or-buffer)))))
  
>   (defun switch-to-buffer-other-window (buffer-or-name &optional norecord)
>     "Select the buffer specified by BUFFER-OR-NAME in another window.
> --- 1190,1202 ----
>                 (set (make-local-variable 'icomplete-with-completion-tables)
>                      (cons rbts-completion-table
>                            icomplete-with-completion-tables))))
> !       (let ((buffer (read-buffer prompt (other-buffer (current-buffer))
> !                              (confirm-nonexistent-file-or-buffer))))
> !     (unless (get-buffer buffer)
> !       (with-current-buffer (get-buffer-create buffer)
> !         (let ((buffer-file-name (buffer-name)))
> !           (normal-mode))))
> !     buffer))))
  
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.


        Stefan




reply via email to

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