unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Francesco Potortì" <pot@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 53764@debbugs.gnu.org
Subject: bug#53764: 27.1; shouldn't ~/diary be in diary-mode?
Date: Wed, 09 Feb 2022 19:21:03 +0100	[thread overview]
Message-ID: <87zgmzaokw.fsf@tucano.isti.cnr.it> (raw)
In-Reply-To: <87mtj3vxeg.fsf@gnus.org> (larsi@gnus.org)

Francesco Potortì <pot@gnu.org> writes:
>>>Do we have a convenience function that says whether we have a match in
>>>auto-mode-alist?  `set-auto-mode--apply-alist' seems to be the closest I
>>>can find, and...  it's not that close.  :-/  But I guess it could be
>>>refactored out of there.
>>
>> This one seems to do the job:
>> (add-to-list 'auto-mode-alist
>> 	     (cons diary-file 'diary-mode)
>> 	     	   (lambda (a b) (equal (car a) (car b))))
>
>The user may have used a regexp like "diary$", "diary\\'", etc, so that
>doesn't work.

Sorry, I don't get it.  I am suggeting to add the name of the actual file (the one in diary-file) to the mode alist.  Looking for possible matches is a (small) optimisation. Why do we need a completely reliable matching code?

>>>We could move diary-file out of calendar.el and put it in...
>>>bindings.el or something, though?
>>
>> I would add it to the mode alist just after diary-file's defcustom
>
>As I said, that wouldn't help that much, because then you only get it
>added to auto-mode-alist after loading calendar.el (since there's where
>it's defined today).

In fact, both M-x diary and M-x appt-activate do load calendar, so it seems that any usage of diary, appointment or calendar functions would do the right thing, as long as the diary file is found after that.  Well, better than nothing, maybe.  In principle, after adding the hook, one could check whether any buffer is finding the diary file and change its mode...





  reply	other threads:[~2022-02-09 18:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 22:12 bug#53764: 27.1; shouldn't ~/diary be in diary-mode? Francesco Potortì
2022-02-05  6:54 ` Lars Ingebrigtsen
2022-02-05 15:02   ` Francesco Potortì
2022-02-05 21:54     ` Lars Ingebrigtsen
2022-02-05 23:11       ` Francesco Potortì
2022-02-06 23:07         ` Lars Ingebrigtsen
2022-02-07  0:39           ` Michael Heerdegen
2022-02-07  3:45             ` Lars Ingebrigtsen
2022-02-07  4:17               ` Michael Heerdegen
2022-02-07  8:25                 ` Lars Ingebrigtsen
2022-02-07 23:50                   ` Michael Heerdegen
2022-02-09 18:03                   ` Francesco Potortì
2022-02-07 19:39               ` Juri Linkov
2022-02-08  6:11                 ` Lars Ingebrigtsen
2022-02-08  7:39                   ` bug#53870: calendar-exit doesn't kill calendar buffers Juri Linkov
2022-02-09  8:32                     ` Lars Ingebrigtsen
2022-02-08  1:16             ` bug#53764: 27.1; shouldn't ~/diary be in diary-mode? Phil Sainty
2022-02-07  9:10           ` Francesco Potortì
2022-02-07  9:28             ` Lars Ingebrigtsen
2022-02-09 18:21               ` Francesco Potortì [this message]
2022-02-09 21:26                 ` Andreas Schwab
2022-02-09 21:52                   ` Francesco Potortì
2022-02-06  3:54       ` Michael Heerdegen
2022-02-07  5:08         ` Richard Stallman

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=87zgmzaokw.fsf@tucano.isti.cnr.it \
    --to=pot@gnu.org \
    --cc=53764@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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).