GNU bug report logs - #60929
30.0.50; [FR] `file-name-extension' and backup suffixes

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Wed, 18 Jan 2023 10:50:01 UTC

Severity: normal

Found in version 30.0.50

Full log


Message #41 received at 60929 <at> debbugs.gnu.org (full text, mbox):

From: Ruijie Yu <ruijie <at> netyu.xyz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 60929 <at> debbugs.gnu.org
Subject: Re: bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes
Date: Wed, 25 Jan 2023 21:33:59 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Ihor Radchenko <yantar92 <at> posteo.net>
>> Cc: 60929 <at> debbugs.gnu.org
>> Date: Wed, 25 Jan 2023 13:18:48 +0000
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >   . given "foo.org.~10~" return the list ("foo" org-mode backup)
>> >   . given "foo.org.gpg.gz" return ("foo" org-mode epa-file compress)
>>
>> I do not think that you can deterministically associate file extension
>> with major mode. Alternative major modes do exist for some file
>> extensions (like built-in python.el vs. python-mode.el). Just extension
>> list may suffice in the simplest scenarios.
>
> The intent was to use auto-mode-alist, of course.  Or are you saying
> that you'd like, for example, to treat *.org files as Org files even
> if the user customized auto-mode-alist to use a different mode?
>
>> In addition, given "foo.txt.org.gpg.gz" may return
>> ("foo.txt" "org" "gpg" "gz") not stripping the first .txt as it never
>> affects how Emacs opens the file.
>
> Talking about "opening the file" again narrows the scope of the
> requested feature, IMO.  We don't want to assume that the application
> would like to open the file.  Besides, Text mode does affect how Emacs
> treats the file.

Another thing to consider is when the mode is not activated via
`auto-mode-alist' -- for example, via M-x major-mode.  Consider what
happens to the proposed file extension list when "foo.txt" and
"bar.txt.bak.gpg" are manually activated as `org-mode'.

Best,


RY




This bug report was last modified 2 years and 142 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.