unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 60929@debbugs.gnu.org
Subject: bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes
Date: Mon, 23 Jan 2023 15:34:30 +0200	[thread overview]
Message-ID: <83tu0hidcp.fsf@gnu.org> (raw)
In-Reply-To: <878rht7eht.fsf@localhost> (message from Ihor Radchenko on Mon, 23 Jan 2023 10:05:18 +0000)

> From: Ihor Radchenko <yantar92@posteo.net>
> 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?





  reply	other threads:[~2023-01-23 13:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 10:50 bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes Ihor Radchenko
2023-01-18 11:08 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-18 12:47 ` Eli Zaretskii
2023-01-18 13:01   ` Ihor Radchenko
2023-01-18 14:47     ` Eli Zaretskii
2023-01-23 10:05       ` Ihor Radchenko
2023-01-23 13:34         ` Eli Zaretskii [this message]
2023-01-24 11:12           ` Ihor Radchenko
2023-01-24 12:37             ` Eli Zaretskii
2023-01-25 13:18               ` Ihor Radchenko
2023-01-25 13:26                 ` Eli Zaretskii
2023-01-25 13:33                   ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-25 13:43                     ` Ihor Radchenko
2023-01-25 13:37                   ` Ihor Radchenko
2023-01-18 14:20   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83tu0hidcp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60929@debbugs.gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).