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

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Wed, 18 Jan 2023 10:50:01 UTC

Severity: normal

Found in version 30.0.50

Full log


Message #29 received at 60929 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60929 <at> debbugs.gnu.org
Subject: Re: bug#60929: 30.0.50; [FR] `file-name-extension' and backup suffixes
Date: Tue, 24 Jan 2023 11:12:56 +0000
Eli Zaretskii <eliz <at> 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>




This bug report was last modified 2 years and 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.