From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Managing environments (Python venv, guix environment, etc.) Date: Fri, 22 Jul 2016 16:19:38 -0400 Message-ID: References: <87y453sy0n.fsf@earth.catern.com> <87r3arripr.fsf@earth.catern.com> <874m7jygot.fsf@earth.catern.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1469218815 28775 80.91.229.3 (22 Jul 2016 20:20:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Jul 2016 20:20:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 22 22:20:06 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bQgvT-0006Sf-94 for ged-emacs-devel@m.gmane.org; Fri, 22 Jul 2016 22:20:03 +0200 Original-Received: from localhost ([::1]:49191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgvS-0007eI-J5 for ged-emacs-devel@m.gmane.org; Fri, 22 Jul 2016 16:20:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgvL-0007ds-JD for emacs-devel@gnu.org; Fri, 22 Jul 2016 16:19:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQgvI-0007IW-BZ for emacs-devel@gnu.org; Fri, 22 Jul 2016 16:19:55 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:36382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQgvI-0007IG-40 for emacs-devel@gnu.org; Fri, 22 Jul 2016 16:19:52 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bQgvD-0006Gj-Pz for emacs-devel@gnu.org; Fri, 22 Jul 2016 22:19:47 +0200 Original-Received: from 76-10-141-164.dsl.teksavvy.com ([76.10.141.164]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2016 22:19:47 +0200 Original-Received: from monnier by 76-10-141-164.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2016 22:19:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 76-10-141-164.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:c5CRhqLg53fADvVBzuVbOCsG3kI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206049 Archived-At: > (require 'cl-lib) > (require 'cl) Please don't require both. > (defvar environment-path-alist nil > "Alist of elements (PATH . ENV) for paths and special environments.") In the GNU project (and in Emacs in particular), we use PATH to mean "a list of directories" as in load-path, $PATH, $MANPATH. So this should probably be renamed to environment-directory-alist. > (defun environment-lookup-path (path) ^^^^ Same here. > The problem is that paths passed to find-file-name-handler, such as > default-directory, are not necessarily canonical paths. Yes, that's indeed a problem. In practice it tends to work OK, tho, because file and directory names to be constructed from each other, so even if there are many different ways to name a particular directory, there's typically only one that's used in a particular Emacs session. And in any case it'd be good to fix the cases where we end up using different names for the same dir (because they end up bumping into similar problems). > I don't think path resolution can be done with regular expressions, > so this approach will never really work. Feel free to use `advice-add' if you feel it's better. If/when the code gets integrated into Emacs, these kinds of problems can be resolved. > OK, I'll wait until John expresses his thoughts. (Possibly after the > release?) You might also contact the authors of python's virtualenv support (and anything else related) to get their opinions as supporting evidence for the benefits of your suggestion. Stefan