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 #8 received at 60929 <at> debbugs.gnu.org (full text, mbox):

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

> Hi,
>
> Would it be possible to make `file-name-sans-extension' strip extension
> upon removing backup suffixes (optionally)?
>
> Currently, Emacs' handling of backup extensions is a bit inconsistent:
>
> auto-mode-alist recognizes
>
>  ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
>  ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)
>
> as backup extension and thus opens files like foo.org.bak with Org mode.
>
> [...]
>
> It would be useful if functions like `file-name-extension',
> `file-name-sans-extension', and similar could optionally strip backup
> suffixes that contain ".".
> [...]

Note that since the backup extensions can be stripped recursively in
`auto-mode-alist' (that is, "test.c.bak.Bak.BAK.baK" is opened in c-mode
because of the recursive extension stripping), if this FR is to be
accepted, we would need to ensure that the above scenario is covered.

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.