bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes


From: Ihor Radchenko
Subject: bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes
Date: Tue, 24 Jan 2023 11:12:56 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> 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.

The original need is deriving exported file name.

I can also imagine one trying to apply equivalent encryption or simply
file name suffix to the exported file:
  foo.org.gpg -> (exports to) foo.html.gpg
  foo.org.~10~ -> (exports to) foo.html.~10~
  foo.org.gpg -> (backed up to + auto-encrypted) foo.org.gpg~
  foo.org.gz  -> (exports to + auto-compressed) foo.html.gz

Hmm... If we go further into generalization, what I am talking about is
centralized API to "describe" current buffer file:

  1. What is already there:

     - `buffer-file-name'
     - `buffer-file-truename'
     - `buffer-file-number'

  2. What could be made available:

     - TRAMP mount point
     - `buffer-effective-name'
     - some info + callback to re-encrypt/re-archive/re-apply suffixes
       for a given file buffer onto another file buffer.

> 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?

I am not sure what you refer to here.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]