From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes Date: Wed, 18 Jan 2023 19:08:36 +0800 Message-ID: References: <87o7qw6rrz.fsf@localhost> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10290"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 29.0.60 Cc: 60929@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 18 12:15:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pI6PY-0002Oh-SA for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Jan 2023 12:15:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI6PH-0004gm-UH; Wed, 18 Jan 2023 06:15:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI6PG-0004gW-E1 for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 06:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pI6PG-0007P8-3M for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 06:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pI6PF-0008Sj-KL for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 06:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jan 2023 11:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60929 X-GNU-PR-Package: emacs Original-Received: via spool by 60929-submit@debbugs.gnu.org id=B60929.167404049132498 (code B ref 60929); Wed, 18 Jan 2023 11:15:01 +0000 Original-Received: (at 60929) by debbugs.gnu.org; 18 Jan 2023 11:14:51 +0000 Original-Received: from localhost ([127.0.0.1]:39463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI6P4-0008S5-Vj for submit@debbugs.gnu.org; Wed, 18 Jan 2023 06:14:51 -0500 Original-Received: from netyu.xyz ([152.44.41.246]:49304 helo=mail.netyu.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI6P2-0008Rw-KB for 60929@debbugs.gnu.org; Wed, 18 Jan 2023 06:14:49 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id cb23116c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 18 Jan 2023 11:14:47 +0000 (UTC) In-reply-to: <87o7qw6rrz.fsf@localhost> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253619 Archived-At: Ihor Radchenko 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