GNU bug report logs -
#59795
30.0.50; locate-user-emacs-file refer to relative path with --init-directory is passed as relative path
Previous Next
Full log
View this message in rfc822 format
Thanks for your reply.
I think I didn't explained the problem very well, sorry for my english.
It is right that the init directory is interpreted relative to the
directory where Emacs is started, what feels a bit strange is that
when you change directory inside Emacs, the init directory becomes
relative to the current directory for the function
locate-user-emacs-file. I realized that when I found folders
named as my init directory spawned everywhere in my filesystem, for
example containing Transient (Magit) history or other files that should
be in the real init directory.
In Emacs Lisp code, it becomes difficult to locate the real init
directory, because the user-emacs-directory is not absolute: if some
library or package uses the locate-user-emacs-file function, like
Transient, than this "init directory spawned everywhere" problem will
raise.
Thanks,
Tommaso
------- Original Message -------
On Saturday, December 3rd, 2022 at 11:25, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Date: Fri, 02 Dec 2022 12:47:43 +0000
> > From: Tommaso Rossi via "Bug reports for GNU Emacs,
> > the Swiss army knife of text editors" bug-gnu-emacs <at> gnu.org
> >
> > When launching emacs with --init-directory option set to a relative path, I noticed that locate-user-emacs-file
> > refers to a relative path.
> > This means that every library that uses that function spawns files in visited directories instead that in the
> > init-directory.
> >
> > 1) Open shell in home (~)
> > 2) emacs -Q --init-directory .my-emacs.d
> > 3) C-x C-f ~/other-directory RET
> > 4) M-: (locate-user-emacs-file "some-file") RET
> >
> > result: ~/other-directory/.my-emacs.d/some-file
> > expected: ~/.my-emacs.d/some-file
> >
> > It happens both starting with -Q or not.
> > The problem does not happen when an absolute path is passed as --init-directory option argument.
> >
> > Perhaps the user-emacs-directory should be parsed as absolute path at startup?
>
>
> I made --init-directory=DIR be interpreted relative to the directory where
> Emacs is started.
>
> Thanks.
This bug report was last modified 2 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.