From 761dd3400f5b879029787e4c8657fecbe864ea38 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Wed, 6 Nov 2019 17:52:15 -0600 Subject: [PATCH] Removed if, fixed windows regexp, and removed trailing slash --- settings.org | 63 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/settings.org b/settings.org index f616bf8..a535f06 100644 --- a/settings.org +++ b/settings.org @@ -459,38 +459,37 @@ put executables in elpy-rpc-venv in path (setq-local pyvenv-workon (emacs-default-venv))) ((let ((buffer-file-name (file-truename buffer-file-name))) ;; Don't change anything if entering a file in a python install's lib (ie for a file located with xref) - (if (string-match-p (rx bos (or - ;; Windows - (and letter "/" (one-or-more not-newline) - "/Lib") - ;; Rest of the sane world - (and (or - ;; In the home directory - (and (zero-or-more not-newline) - "/home/" (zero-or-more not-newline) - (or - ;; System python user installed package - "/.local" - ;; In a virtualenv - (and "/.virtualenvs/" (one-or-more (not (any "/")))) - ;; Elpy-rpc venv - (and "/.emacs.d/elpy/rpc-venv") - ;; Using Pyenv - (and "/.pyenv/versions/" - (one-or-more (not (any "/")))))) - ;; System python - (and (zero-or-more not-newline) - "/usr" - (opt "/local"))) - ;; Standard */lib/python3.7/ etc - (or - ;; Standard python - (and "/lib/python" (one-or-more (any digit "."))) - ;; PyPy - (and (or "/lib-python" "/lib_pypy"))))) - (zero-or-more not-newline) - "/" eos) - buffer-file-name))) + (string-match-p (rx bos (or + ;; Windows + (and letter ":/" (one-or-more not-newline) + "/Lib") + ;; Rest of the sane world + (and (or + ;; In the home directory + (and (zero-or-more not-newline) + "/home/" (zero-or-more not-newline) + (or + ;; System python user installed package + "/.local" + ;; In a virtualenv + (and "/.virtualenvs/" (one-or-more (not (any "/")))) + ;; Elpy-rpc venv + (and "/.emacs.d/elpy/rpc-venv") + ;; Using Pyenv + (and "/.pyenv/versions/" + (one-or-more (not (any "/")))))) + ;; System python + (and (zero-or-more not-newline) + "/usr" + (opt "/local"))) + ;; Standard */lib/python3.7/ etc + (or + ;; Standard python + (and "/lib/python" (one-or-more (any digit "."))) + ;; PyPy + (and (or "/lib-python" "/lib_pypy"))))) + (zero-or-more not-newline)) + buffer-file-name)) nil) (t ;; Upon failing all conditions, prompt to create virtual environment if it doesn't exist