GNU bug report logs - #41242
Port feature/native-comp to Windows

Previous Next

Package: emacs;

Reported by: Nicolas Bértolo <nicolasbertolo <at> gmail.com>

Date: Wed, 13 May 2020 19:28:01 UTC

Severity: wishlist

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrea Corallo <akrl <at> sdf.org>
To: Nicolas Bértolo <nicolasbertolo <at> gmail.com>
Cc: 41242 <at> debbugs.gnu.org
Subject: bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir...
Date: Wed, 27 May 2020 21:02:45 +0000
[Message part 1 (text/plain, inline)]
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 <at> sdf.org
[0001-Determine-the-emacs-root-dir-only-when-necessary.patch (text/x-diff, attachment)]

This bug report was last modified 5 years and 41 days ago.

Previous Next


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