From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: msys2 build path problems + copy-paste english results in chinese characters Date: Thu, 02 Dec 2021 12:05:48 +0200 Message-ID: <83lf13pbib.fsf@gnu.org> References: <83a6hks26v.fsf@gnu.org> <83pmqgqi6e.fsf@gnu.org> <87czmghqui.fsf@telefonica.net> <834k7rqxru.fsf@gnu.org> <8735nbibqe.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13753"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?Q?=C3=93scar?= Fuentes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 02 11:08:23 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msj0p-0003Nf-8w for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Dec 2021 11:08:23 +0100 Original-Received: from localhost ([::1]:38384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msj0o-0003ap-9h for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Dec 2021 05:08:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msiyc-0001oZ-DE for emacs-devel@gnu.org; Thu, 02 Dec 2021 05:06:06 -0500 Original-Received: from [2001:470:142:3::e] (port=37266 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msiyZ-00021u-Kg; Thu, 02 Dec 2021 05:06:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XC844lJLDuN75Yt8H67nji2230JKrPeJAs6fdCs+VQA=; b=YU1mGb5g1G+vnU4B0D/1 I+jBwTX1ZSXHW6HVZ7iTT4kFv03sbUAyOiXaCqFIeYerph67iovNVyNT4r76D5+i9/4SIBV5C5ayy 0dWvhcIb0JiVXNCEJWh17N17dgSZqQXdoWRsBxiQwhBvYUphOLoGQJGHD6qLfi7mZDblyNVHT0a4b WcI2eZfGW0pRvZ39SpqVTHkQRkseeyzzC6cIk+CIV/mRILmlOxh1/YixHH35Kz1HnP5td0VWCZMAw 3ZaGJX97p7Wx6RKFsLwfAk6/X34IAVcRroZ1NyXm10I9pq21f7pWIwcaJRtLiWAccL6UiBUFiv3z+ nGSiXoKyTkyZSg==; Original-Received: from [87.69.77.57] (port=4372 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msiyZ-0006mE-4R; Thu, 02 Dec 2021 05:06:03 -0500 In-Reply-To: <8735nbibqe.fsf@telefonica.net> (message from =?utf-8?Q?=C3=93scar?= Fuentes on Thu, 02 Dec 2021 10:42:49 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280737 Archived-At: > From: Óscar Fuentes > 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. > 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). Another problem is that after this, PATH used by Emacs and PATH used by sub-processes is different. 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. There might be other problems, I'm not sure I remember all of them. I just learned long ago not to do that.