unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Philip K." <philip.kaludercic@fau.de>
To: 41619@debbugs.gnu.org
Subject: bug#41619: [PATCH] Mark python-shell-virtualenv-root as safe local variable
Date: Sat, 30 May 2020 22:31:09 +0200	[thread overview]
Message-ID: <87367htbaq.fsf@warpmail.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Mark-python-shell-virtualenv-root-as-safe-for-direct.patch --]
[-- Type: text/x-patch, Size: 844 bytes --]

From 31beb4931ae7800e719ac470ba8bd14a977f765c Mon Sep 17 00:00:00 2001
From: Philip K <philip@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


             reply	other threads:[~2020-05-30 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 20:31 Philip K. [this message]
2020-06-13  7:42 ` bug#41619: [PATCH] Mark python-shell-virtualenv-root as safe local variable Eli Zaretskii
2020-06-13 17:20   ` Glenn Morris
2020-06-15 18:53     ` Eli Zaretskii
2020-06-16 16:52       ` Philip K.
2020-06-16 17:18         ` Eli Zaretskii
2020-06-16 17:32           ` Philip K.
2020-06-16 17:54             ` Eli Zaretskii
2020-06-16 19:49               ` Philip K.
2020-06-20  8:47                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87367htbaq.fsf@warpmail.net \
    --to=philip.kaludercic@fau.de \
    --cc=41619@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).