|
|
@ -44,16 +44,16 @@ |
|
|
|
- the backup and auto-save files go right to /tmp |
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(defvar PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/")) |
|
|
|
(defvar PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/")) |
|
|
|
(setq bookmark-default-file (concat PATH_USER_LOCAL "bookmarks")) |
|
|
|
(setq recentf-save-file (concat PATH_USER_LOCAL "recentf")) |
|
|
|
(setq custom-file (concat PATH_USER_LOCAL "custom.el")) ;don't spam init.el with saved customize settings |
|
|
|
(setq abbrev-file-name (concat PATH_USER_GLOBAL "abbrev_defs")) |
|
|
|
(setq backup-directory-alist `((".*" . ,temporary-file-directory))) |
|
|
|
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory))) |
|
|
|
(defvar PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/")) |
|
|
|
(defvar PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/")) |
|
|
|
(setq bookmark-default-file (concat PATH_USER_LOCAL "bookmarks")) |
|
|
|
(setq recentf-save-file (concat PATH_USER_LOCAL "recentf")) |
|
|
|
(setq custom-file (concat PATH_USER_LOCAL "custom.el")) ;don't spam init.el with saved customize settings |
|
|
|
(setq abbrev-file-name (concat PATH_USER_GLOBAL "abbrev_defs")) |
|
|
|
(setq backup-directory-alist `((".*" . ,temporary-file-directory))) |
|
|
|
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory))) |
|
|
|
|
|
|
|
(setq save-abbrevs 'silently) ; don't bother me with asking if new abbrevs should be saved |
|
|
|
(setq save-abbrevs 'silently) ; don't bother me with asking if new abbrevs should be saved |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
These functions are useful. Activate them. |
|
|
@ -62,7 +62,13 @@ |
|
|
|
(put 'upcase-region 'disabled nil) |
|
|
|
(put 'narrow-to-region 'disabled nil) |
|
|
|
(put 'dired-find-alternate-file 'disabled nil) |
|
|
|
#+END_SRC |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
Disable lock files, which cause trouble in e.g. lsp-mode |
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(setq-default create-lockfiles nil) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
Answering just 'y' or 'n' should be enough. |
|
|
|
|
|
|
@ -1290,7 +1296,8 @@ It is only available for emacs 26 and higher. |
|
|
|
(defun company/python-mode-hook() |
|
|
|
(message "company/python-mode-hook activated") |
|
|
|
(set (make-local-variable 'company-backends) |
|
|
|
'((company-ob-ipython company-jedi))) |
|
|
|
'((company-ob-ipython company-lsp))) |
|
|
|
; '((company-ob-ipython company-jedi))) |
|
|
|
; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files)) |
|
|
|
; '((company-lsp company-yasnippet) company-capf company-dabbrev company-files)) |
|
|
|
(company-mode t) |
|
|
@ -1541,13 +1548,62 @@ Add some helpers to handle and understand macros |
|
|
|
(flycheck-select-checker 'pylint)))) |
|
|
|
#+END_SRC |
|
|
|
*** Python language server (inactive) |
|
|
|
On python side following needs to be installed: |
|
|
|
- python-language-server[all] |
|
|
|
|
|
|
|
First test for lsp-python. |
|
|
|
Some intro: [[https://vxlabs.com/2018/06/08/python-language-server-with-emacs-and-lsp-mode/][Intro]] |
|
|
|
Source python language server: [[https://github.com/palantir/python-language-server][Link]] |
|
|
|
Source lsp-mode: |
|
|
|
Source lsp-python: [[https://github.com/emacs-lsp/lsp-python][Link]] |
|
|
|
Source company-lsp: [[https://github.com/tigersoldier/company-lsp][Link]] |
|
|
|
Source lsp-ui: [[https://github.com/emacs-lsp/lsp-ui][Link]] |
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
(use-package lsp-mode |
|
|
|
:ensure t |
|
|
|
:config |
|
|
|
;; make sure we have lsp-imenu everywhere we have lsp |
|
|
|
(require 'lsp-imenu) |
|
|
|
(add-hook 'lsp-after-open-hook 'lsp-enable-imenu) |
|
|
|
;; get lsp-python-enable defined |
|
|
|
;; nb: use either projectile-project-root or ffip-get-project-root-directory |
|
|
|
;; or any other function that can be used to find the root dir of a project |
|
|
|
(lsp-define-stdio-client lsp-python "python" |
|
|
|
#'projectile-project-root |
|
|
|
'("pyls")) |
|
|
|
;; make sure this is activated when python-mode is activated |
|
|
|
;; lsp-python-enable is created by macro above |
|
|
|
(add-hook 'python-mode-hook |
|
|
|
(lambda () |
|
|
|
(lsp-python-enable) |
|
|
|
(company/python-mode-hook))) |
|
|
|
;; lsp extras |
|
|
|
(use-package lsp-ui |
|
|
|
:ensure t |
|
|
|
:config |
|
|
|
(setq lsp-ui-sideline-ignore-duplicate t) |
|
|
|
(add-hook 'lsp-mode-hook 'lsp-ui-mode)) |
|
|
|
|
|
|
|
(use-package company-lsp |
|
|
|
:ensure t) |
|
|
|
; :config |
|
|
|
; (push 'company-lsp company-backends)) |
|
|
|
|
|
|
|
;; NB: only required if you prefer flake8 instead of the default |
|
|
|
;; send pyls config via lsp-after-initialize-hook -- harmless for |
|
|
|
;; other servers due to pyls key, but would prefer only sending this |
|
|
|
;; when pyls gets initialised (:initialize function in |
|
|
|
;; lsp-define-stdio-client is invoked too early (before server |
|
|
|
;; start)) |
|
|
|
(defun lsp-set-cfg () |
|
|
|
(let ((lsp-cfg `(:pyls (:configurationSources ("flake8"))))) |
|
|
|
;; TODO: check lsp--cur-workspace here to decide per server / project |
|
|
|
(lsp--set-configuration lsp-cfg))) |
|
|
|
|
|
|
|
(add-hook 'lsp-after-initialize-hook 'lsp-set-cfg) |
|
|
|
) |
|
|
|
#+END_SRC |
|
|
|
BEGIN_SRC emacs-lisp |
|
|
|
(use-package lsp-mode |
|
|
|
:ensure t |
|
|
@ -1601,7 +1657,7 @@ END_SRC |
|
|
|
106 ) |
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
BEGIN_SRC emacs-lisp |
|
|
|
(use-package company-jedi |
|
|
|
:defer t |
|
|
|
;; :after company |
|
|
@ -1614,7 +1670,7 @@ END_SRC |
|
|
|
(setq jedi:use-shortcuts t) |
|
|
|
;; (add-hook 'python-mode-hook 'company/python-mode-hook) |
|
|
|
) |
|
|
|
#+END_SRC |
|
|
|
END_SRC |
|
|
|
|
|
|
|
*** Virtual Environments |
|
|
|
A wrapper to handle virtual environments. |
|
|
@ -1631,15 +1687,15 @@ END_SRC |
|
|
|
:config |
|
|
|
(pyvenv-mode t) |
|
|
|
(defun my/pyvenv-post-activate-hook() |
|
|
|
(setq jedi:environment-root pyvenv-virtual-env) |
|
|
|
(setq jedi:environment-virtualenv pyvenv-virtual-env) |
|
|
|
(setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup |
|
|
|
; (setq jedi:environment-root pyvenv-virtual-env) |
|
|
|
; (setq jedi:environment-virtualenv pyvenv-virtual-env) |
|
|
|
; (setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup |
|
|
|
(setq python-shell-virtualenv-root pyvenv-virtual-env) |
|
|
|
;; default traceback, other option M-x jedi:toggle-log-traceback |
|
|
|
;; traceback is in jedi:pop-to-epc-buffer |
|
|
|
(jedi:setup) |
|
|
|
; (jedi:setup) |
|
|
|
;; (company/python-mode-hook) |
|
|
|
(setq jedi:server-args '("--log-traceback")) |
|
|
|
; (setq jedi:server-args '("--log-traceback")) |
|
|
|
(message "pyvenv-post-activate-hook activated")) |
|
|
|
(add-hook 'pyvenv-post-activate-hooks 'my/pyvenv-post-activate-hook) |
|
|
|
) |
|
|
|