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#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes Date: Mon, 23 Jan 2023 15:34:30 +0200 Message-ID: <83tu0hidcp.fsf@gnu.org> References: <87o7qw6rrz.fsf@localhost> <83y1q01031.fsf@gnu.org> <87v8l45740.fsf@localhost> <83ilh3293n.fsf@gnu.org> <878rht7eht.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5374"; mail-complaints-to="usenet@ciao.gmane.io" 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 Mon Jan 23 14:35:47 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 1pJwzC-0001Ea-OH for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Jan 2023 14:35:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJwym-0005Vd-9w; Mon, 23 Jan 2023 08:35:20 -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 1pJwyW-0005Q6-4B for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 08:35:04 -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 1pJwyV-0001v4-Rk for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 08:35:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJwyV-0000uA-Nt for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 08:35:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 13:35:03 +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.16744808693385 (code B ref 60929); Mon, 23 Jan 2023 13:35:03 +0000 Original-Received: (at 60929) by debbugs.gnu.org; 23 Jan 2023 13:34:29 +0000 Original-Received: from localhost ([127.0.0.1]:53667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJwxx-0000sX-4q for submit@debbugs.gnu.org; Mon, 23 Jan 2023 08:34:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJwxw-0000sK-1i for 60929@debbugs.gnu.org; Mon, 23 Jan 2023 08:34:28 -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 1pJwxq-0001cu-Q6; Mon, 23 Jan 2023 08:34:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uHB0ONW3V6aQnCdyUiZ3/n2MUvvHELOiyDf8xb05vks=; b=oUoIiAoTlV5e q7BoZV6z5whWdmfTClOLw4pVpLENHg7TWs85WGfwZzrMod3ru45wQHpeSfEX5vOr1pTO+GhnVvBfA 2FLzfGAi1uV76lw9+hzUQumfVD/5Sk6h1BjxIoQ10mxk63I7dVc6ES0d300afvLbDWug+xAcYH5u6 3dnjsmPO0aFKJDUeahGGhLveYTiODF8mm0/KEKDFkFZ/ZIZUKcx9kAOp3KkEnA6/ls8G0qtj/uxqh xQg/7wSFVMZaXuUvP/hrkfAMAyesPH6E5VBqa4liOkmkw3rcxVOJlQXm3eGmj61VlB9WCH2co+pcR Vz+tHkoK7uGDHaASDjEYqQ==; 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 1pJwxq-0001cc-63; Mon, 23 Jan 2023 08:34:22 -0500 In-Reply-To: <878rht7eht.fsf@localhost> (message from Ihor Radchenko on Mon, 23 Jan 2023 10:05:18 +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:253996 Archived-At: > From: Ihor Radchenko > Cc: 60929@debbugs.gnu.org > Date: Mon, 23 Jan 2023 10:05:18 +0000 > > So, let me formulate the FR more generally: > > 1. Emacs is currently able to work with double-extension files > transparently. Not only double-extension: you could have foo.org.bak.gpg, for example. The way we process entries in auto-mode-alist allows to "peel off" any number of extensions. > - For example, opening encrypted foo.ext.gpg files looks as if the > file foo.ext were opened - no special action is required on the user > side. > - Similarly, backup foo.ext.bak/foo.ext.~12~ file versions are opened > using the same rules (in auto-mode-alist) as foo.ext. Again, users > mostly get the same experience as if they simply opened foo.ext. > > 2. These double-extension functionality is, however, implemented on > ad-hoc basis with no clear common Elisp API provided. Elisp libraries > may need to re-implement handling of files foo.ext.extra specially, > even though, otherwise, the files are seen to the libraries as > foo.ext > > 3. It would be nice to have Elisp API to determine (1) "effective" file > name as seen to the user wrt editing functionality (foo.ext); (2) a > list of transformations Emacs applied to the file contents when > opening the file (decrypt, strip backup/version, tramp connection, > etc) What would you do with the "effective" file name obtained via such a hypothetical API? I'm asking because the answer might be relevant to defining the terms in which the API will return the information; a file name is just one possibility, not the only one. For example, if you want the file name so you could know the appropriate major mode, perhaps a better interface would be to give you a list of relevant major modes?