[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41242: Port feature/native-comp to Windows - Determine the emacs roo
From: |
Andrea Corallo |
Subject: |
bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir... |
Date: |
Wed, 27 May 2020 21:02:45 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hi all,
I've attached the current Nico's patch in case someone wants to engage,
here some comments from me.
> * src/fileio.c: Introduce function emacs_root_dir(). Refactor
> `expand-file-name` to use it.
> * src/lisp.h: Separate emacs_root_dir() into dos_emacs_root_dir() and
> w32_emacs_root_dir().
> * src/msdos.c: Rename emacs_root_dir() to dos_emacs_root_dir().
> * src/w32.c: Rename emacs_root_dir() to w32_emacs_root_dir().
I think would be good to mention in the commit message/changelog the
reason of this change, why it wasn't working and why it is now.
> diff --git a/src/fileio.c b/src/fileio.c
> index 2f1d2f8243..e9be811841 100644
> --- a/src/fileio.c
> +++ b/src/fileio.c
> @@ -781,6 +781,18 @@ user_homedir (char const *name)
> return pw->pw_dir;
> }
>
> +static Lisp_Object
> +emacs_root_dir (void)
> +{
> +#ifdef DOS
> + return build_string (dos_emacs_root_dir ());
> +#elif defined (WINDOWSNT)
> + return build_string (w32_emacs_root_dir ());
> +#else
> + return build_string ("/");
> +#endif
> +}
I believe the indentation of these returns should be two regular spaces.
> DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0,
> doc: /* Convert filename NAME to absolute, and canonicalize it.
> Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
> @@ -851,21 +863,16 @@ the root directory. */)
> }
>
> /* As a last resort, we may have to use the root as
> - default_directory below. */
> - Lisp_Object root;
> -#ifdef DOS_NT
> - /* "/" is not considered a root directory on DOS_NT, so using it
> - as default_directory causes an infinite recursion in, e.g.,
> - the following:
> + default_directory below.
>
> - (let (default-directory)
> - (expand-file-name "a"))
> + "/" is not considered a root directory on DOS_NT, so using it
> + as default_directory causes an infinite recursion in, e.g.,
> + the following:
>
> - To avoid this, we use the root of the current drive. */
> - root = build_string (emacs_root_dir ());
> -#else
> - root = build_string ("/");
> -#endif
> + (let (default-directory)
> + (expand-file-name "a"))
> +
> + To avoid this, we use the root of the current drive. */
I suspect this commentary is not very ideal here given now the code has
been moved into emacs_root_dir, maybe the commentary should go there.
> /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
> if (NILP (default_directory))
> @@ -891,13 +898,13 @@ the root directory. */)
> Lisp_Object absdir
> = STRINGP (Vinvocation_directory)
> && file_name_absolute_no_tilde_p (Vinvocation_directory)
> - ? Vinvocation_directory : root;
> + ? Vinvocation_directory : emacs_root_dir ();
> default_directory = Fexpand_file_name (dir, absdir);
> }
> }
> }
Thanks
Andrea
--
akrl@sdf.org
0001-Determine-the-emacs-root-dir-only-when-necessary.patch
Description: Text Data
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., (continued)
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Nicolas Bértolo, 2020/05/23
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Andrea Corallo, 2020/05/24
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Nicolas Bértolo, 2020/05/24
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Andrea Corallo, 2020/05/24
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Nicolas Bértolo, 2020/05/24
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Andrea Corallo, 2020/05/25
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Nicolas Bértolo, 2020/05/25
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Andrea Corallo, 2020/05/25
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Andrea Corallo, 2020/05/25
- bug#41242: Port feature/native-comp to Windows - Improve handling of native compilation..., Nicolas Bértolo, 2020/05/25
bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir...,
Andrea Corallo <=
bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir..., Nicolas Bértolo, 2020/05/30
bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir..., Andrea Corallo, 2020/05/30