GNU bug report logs - #41619
[PATCH] Mark python-shell-virtualenv-root as safe local variable

Previous Next

Package: emacs;

Reported by: "Philip K." <philip.kaludercic <at> fau.de>

Date: Sat, 30 May 2020 20:32:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: "Philip K." <philip.kaludercic <at> fau.de>
Subject: bug#41619: closed (Re: bug#41619: [PATCH] Mark python-shell-virtualenv-root
 as safe local variable)
Date: Sat, 13 Jun 2020 07:44:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#41619: [PATCH] Mark python-shell-virtualenv-root as safe local variable

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 41619 <at> debbugs.gnu.org.

-- 
41619: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41619
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: "Philip K." <philip.kaludercic <at> fau.de>
Cc: 41619-done <at> debbugs.gnu.org
Subject: Re: bug#41619: [PATCH] Mark python-shell-virtualenv-root as safe local
 variable
Date: Sat, 13 Jun 2020 10:42:57 +0300
> From: "Philip K." <philip.kaludercic <at> fau.de>
> Date: Sat, 30 May 2020 22:31:09 +0200
> 
> I was trying to work with python today and it required me to use a
> virtual environment. I noticed that python-mode already had some basic
> virtualenv facilites, and it all worked. The only thing that annoyed me
> was that I couldn't configure the setup to be properly persistent, since
> python-shell-virtualenv-root couldn't be set as a directory local
> variable.
> 
> The commentary section mentions
> 
> > ;; (setq python-shell-virtualenv-root "/path/to/env/")
> 
> but I couldn't find any other details on how the mode expects me to set
> the variable.
> 
> Therefore I patched the few lines, and it works great.

Thanks, installed on the master branch.

In the future please accompany your changes with a ChangeLog-style
commit log entry; see CONTRIBUTE for the details.  (I added that for
you in this case.)

[Message part 3 (message/rfc822, inline)]
From: "Philip K." <philip.kaludercic <at> fau.de>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Mark python-shell-virtualenv-root as safe local variable
Date: Sat, 30 May 2020 22:31:09 +0200
[Message part 4 (text/plain, inline)]
Hi,

I was trying to work with python today and it required me to use a
virtual environment. I noticed that python-mode already had some basic
virtualenv facilites, and it all worked. The only thing that annoyed me
was that I couldn't configure the setup to be properly persistent, since
python-shell-virtualenv-root couldn't be set as a directory local
variable.

The commentary section mentions

> ;; (setq python-shell-virtualenv-root "/path/to/env/")

but I couldn't find any other details on how the mode expects me to set
the variable.

Therefore I patched the few lines, and it works great.

[0001-Mark-python-shell-virtualenv-root-as-safe-for-direct.patch (text/x-patch, inline)]
From 31beb4931ae7800e719ac470ba8bd14a977f765c Mon Sep 17 00:00:00 2001
From: Philip K <philip <at> warpmail.net>
Date: Sat, 30 May 2020 21:47:51 +0200
Subject: [PATCH] Mark python-shell-virtualenv-root as safe for directories

---
 lisp/progmodes/python.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 1ca9f01963..f9537b4079 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2090,7 +2090,8 @@ python-shell-virtualenv-root
 This variable, when set to a string, makes the environment to be
 modified such that shells are started within the specified
 virtualenv."
-  :type '(choice (const nil) string)
+  :type '(choice (const nil) directory)
+  :safe #'file-directory-p
   :group 'python)
 
 (defcustom python-shell-setup-codes nil
-- 
2.26.2


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

Previous Next


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