unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 'Kevin Rodgers' <kevin.d.rodgers@gmail.com>,
	Drew Adams <drew.adams@oracle.com>,
	emacs-devel@gnu.org
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	[thread overview]
Message-ID: <878wfxtmmy.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvtyyrgljl.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 25 Sep 2009 10:16:28 -0400")

>> (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
          'fundamental-mode
        (let ((buffer-file-name (buffer-name)))
          (set-auto-mode)))))

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




      reply	other threads:[~2009-09-29 23:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22 14:31 new buffer - should its mode reflect its name when the name matches auto-mode-alist? Drew Adams
2009-09-22 14:47 ` Deniz Dogan
2009-09-22 15:07   ` Drew Adams
2009-09-23 20:50     ` Mathias Dahl
2009-09-24 21:07       ` Juri Linkov
2009-09-24  2:31     ` Kevin Rodgers
2009-09-24  3:14       ` Drew Adams
2009-09-24 21:32         ` Juri Linkov
2009-09-24 22:01           ` Drew Adams
2009-09-25  0:38           ` Stefan Monnier
2009-09-25  9:04             ` Juri Linkov
2009-09-25 14:16               ` Stefan Monnier
2009-09-29 23:11                 ` Juri Linkov [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878wfxtmmy.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=kevin.d.rodgers@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).