[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .org.bak files are in Org mode -- intended?
From: |
Ihor Radchenko |
Subject: |
Re: .org.bak files are in Org mode -- intended? |
Date: |
Wed, 18 Jan 2023 10:51:51 +0000 |
Alain.Cochard@unistra.fr writes:
> I have noticed by chance that files with the .org.bak extension are in
> Org mode by default.
>
> If one does not pay attention, it can lead to mistakes.
>
> If it is really intended, why not mention it in the manual? (In 1.3,
> where it is said that "Files with the ‘.org’ extension use Org mode by
> default.")
>
> Are there other similar cases?
Any backup file is opened as if the file name did not contain the backup
suffix:
`auto-mode-alist' contains:
("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
("\\.\\(?:orig\\|in\\|[bB][aA][kK]\\)\\'" nil t)
meaning "if file name matches, strip the match and try determining major
mode again"
> Also, the names of files generated upon export, although making sense,
> cannot be anticipated: while 'foo.org' is latex exported as 'foo.tex'
> (as said in the manual), 'foo.org.bak' becomes 'foo.org.tex'.
I guess we could fix this.
Though, I'd prefer if Emacs provided basic functionality to strip backup
suffix: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60929
--
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>