Subject: bug#59795: closed (Re: bug#59795: 30.0.50; locate-user-emacs-file refer to relative path with --init-directory is passed as relative path)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 03 Dec 2022 10:26:02 +0000

Your bug report

#59795: 30.0.50; locate-user-emacs-file refer to relative path with --init-directory is passed as relative path

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59795: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59795
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59795: 30.0.50; locate-user-emacs-file refer to relative path with --init-directory is passed as relative path
From: Eli Zaretskii <[email-masked]>
To: Tommaso Rossi <[email-masked]>
Cc: [email-masked]
Date: Sat, 03 Dec 2022 12:25:11 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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" <[email-masked]>
> 
> 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.

Subject: 30.0.50; locate-user-emacs-file refer to relative path with --init-directory is passed as relative path
From: Tommaso Rossi <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Fri, 02 Dec 2022 12:47:43 +0000
List-Id: <debbugs-submit.debbugs.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?

Thanks,
Tommaso

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2022-11-30 built on xubuntu-new
Repository revision: 26c2ebd0ddcea2c64715dbb33b21e04e4e3dc136
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Ubuntu 22.04.1 LTS

Configured using:
'configure --with-cairo --with-modules --with-gnutls
--with-native-compilation --with-json --with-harfbuzz
--with-imagemagick --with-jpeg --with-png --with-rsvg --with-tiff'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ IMAGEMAGICK
JPEG JSON LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
value of $LC_MONETARY: it_IT.UTF-8
value of $LC_NUMERIC: it_IT.UTF-8
value of $LC_TIME: it_IT.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils comp comp-cstr
warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode
cl-loaddefs cl-lib bytecomp byte-compile rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 72312 10187)
(symbols 48 7132 0)
(strings 32 21167 3230)
(string-bytes 1 662685)
(vectors 16 17623)
(vector-slots 8 311090 14918)
(floats 8 39 37)
(intervals 56 224 0)
(buffers 984 11))