Install elpy

This commit is contained in:
Marcus Kammer 2019-12-01 12:41:02 +01:00
parent 98a93e73af
commit 9d93fa9702
25 changed files with 6353 additions and 3 deletions

View file

@ -81,8 +81,8 @@
'(package-enable-at-startup t)
'(package-selected-packages
(quote
(darkroom dockerfile-mode ein spacemacs-theme flucui-themes leuven-theme htmlize scss-mode berrys-theme web-mode elpy python-docstring sphinx-doc sphinx-frontend sphinx-mode ox-nikola racket-mode slime gherkin-mode powershell typescript-mode ob-http ob-ipython ob-restclient nord-theme restclient request restclient-test yaml-mode magit)))
'(python-shell-interpreter "python3" t)
(elpy darkroom dockerfile-mode ein spacemacs-theme flucui-themes leuven-theme htmlize scss-mode berrys-theme web-mode python-docstring sphinx-doc sphinx-frontend sphinx-mode ox-nikola racket-mode slime gherkin-mode powershell typescript-mode ob-http ob-ipython ob-restclient nord-theme restclient request restclient-test yaml-mode magit)))
'(python-shell-interpreter "python3")
'(register-preview-delay 2)
'(register-separator 43)
'(request-log-level (quote debug))

View file

@ -2002,7 +2002,7 @@
("Oleh Krehel" . "ohwoeowho@gmail.com"))
(:keywords "convenience"))])
(tramp .
[(2 4 2 4)
[(2 4 2 5)
((emacs
(24 4)))
"Transparent Remote Access, Multiple Protocol" tar

View file

@ -0,0 +1 @@
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-11-30T23:50:03+0100 using RSA

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,41 @@
;;; highlight-indentation-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "highlight-indentation" "highlight-indentation.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from highlight-indentation.el
(autoload 'highlight-indentation-mode "highlight-indentation" "\
Highlight indentation minor mode highlights indentation based on spaces
\(fn &optional ARG)" t nil)
(autoload 'highlight-indentation-set-offset "highlight-indentation" "\
Set indentation offset localy in buffer, will prevent
highlight-indentation from trying to guess indentation offset
from major mode
\(fn OFFSET)" t nil)
(autoload 'highlight-indentation-current-column-mode "highlight-indentation" "\
Hilight Indentation minor mode displays a vertical bar
corresponding to the indentation of the current line
\(fn &optional ARG)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "highlight-indentation" '("highlight-indentation-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; highlight-indentation-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "highlight-indentation" "20181204.839" "Minor modes for highlighting indentation" 'nil :commit "d03803f2c06749c430443a3d24e039cbafc9c58f" :authors '(("Anton Johansson" . "anton.johansson@gmail.com")) :maintainer '("Anton Johansson" . "anton.johansson@gmail.com") :url "https://github.com/antonj/Highlight-Indentation-for-Emacs")

View file

@ -0,0 +1,313 @@
;;; highlight-indentation.el --- Minor modes for highlighting indentation
;; Author: Anton Johansson <anton.johansson@gmail.com> - http://antonj.se
;; Created: Dec 15 23:42:04 2010
;; Version: 0.7.0
;; Package-Version: 20181204.839
;; URL: https://github.com/antonj/Highlight-Indentation-for-Emacs
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be
;; useful, but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE. See the GNU General Public License for more details.
;;
;;; Commentary:
;; Customize `highlight-indentation-face', and
;; `highlight-indentation-current-column-face' to suit your theme.
;;; Code:
(defgroup highlight-indentation nil
"Highlight Indentation"
:prefix "highlight-indentation-"
:group 'basic-faces)
(defface highlight-indentation-face
;; Fringe has non intrusive color in most color-themes
'((t :inherit fringe))
"Basic face for highlighting indentation guides."
:group 'highlight-indentation)
(defcustom highlight-indentation-offset
(if (and (boundp 'standard-indent) standard-indent) standard-indent 2)
"Default indentation offset, used if no other can be found from
major mode. This value is always used by
`highlight-indentation-mode' if set buffer local. Set buffer
local with `highlight-indentation-set-offset'"
:type 'integer
:group 'highlight-indentation)
(defcustom highlight-indentation-blank-lines nil
"Show indentation guides on blank lines. Experimental.
Known issues:
- Doesn't work well with completion popups that use overlays
- Overlays on blank lines sometimes aren't cleaned up or updated perfectly
Can be refershed by scrolling
- Not yet implemented for highlight-indentation-current-column-mode
- May not work perfectly near the bottom of the screen
- Point appears after indent guides on blank lines"
:group 'highlight-indentation)
(defvar highlight-indentation-overlay-priority 1)
(defvar highlight-indentation-current-column-overlay-priority 2)
(defconst highlight-indentation-hooks
'((after-change-functions (lambda (start end length)
(highlight-indentation-redraw-region
start end
'highlight-indentation-overlay
'highlight-indentation-put-overlays-region))
t t)
(window-scroll-functions (lambda (win start)
(highlight-indentation-redraw-window
win
'highlight-indentation-overlay
'highlight-indentation-put-overlays-region
start))
nil t)))
(defun highlight-indentation-get-buffer-windows (&optional all-frames)
"Return a list of windows displaying the current buffer."
(get-buffer-window-list (current-buffer) 'no-minibuf all-frames))
(defun highlight-indentation-delete-overlays-buffer (overlay)
"Delete all overlays in the current buffer."
(save-restriction
(widen)
(highlight-indentation-delete-overlays-region (point-min) (point-max) overlay)))
(defun highlight-indentation-delete-overlays-region (start end overlay)
"Delete overlays between START and END."
(mapc #'(lambda (o)
(if (overlay-get o overlay) (delete-overlay o)))
(overlays-in start end)))
(defun highlight-indentation-redraw-window (win overlay func &optional start)
"Redraw win starting from START."
(highlight-indentation-redraw-region (or start (window-start win)) (window-end win t) overlay func))
(defun highlight-indentation-redraw-region (start end overlay func)
"Erease and read overlays between START and END."
(save-match-data
(save-excursion
(let ((inhibit-point-motion-hooks t)
(start (save-excursion (goto-char start) (beginning-of-line) (point)))
(end (save-excursion (goto-char end) (line-beginning-position 2))))
(highlight-indentation-delete-overlays-region start end overlay)
(funcall func start end overlay)))))
(defun highlight-indentation-redraw-all-windows (overlay func &optional all-frames)
"Redraw the all windows showing the current buffer."
(dolist (win (highlight-indentation-get-buffer-windows all-frames))
(highlight-indentation-redraw-window win overlay func)))
(defun highlight-indentation-put-overlays-region (start end overlay)
"Place overlays between START and END."
(goto-char end)
(let (o ;; overlay
(last-indent 0)
(last-char 0)
(pos (point))
(loop t))
(while (and loop
(>= pos start))
(save-excursion
(beginning-of-line)
(let ((c 0)
(cur-column (current-column)))
(while (and (setq c (char-after))
(integerp c)
(not (= 10 c)) ;; newline
(= 32 c)) ;; space
(when (= 0 (% cur-column highlight-indentation-offset))
(let ((p (point)))
(setq o (make-overlay p (+ p 1))))
(overlay-put o overlay t)
(overlay-put o 'priority highlight-indentation-overlay-priority)
(overlay-put o 'face 'highlight-indentation-face))
(forward-char)
(setq cur-column (current-column)))
(when (and highlight-indentation-blank-lines
(integerp c)
(or (= 10 c)
(= 13 c)))
(when (< cur-column last-indent)
(let ((column cur-column)
(s nil)
(show t)
num-spaces)
(while (< column last-indent)
(if (>= 0
(setq num-spaces
(%
(- last-indent column)
highlight-indentation-offset)))
(progn
(setq num-spaces (1- highlight-indentation-offset))
(setq show t))
(setq show nil))
(setq s (cons (concat
(if show
(propertize " "
'face
'highlight-indentation-face)
"")
(make-string num-spaces 32))
s))
(setq column (+ column num-spaces (if show 1 0))))
(setq s (apply 'concat (reverse s)))
(let ((p (point)))
(setq o (make-overlay p p)))
(overlay-put o overlay t)
(overlay-put o 'priority highlight-indentation-overlay-priority)
(overlay-put o 'after-string s))
(setq cur-column last-indent)))
(setq last-indent (* highlight-indentation-offset
(ceiling (/ (float cur-column)
highlight-indentation-offset))))))
(when (= pos start)
(setq loop nil))
(forward-line -1) ;; previous line
(setq pos (point)))))
(defun highlight-indentation-guess-offset ()
"Get indentation offset of current buffer."
(cond ((and (eq major-mode 'python-mode) (boundp 'python-indent))
python-indent)
((and (eq major-mode 'python-mode) (boundp 'py-indent-offset))
py-indent-offset)
((and (eq major-mode 'python-mode) (boundp 'python-indent-offset))
python-indent-offset)
((and (eq major-mode 'ruby-mode) (boundp 'ruby-indent-level))
ruby-indent-level)
((and (eq major-mode 'scala-mode) (boundp 'scala-indent:step))
scala-indent:step)
((and (eq major-mode 'scala-mode) (boundp 'scala-mode-indent:step))
scala-mode-indent:step)
((and (or (eq major-mode 'scss-mode) (eq major-mode 'css-mode)) (boundp 'css-indent-offset))
css-indent-offset)
((and (eq major-mode 'nxml-mode) (boundp 'nxml-child-indent))
nxml-child-indent)
((and (eq major-mode 'coffee-mode) (boundp 'coffee-tab-width))
coffee-tab-width)
((and (eq major-mode 'js-mode) (boundp 'js-indent-level))
js-indent-level)
((and (eq major-mode 'js2-mode) (boundp 'js2-basic-offset))
js2-basic-offset)
((and (fboundp 'derived-mode-class) (eq (derived-mode-class major-mode) 'sws-mode) (boundp 'sws-tab-width))
sws-tab-width)
((and (eq major-mode 'web-mode) (boundp 'web-mode-markup-indent-offset))
web-mode-markup-indent-offset) ; other similar vars: web-mode-{css-indent,scripts}-offset
((and (eq major-mode 'web-mode) (boundp 'web-mode-html-offset)) ; old var
web-mode-html-offset)
((and (local-variable-p 'c-basic-offset) (boundp 'c-basic-offset))
c-basic-offset)
((and (eq major-mode 'yaml-mode) (boundp 'yaml-indent-offset))
yaml-indent-offset)
((and (eq major-mode 'elixir-mode) (boundp 'elixir-smie-indent-basic))
elixir-smie-indent-basic)
(t
(default-value 'highlight-indentation-offset))))
;;;###autoload
(define-minor-mode highlight-indentation-mode
"Highlight indentation minor mode highlights indentation based on spaces"
:lighter " ||"
(when (not highlight-indentation-mode) ;; OFF
(highlight-indentation-delete-overlays-buffer 'highlight-indentation-overlay)
(dolist (hook highlight-indentation-hooks)
(remove-hook (car hook) (nth 1 hook) (nth 3 hook))))
(when highlight-indentation-mode ;; ON
(when (not (local-variable-p 'highlight-indentation-offset))
(set (make-local-variable 'highlight-indentation-offset)
(highlight-indentation-guess-offset)))
;; Setup hooks
(dolist (hook highlight-indentation-hooks)
(apply 'add-hook hook))
(highlight-indentation-redraw-all-windows 'highlight-indentation-overlay
'highlight-indentation-put-overlays-region)))
;;;###autoload
(defun highlight-indentation-set-offset (offset)
"Set indentation offset localy in buffer, will prevent
highlight-indentation from trying to guess indentation offset
from major mode"
(interactive
(if (and current-prefix-arg (not (consp current-prefix-arg)))
(list (prefix-numeric-value current-prefix-arg))
(list (read-number "Indentation offset: "))))
(set (make-local-variable 'highlight-indentation-offset) offset)
(when highlight-indentation-mode
(highlight-indentation-mode)))
;;; This minor mode will highlight the indentation of the current line
;;; as a vertical bar (grey background color) aligned with the column of the
;;; first character of the current line.
(defface highlight-indentation-current-column-face
;; Fringe has non intrusive color in most color-themes
'((t (:background "black")))
"Basic face for highlighting indentation guides."
:group 'highlight-indentation)
(defconst highlight-indentation-current-column-hooks
'((post-command-hook (lambda ()
(highlight-indentation-redraw-all-windows 'highlight-indentation-current-column-overlay
'highlight-indentation-current-column-put-overlays-region)) nil t)))
(defun highlight-indentation-current-column-put-overlays-region (start end overlay)
"Place overlays between START and END."
(let (o ;; overlay
(last-indent 0)
(indent (save-excursion (back-to-indentation) (current-column)))
(pos start))
(goto-char start)
;; (message "doing it %d" indent)
(while (< pos end)
(beginning-of-line)
(while (and (integerp (char-after))
(not (= 10 (char-after))) ;; newline
(= 32 (char-after))) ;; space
(when (= (current-column) indent)
(setq pos (point)
last-indent pos
o (make-overlay pos (+ pos 1)))
(overlay-put o overlay t)
(overlay-put o 'priority highlight-indentation-current-column-overlay-priority)
(overlay-put o 'face 'highlight-indentation-current-column-face))
(forward-char))
(forward-line) ;; Next line
(setq pos (point)))))
;;;###autoload
(define-minor-mode highlight-indentation-current-column-mode
"Hilight Indentation minor mode displays a vertical bar
corresponding to the indentation of the current line"
:lighter " |"
(when (not highlight-indentation-current-column-mode) ;; OFF
(highlight-indentation-delete-overlays-buffer 'highlight-indentation-current-column-overlay)
(dolist (hook highlight-indentation-current-column-hooks)
(remove-hook (car hook) (nth 1 hook) (nth 3 hook))))
(when highlight-indentation-current-column-mode ;; ON
(when (not (local-variable-p 'highlight-indentation-offset))
(set (make-local-variable 'highlight-indentation-offset)
(highlight-indentation-guess-offset)))
;; Setup hooks
(dolist (hook highlight-indentation-current-column-hooks)
(apply 'add-hook hook))
(highlight-indentation-redraw-all-windows 'highlight-indentation-current-column-overlay
'highlight-indentation-current-column-put-overlays-region)))
(provide 'highlight-indentation)
;;; highlight-indentation.el ends here

View file

@ -0,0 +1,82 @@
;;; pyvenv-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "pyvenv" "pyvenv.el" (0 0 0 0))
;;; Generated autoloads from pyvenv.el
(autoload 'pyvenv-activate "pyvenv" "\
Activate the virtual environment in DIRECTORY.
\(fn DIRECTORY)" t nil)
(autoload 'pyvenv-deactivate "pyvenv" "\
Deactivate any current virtual environment.
\(fn)" t nil)
(autoload 'pyvenv-workon "pyvenv" "\
Activate a virtual environment from $WORKON_HOME.
If the virtual environment NAME is already active, this function
does not try to reactivate the environment.
\(fn NAME)" t nil)
(defvar pyvenv-mode nil "\
Non-nil if Pyvenv mode is enabled.
See the `pyvenv-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `pyvenv-mode'.")
(custom-autoload 'pyvenv-mode "pyvenv" nil)
(autoload 'pyvenv-mode "pyvenv" "\
Global minor mode for pyvenv.
Will show the current virtualenv in the mode line, and respect a
`pyvenv-workon' setting in files.
\(fn &optional ARG)" t nil)
(defvar pyvenv-tracking-mode nil "\
Non-nil if Pyvenv-Tracking mode is enabled.
See the `pyvenv-tracking-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `pyvenv-tracking-mode'.")
(custom-autoload 'pyvenv-tracking-mode "pyvenv" nil)
(autoload 'pyvenv-tracking-mode "pyvenv" "\
Global minor mode to track the current virtualenv.
When this mode is active, pyvenv will activate a buffer-specific
virtualenv whenever the user switches to a buffer with a
buffer-local `pyvenv-workon' or `pyvenv-activate' variable.
\(fn &optional ARG)" t nil)
(autoload 'pyvenv-restart-python "pyvenv" "\
Restart Python inferior processes.
\(fn)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "pyvenv" '("pyvenv-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; pyvenv-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "pyvenv" "20191006.1304" "Python virtual environment interface" 'nil :commit "103d2f158ef2a760741682e18741e44107c68f3f" :keywords '("python" "virtualenv" "tools") :authors '(("Jorgen Schaefer" . "contact@jorgenschaefer.de")) :maintainer '("Jorgen Schaefer" . "contact@jorgenschaefer.de") :url "http://github.com/jorgenschaefer/pyvenv")

View file

@ -0,0 +1,556 @@
;;; pyvenv.el --- Python virtual environment interface -*- lexical-binding: t -*-
;; Copyright (C) 2013-2017 Jorgen Schaefer <contact@jorgenschaefer.de>
;; Author: Jorgen Schaefer <contact@jorgenschaefer.de>
;; URL: http://github.com/jorgenschaefer/pyvenv
;; Package-Version: 20191006.1304
;; Version: 1.21
;; Keywords: Python, Virtualenv, Tools
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a simple global minor mode which will replicate the changes
;; done by virtualenv activation inside Emacs.
;; The main entry points are `pyvenv-activate', which queries the user
;; for a virtual environment directory to activate, and
;; `pyvenv-workon', which queries for a virtual environment in
;; $WORKON_HOME (from virtualenvwrapper.sh).
;; If you want your inferior Python processes to be restarted
;; automatically when you switch your virtual environment, add
;; `pyvenv-restart-python' to `pyvenv-post-activate-hooks'.
;;; Code:
(require 'eshell)
(require 'json)
;; User customization
(defgroup pyvenv nil
"Python Virtual Environment Interface."
:prefix "pyvenv-"
:group 'languages)
(defcustom pyvenv-workon nil
"The intended virtualenv in the virtualenvwrapper directory.
This is rarely useful to set globally. Rather, set this in file-
or directory-local variables using \\[add-file-local-variable] or
\\[add-dir-local-variable].
When `pyvenv-mode' is enabled, pyvenv will switch to this
virtualenv. If a virtualenv is already enabled, it will ask first."
:type 'pyvenv-workon
:safe #'stringp
:group 'pyvenv)
(defcustom pyvenv-activate nil
"The intended virtualenv directory.
This is rarely useful to set globally. Rather, set this in file-
or directory-local variables using \\[add-file-local-variable] or
\\[add-dir-local-variable].
When `pyvenv-mode' is enabled, pyvenv will switch to this
virtualenv. If a virtualenv is already enabled, it will ask first."
:type 'directory
:safe #'stringp
:group 'pyvenv)
(defcustom pyvenv-tracking-ask-before-change nil
"Non-nil means pyvenv will ask before automatically changing a virtualenv.
This can happen when a new file is opened with a buffer-local
value (from file-local or directory-local variables) for
`pyvenv-workon' or `pyvenv-workon', or if `pyvenv-tracking-mode'
is active, after every command."
:type 'boolean
:group 'pyvenv)
(defcustom pyvenv-virtualenvwrapper-python
(or (getenv "VIRTUALENVWRAPPER_PYTHON")
(executable-find "python")
(executable-find "py")
(executable-find "pythonw")
"python")
"The python process which has access to the virtualenvwrapper module.
This should be $VIRTUALENVWRAPPER_PYTHON outside of Emacs, but
virtualenvwrapper.sh does not export that variable. We make an
educated guess, but that can be off."
:type '(file :must-match t)
:safe #'file-directory-p
:group 'pyvenv)
(defcustom pyvenv-exec-shell
(or (executable-find "bash")
(executable-find "sh")
shell-file-name)
"The path to a POSIX compliant shell to use for running
virtualenv hooks. Useful if you use a non-POSIX shell (e.g.
fish)."
:type '(file :must-match t)
:group 'pyvenv)
;; API for other libraries
(defvar pyvenv-virtual-env nil
"The current virtual environment.
Do not set this variable directly; use `pyvenv-activate' or
`pyvenv-workon'.")
(defvar pyvenv-virtual-env-name nil
"The name of the current virtual environment.
This is usually the base name of `pyvenv-virtual-env'.")
(defvar pyvenv-pre-create-hooks nil
"Hooks run before a virtual environment is created.")
(defvar pyvenv-post-create-hooks nil
"Hooks run after a virtual environment is created.")
(defvar pyvenv-pre-activate-hooks nil
"Hooks run before a virtual environment is activated.
`pyvenv-virtual-env' is already set.")
(defvar pyvenv-post-activate-hooks nil
"Hooks run after a virtual environment is activated.
`pyvenv-virtual-env' is set.")
(defvar pyvenv-pre-deactivate-hooks nil
"Hooks run before a virtual environment is deactivated.
`pyvenv-virtual-env' is set.")
(defvar pyvenv-post-deactivate-hooks nil
"Hooks run after a virtual environment is deactivated.
`pyvenv-virtual-env' is still set.")
(defvar pyvenv-mode-line-indicator '(pyvenv-virtual-env-name
("[" pyvenv-virtual-env-name "] "))
"How `pyvenv-mode' will indicate the current environment in the mode line.")
;; Internal code.
(defvar pyvenv-old-process-environment nil
"The old process environment before the last activate.")
(defvar pyvenv-old-exec-path nil
"The old exec path before the last activate.")
(defvar pyvenv-old-eshell-path nil
"The old eshell path before the last activate.")
(defun pyvenv-create (venv-name python-executable)
"Create virtualenv. VENV-NAME PYTHON-EXECUTABLE."
(interactive (list
(read-from-minibuffer "Name of virtual environment: ")
(read-file-name "Python interpreter to use: "
(file-name-directory (executable-find "python"))
nil nil "python")))
(let ((venv-dir (concat (file-name-as-directory (pyvenv-workon-home))
venv-name)))
(unless (file-exists-p venv-dir)
(run-hooks 'pyvenv-pre-create-hooks)
(cond
((executable-find "virtualenv")
(with-current-buffer (generate-new-buffer "*virtualenv*")
(call-process "virtualenv" nil t t
"-p" python-executable venv-dir)
(display-buffer (current-buffer))))
((= 0 (call-process python-executable nil nil nil
"-m" "venv" "-h"))
(with-current-buffer (generate-new-buffer "*venv*")
(call-process python-executable nil t t
"-m" "venv" venv-dir)
(display-buffer (current-buffer))))
(t
(error "Pyvenv necessitates the 'virtualenv' python package")))
(run-hooks 'pyvenv-post-create-hooks))
(pyvenv-activate venv-dir)))
;;;###autoload
(defun pyvenv-activate (directory)
"Activate the virtual environment in DIRECTORY."
(interactive "DActivate venv: ")
(setq directory (expand-file-name directory))
(pyvenv-deactivate)
(setq pyvenv-virtual-env (file-name-as-directory directory)
pyvenv-virtual-env-name (file-name-nondirectory
(directory-file-name directory))
python-shell-virtualenv-path directory
python-shell-virtualenv-root directory)
;; Set venv name as parent directory for generic directories
(when (member pyvenv-virtual-env-name '("venv" ".venv"))
(setq pyvenv-virtual-env-name
(file-name-nondirectory
(directory-file-name
(file-name-directory
(directory-file-name directory))))))
;; Preserve variables from being overwritten.
(let ((old-exec-path exec-path)
(old-eshell-path eshell-path-env)
(old-process-environment process-environment))
(unwind-protect
(pyvenv-run-virtualenvwrapper-hook "pre_activate" pyvenv-virtual-env)
(setq exec-path old-exec-path
eshell-path-env old-eshell-path
process-environment old-process-environment)))
(run-hooks 'pyvenv-pre-activate-hooks)
(let ((new-directories (append
;; Unix
(when (file-exists-p (format "%s/bin" directory))
(list (format "%s/bin" directory)))
;; Windows
(when (file-exists-p (format "%s/Scripts" directory))
(list (format "%s/Scripts" directory)
;; Apparently, some virtualenv
;; versions on windows put the
;; python.exe in the virtualenv root
;; for some reason?
directory)))))
(setq pyvenv-old-exec-path exec-path
pyvenv-old-eshell-path eshell-path-env
pyvenv-old-process-environment process-environment
;; For some reason, Emacs adds some directories to `exec-path'
;; but not to `process-environment'?
exec-path (append new-directories exec-path)
;; set eshell path to same as exec-path
eshell-path-env (mapconcat 'identity exec-path ":")
process-environment (append
(list
(format "VIRTUAL_ENV=%s" directory)
(format "PATH=%s"
(mapconcat 'identity
(append new-directories
(split-string (getenv "PATH")
path-separator))
path-separator))
;; No "=" means to unset
"PYTHONHOME")
process-environment)
))
(pyvenv-run-virtualenvwrapper-hook "post_activate")
(run-hooks 'pyvenv-post-activate-hooks))
;;;###autoload
(defun pyvenv-deactivate ()
"Deactivate any current virtual environment."
(interactive)
(when pyvenv-virtual-env
(pyvenv-run-virtualenvwrapper-hook "pre_deactivate")
(run-hooks 'pyvenv-pre-deactivate-hooks))
(when pyvenv-old-process-environment
(setq process-environment pyvenv-old-process-environment
pyvenv-old-process-environment nil))
(when pyvenv-old-exec-path
(setq exec-path pyvenv-old-exec-path
pyvenv-old-exec-path nil))
(when pyvenv-old-eshell-path
(setq eshell-path-env pyvenv-old-eshell-path
pyvenv-old-eshell-path nil))
(when pyvenv-virtual-env
;; Make sure this does not change `exec-path', as $PATH is
;; different
(let ((old-exec-path exec-path)
(old-eshell-path eshell-path-env)
(old-process-environment process-environment))
(unwind-protect
(pyvenv-run-virtualenvwrapper-hook "post_deactivate"
pyvenv-virtual-env)
(setq exec-path old-exec-path
eshell-path-env old-eshell-path
process-environment old-process-environment)))
(run-hooks 'pyvenv-post-deactivate-hooks))
(setq pyvenv-virtual-env nil
pyvenv-virtual-env-name nil
python-shell-virtualenv-root nil
python-shell-virtualenv-path nil))
(defvar pyvenv-workon-history nil
"Prompt history for `pyvenv-workon'.")
;;;###autoload
(defun pyvenv-workon (name)
"Activate a virtual environment from $WORKON_HOME.
If the virtual environment NAME is already active, this function
does not try to reactivate the environment."
(interactive
(list
(completing-read "Work on: " (pyvenv-virtualenv-list)
nil t nil 'pyvenv-workon-history nil nil)))
(unless (member name (list "" nil pyvenv-virtual-env-name))
(pyvenv-activate (format "%s/%s"
(pyvenv-workon-home)
name))))
(defun pyvenv-virtualenv-list (&optional noerror)
"Prompt the user for a name in $WORKON_HOME.
If NOERROR is set, do not raise an error if WORKON_HOME is not
configured."
(let ((workon-home (pyvenv-workon-home))
(result nil))
(if (not (file-directory-p workon-home))
(when (not noerror)
(error "Can't find a workon home directory, set $WORKON_HOME"))
(dolist (name (directory-files workon-home))
(when (or (file-exists-p (format "%s/%s/bin/activate"
workon-home name))
(file-exists-p (format "%s/%s/bin/python"
workon-home name))
(file-exists-p (format "%s/%s/Scripts/activate.bat"
workon-home name))
(file-exists-p (format "%s/%s/python.exe"
workon-home name)))
(setq result (cons name result))))
(sort result (lambda (a b)
(string-lessp (downcase a)
(downcase b)))))))
(define-widget 'pyvenv-workon 'choice
"Select an available virtualenv from virtualenvwrapper."
:convert-widget
(lambda (widget)
(setq widget (widget-copy widget))
(widget-put widget
:args (cons '(const :tag "None" nil)
(mapcar (lambda (env)
(list 'const env))
(pyvenv-virtualenv-list t))))
(widget-types-convert-widget widget))
:prompt-value (lambda (widget prompt value unbound)
(let ((name (completing-read
prompt
(cons "None"
(pyvenv-virtualenv-list t))
nil t)))
(if (equal name "None")
nil
name))))
(defvar pyvenv-mode-map (make-sparse-keymap)
"The mode keymap for `pyvenv-mode'.")
(easy-menu-define pyvenv-menu pyvenv-mode-map
"Pyvenv Menu"
'("Virtual Envs"
:visible pyvenv-mode
("Workon"
:help "Activate a virtualenvwrapper environment"
:filter (lambda (&optional ignored)
(mapcar (lambda (venv)
(vector venv `(pyvenv-workon ,venv)
:style 'radio
:selected `(equal pyvenv-virtual-env-name
,venv)))
(pyvenv-virtualenv-list t))))
["Activate" pyvenv-activate
:help "Activate a virtual environment by directory"]
["Deactivate" pyvenv-deactivate
:help "Deactivate the current virtual environment"
:active pyvenv-virtual-env
:suffix pyvenv-virtual-env-name]
["Restart Python Processes" pyvenv-restart-python
:help "Restart all Python processes to use the current environment"]))
;;;###autoload
(define-minor-mode pyvenv-mode
"Global minor mode for pyvenv.
Will show the current virtualenv in the mode line, and respect a
`pyvenv-workon' setting in files."
:global t
(cond
(pyvenv-mode
(add-to-list 'mode-line-misc-info '(pyvenv-mode pyvenv-mode-line-indicator))
(add-hook 'hack-local-variables-hook #'pyvenv-track-virtualenv))
((not pyvenv-mode)
(setq mode-line-misc-info (delete '(pyvenv-mode pyvenv-mode-line-indicator)
mode-line-misc-info))
(remove-hook 'hack-local-variables-hook #'pyvenv-track-virtualenv))))
;;;###autoload
(define-minor-mode pyvenv-tracking-mode
"Global minor mode to track the current virtualenv.
When this mode is active, pyvenv will activate a buffer-specific
virtualenv whenever the user switches to a buffer with a
buffer-local `pyvenv-workon' or `pyvenv-activate' variable."
:global t
(if pyvenv-tracking-mode
(add-hook 'post-command-hook 'pyvenv-track-virtualenv)
(remove-hook 'post-command-hook 'pyvenv-track-virtualenv)))
(defun pyvenv-track-virtualenv ()
"Set a virtualenv as specified for the current buffer.
If either `pyvenv-activate' or `pyvenv-workon' are specified, and
they specify a virtualenv different from the current one, switch
to that virtualenv."
(cond
(pyvenv-activate
(when (and (not (equal (file-name-as-directory pyvenv-activate)
pyvenv-virtual-env))
(or (not pyvenv-tracking-ask-before-change)
(y-or-n-p (format "Switch to virtualenv %s (currently %s)"
pyvenv-activate pyvenv-virtual-env))))
(pyvenv-activate pyvenv-activate)))
(pyvenv-workon
(when (and (not (equal pyvenv-workon pyvenv-virtual-env-name))
(or (not pyvenv-tracking-ask-before-change)
(y-or-n-p (format "Switch to virtualenv %s (currently %s)"
pyvenv-workon pyvenv-virtual-env-name))))
(pyvenv-workon pyvenv-workon)))))
(defun pyvenv-run-virtualenvwrapper-hook (hook &rest args)
"Run a virtualenvwrapper hook, and update the environment.
This will run a virtualenvwrapper hook and update the local
environment accordingly.
CAREFUL! This will modify your `process-environment' and
`exec-path'."
(when (pyvenv-virtualenvwrapper-supported)
(with-temp-buffer
(let ((tmpfile (make-temp-file "pyvenv-virtualenvwrapper-"))
(shell-file-name pyvenv-exec-shell))
(unwind-protect
(let ((default-directory (pyvenv-workon-home)))
(apply #'call-process
pyvenv-virtualenvwrapper-python
nil t nil
"-m" "virtualenvwrapper.hook_loader"
"--script" tmpfile
(if (getenv "HOOK_VERBOSE_OPTION")
(cons (getenv "HOOK_VERBOSE_OPTION")
(cons hook args))
(cons hook args)))
(call-process-shell-command
(format ". '%s' ; python -c 'import os, json; print(\"\\n=-=-=\"); print(json.dumps(dict(os.environ)))'"
tmpfile)
nil t nil))
(delete-file tmpfile)))
(goto-char (point-min))
(when (and (not (re-search-forward "No module named '?virtualenvwrapper'?" nil t))
(re-search-forward "\n=-=-=\n" nil t))
(let ((output (buffer-substring (point-min)
(match-beginning 0))))
(when (> (length output) 0)
(with-help-window "*Virtualenvwrapper Hook Output*"
(with-current-buffer "*Virtualenvwrapper Hook Output*"
(let ((inhibit-read-only t))
(erase-buffer)
(insert
(format
"Output from the virtualenvwrapper hook %s:\n\n"
hook)
output))))))
(dolist (binding (json-read))
(let ((env (format "%s=%s" (car binding) (cdr binding))))
(when (not (member env process-environment))
(setq process-environment (cons env process-environment))))
(when (eq (car binding) 'PATH)
(setq exec-path (split-string (cdr binding)
path-separator))))))))
;;;###autoload
(defun pyvenv-restart-python ()
"Restart Python inferior processes."
(interactive)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (and (eq major-mode 'inferior-python-mode)
(get-buffer-process buf))
(let ((cmd (combine-and-quote-strings (process-command
(get-buffer-process buf))))
(dedicated (if (string-match "\\[.*\\]$" (buffer-name buf))
t
nil))
(show nil))
(delete-process (get-buffer-process buf))
(goto-char (point-max))
(insert "\n\n"
"###\n"
(format "### Restarting in virtualenv %s (%s)\n"
pyvenv-virtual-env-name pyvenv-virtual-env)
"###\n"
"\n\n")
(run-python cmd dedicated show)
(goto-char (point-max)))))))
(defun pyvenv-hook-dir ()
"Return the current hook directory.
This is usually the value of $VIRTUALENVWRAPPER_HOOK_DIR, but
virtualenvwrapper has stopped exporting that variable, so we go
back to the default of $WORKON_HOME or even just ~/.virtualenvs/."
(or (getenv "VIRTUALENVWRAPPER_HOOK_DIR")
(pyvenv-workon-home)))
(defun pyvenv-workon-home ()
"Return the current workon home.
This is the value of $WORKON_HOME or ~/.virtualenvs."
(or (getenv "WORKON_HOME")
(expand-file-name "~/.virtualenvs")))
(defun pyvenv-virtualenvwrapper-supported ()
"Return true iff virtualenvwrapper is supported.
Right now, this just checks if WORKON_HOME is set."
(getenv "WORKON_HOME"))
;;; Compatibility
(when (not (fboundp 'file-name-base))
;; Emacs 24.3
(defun file-name-base (&optional filename)
"Return the base name of the FILENAME: no directory, no extension.
FILENAME defaults to `buffer-file-name'."
(file-name-sans-extension
(file-name-nondirectory (or filename (buffer-file-name)))))
)
(when (not (boundp 'mode-line-misc-info))
(defvar mode-line-misc-info nil
"Compatibility variable for 24.3+")
(let ((line mode-line-format))
(while line
(when (eq 'which-func-mode
(car-safe (car-safe (cdr line))))
(setcdr line (cons 'mode-line-misc-format
(cdr line)))
(setq line (cdr line)))
(setq line (cdr line)))))
(provide 'pyvenv)
;;; pyvenv.el ends here

Binary file not shown.

View file

@ -0,0 +1,61 @@
;;; yasnippet-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "yasnippet" "yasnippet.el" (0 0 0 0))
;;; Generated autoloads from yasnippet.el
(autoload 'yas-minor-mode "yasnippet" "\
Toggle YASnippet mode.
When YASnippet mode is enabled, `yas-expand', normally bound to
the TAB key, expands snippets of code depending on the major
mode.
With no argument, this command toggles the mode.
positive prefix argument turns on the mode.
Negative prefix argument turns off the mode.
Key bindings:
\\{yas-minor-mode-map}
\(fn &optional ARG)" t nil)
(defvar yas-global-mode nil "\
Non-nil if Yas-Global mode is enabled.
See the `yas-global-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `yas-global-mode'.")
(custom-autoload 'yas-global-mode "yasnippet" nil)
(autoload 'yas-global-mode "yasnippet" "\
Toggle Yas minor mode in all buffers.
With prefix ARG, enable Yas-Global mode if ARG is positive;
otherwise, disable it. If called from Lisp, enable the mode if
ARG is omitted or nil.
Yas minor mode is enabled in all buffers where
`yas-minor-mode-on' would do it.
See `yas-minor-mode' for more information on Yas minor mode.
\(fn &optional ARG)" t nil)
(autoload 'snippet-mode "yasnippet" "A mode for editing yasnippets" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "yasnippet" '("yas" "help-snippet-def" "snippet-mode-map")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; yasnippet-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "yasnippet" "20191030.1331" "Yet another snippet extension for Emacs" '((cl-lib "0.5")) :commit "1bee3a33c77d1a61c331461750e01c4f6fa85417" :keywords '("convenience" "emulation") :maintainer '("Noam Postavsky" . "npostavs@gmail.com") :url "http://github.com/joaotavora/yasnippet")

File diff suppressed because it is too large Load diff

Binary file not shown.