emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msys2 build path problems + copy-paste english results in chinese ch


From: Óscar Fuentes
Subject: Re: msys2 build path problems + copy-paste english results in chinese characters
Date: Thu, 02 Dec 2021 16:40:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Óscar Fuentes <ofv@wanadoo.es>
>> Date: Thu, 02 Dec 2021 10:42:49 +0100
>> 
>> >> (let ((dir (file-name-directory (car command-line-args))))
>> >>   (setenv "PATH" (concat (getenv "PATH") path-separator dir))
>> >>   (setq exec-path (append exec-path (list dir))))
>> >
>> > Changing PATH from within Emacs is not recommended, it will bite you
>> > down the road when you least expect it.
>> 
>> I'm using that since many years ago without problems.
>
> Sheer luck.
>
>> If you know a better approach
>
> Yes, change PATH outside of Emacs.  Then live happily ever after.

That's precisely what I prefer to avoid.

>> and/or wish to describe a failure mode for the above code...
>
> One failure is that you put directories with forward slashes into the
> environment of the programs you invoke, and not all of them like that
> (although most do cope with that).

Maybe if an application parses PATH on a broken way. So far I found
none.

> Another problem is that after this, PATH used by Emacs and PATH used
> by sub-processes is different.

I don't know how this could be a problem, even less when emacs.exe lives
in the directory added to PATH.

> Yet another problem, specific to invoking MSYS2 commands, is that the
> directory might be incorrectly encoded (if it includes non-ASCII
> characters), since MSYS2 programs expect UTF-8 encoding AFAIK, whereas
> Emacs encodes it using the system codepage.

Well, adding directories containing MSYS2/Cygwin applications to PATH is
risky, something to avoid. Fortunately, on a MSYS2 setup MSYS2 and
mingw-w64 binaries are strictly separated.

> There might be other problems, I'm not sure I remember all of them.  I
> just learned long ago not to do that.

My experience says otherwise, and having to set up PATH so Emacs can
execute the applications installed on its same directory is not trivial
for inexperienced users and an annoyance for the rest. IMO
runemacs.exe/emacsclient.exe should add their directory to PATH before
invoking emacs.exe.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]