From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60930: 30.0.50; 24.3 Choosing File Modes section of Emacs manual does not explain dealing with backup files Date: Wed, 18 Jan 2023 16:06:17 +0200 Message-ID: <83lem00wfa.fsf@gnu.org> References: <87k01k6reb.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35245"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60930-done@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 15:08:02 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 1pI96g-0008uz-Fh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Jan 2023 15:08:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI95v-0008Su-5A; Wed, 18 Jan 2023 09:07:15 -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 1pI95l-0008RD-UZ for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 09:07:07 -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 1pI95k-0006gV-Rj for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 09:07:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pI95i-0003px-FM for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 09:07:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jan 2023 14:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 60930 X-GNU-PR-Package: emacs Mail-Followup-To: 60930@debbugs.gnu.org, eliz@gnu.org, yantar92@posteo.net Original-Received: via spool by 60930-done@debbugs.gnu.org id=D60930.167405077214679 (code D ref 60930); Wed, 18 Jan 2023 14:07:02 +0000 Original-Received: (at 60930-done) by debbugs.gnu.org; 18 Jan 2023 14:06:12 +0000 Original-Received: from localhost ([127.0.0.1]:39897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI94u-0003oh-4Q for submit@debbugs.gnu.org; Wed, 18 Jan 2023 09:06:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI94s-0003oU-80 for 60930-done@debbugs.gnu.org; Wed, 18 Jan 2023 09:06:11 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI94m-0006Uz-U1; Wed, 18 Jan 2023 09:06:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=/cbuDMJptDBMmcHWfJJP892gxh7yCi+ORx1QO367P1E=; b=aGwsEybJ6+tko3dw9w7l Q5FIl8B9TqFfbIlCFGxX3sy0GPRGEbj/p4EmtFegDAAKIipZhD7d/Z6rBqEjSGrDzr5mByykqGN48 jm5TUqUfpWxuXUVeWLlsuEQpy0EduNdujNxdANyF5/0q0TryXPxZc83yqt00hNCMbPSOMBGS/4aN6 6nSPhXuGpfg/Hk48U6fffBJDENb/v49XUg3qXDrpIohNEkBGkcCcRY2QdLOE6wt66SmkeoPHg5LMp GQFqKD141peZ/SHa1Q/bAv7I0uDb4LDh7Nux8C6U5u95Po9A2Ls/LP3ItTBW8Zrs7oDJL1KKma4yn Da03FVvXusulNw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pI94l-0003I8-Uu; Wed, 18 Jan 2023 09:06:04 -0500 In-Reply-To: <87k01k6reb.fsf@localhost> (message from Ihor Radchenko on Wed, 18 Jan 2023 10:58:20 +0000) 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:253635 Archived-At: > From: Ihor Radchenko > Date: Wed, 18 Jan 2023 10:58:20 +0000 > > Hi, > > The 24.3 Choosing File Modes section of Emacs manual explains how the > `auto-mode-alist' works, but fail to address an important point about > backup files being open in the major mode used for files with a name > stripped from the backup suffix: > > Fifth—if Emacs still hasn’t found a suitable major mode—it looks at > the file’s name. The correspondence between file names and major modes > is controlled by the variable ‘auto-mode-alist’. Its value is a list in > which each element has this form, > > > > I think that it is worth mentioning the backup file handling entry in > `auto-mode-alist' in the manual itself: > > ----------- > By default, `auto-mode-alist' contains: > > ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t) > ("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t) > > meaning that backup files (for example, foo.txt~, foo.txt~12, > foo.txt.orig, foo.txt.in, foo.txt.bak) will use major mode as for > foo.txt - the file with backup suffix stripped. > ----- > > WDYT? The feature of "recursive extension stripping" was already documented there. I added a few words about two examples of its usage (backup files aren't the only one, and I see no reason to treat them specially in this regard, let alone have the actual regexp in the manual). However, I sincerely doubt that having this described in that place will be discoverable enough. I also am not sure why you thought it was so important to mention: it's an obscure implementation detail intended to make Emacs DTRT, and as long it does TRT, why should users worry? But anyway, this is now in the manual for those who read the fine print.