From df18b20915b218a06757908d7fa8deab276e0c0d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 20 Aug 2019 18:06:28 -0700 Subject: [PATCH 001/303] Setup atomic-chrome on focus-out-hook if needed --- modules/config-desktop.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 86940c44..1b20e7bb 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -508,6 +508,10 @@ where it was when you previously visited the same file." atomic-chrome-stop-server) :init (when (display-graphic-p) + (my/onetime-setup atomic-chrome + :hook 'focus-out-hook + (atomic-chrome-start-server)) + (idle-job-add-function #'atomic-chrome-start-server 'append)) :config From 2f73f94a62968886630a713e73672acaf35e32dc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 20 Aug 2019 18:08:48 -0700 Subject: [PATCH 002/303] Emit slightly better bytecode when using a package without :ensure --- modules/config-package.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index 1e45ffe1..5ff79301 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -339,9 +339,13 @@ second, floating-point values are rounded down to the nearest integer.)" (funcall use-package-ensure-function name ensure state :byte-compile))) ;; or else wait until runtime. - (t (push `(,use-package-ensure-function - ',name ',ensure ',state :ensure) - body))) + (t (el-patch-wrap 2 + (unless (and (not ensure) + (eq use-package-ensure-function + 'straight-use-package-ensure-function)) + (push `(,use-package-ensure-function + ',name ',ensure ',state :ensure) + body))))) body))) (autoload 'use-package-install-deferred-package "use-package" From a1c5d6f6b14e161815236df531db0fd1ec18bcc8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 20 Aug 2019 18:09:17 -0700 Subject: [PATCH 003/303] Properly load helm-info during byte compile --- modules/config-helm.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index dc41ca16..fb8b0a23 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -35,7 +35,9 @@ :ensure nil :init (setq helm-default-info-index-list - (eval-when-compile (helm-get-info-files)))) + (eval-when-compile + (require 'helm-info) + (helm-get-info-files)))) (use-package helm-mode :ensure nil From da70f25c05700939f61784530defce4482f19876 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 24 Jun 2019 21:01:04 -0700 Subject: [PATCH 004/303] Add LSP support for Julia --- modules/config-company.el | 1 + modules/config-modes.el | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index 2600e1a0..2bcbdfa3 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -35,6 +35,7 @@ ('cmake-mode-hook '(company-cmake)) ('css-mode-hook '(company-css)) ('java-mode-hook '(company-eclim)) + ('java-mode-hook '(company-lsp)) ('nxml-mode-hook '(company-nxml)) ('html-mode-hook '(company-web-html)) ('lua-mode-hook '(company-lua)) diff --git a/modules/config-modes.el b/modules/config-modes.el index c00fbd68..9623d9a9 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -348,11 +348,14 @@ inferior-julia run-julia) :config - (use-package flycheck-julia - :after flycheck - :commands (flycehck-julia-setup) - :config - (flycheck-julia-setup)) + (use-package lsp-julia + :recipe (lsp-julia :type git + :host github + :repo "non-Jedi/lsp-julia") + + :init + (require 'lsp-julia) + (add-hook 'julia-mode-hook #'lsp-mode)) (use-package evil :config @@ -1525,4 +1528,12 @@ floobits-clear-highlights floobits-add-to-workspace)) +;;; LSP + +(use-package lsp-mode + ;; :hook (python-mode . lsp-deferred) + :commands (lsp-mode)) + +(use-package company-lsp :commands company-lsp) + (provide 'config-modes) From 212c251f193fc523c460b3c47e78353bf2c0a147 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 24 Jun 2019 21:31:32 -0700 Subject: [PATCH 005/303] Add lsp-ui --- modules/config-modes.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 9623d9a9..355ccf4f 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1532,7 +1532,12 @@ (use-package lsp-mode ;; :hook (python-mode . lsp-deferred) - :commands (lsp-mode)) + :commands (lsp-mode) + :config + (use-package lsp-ui + :commands lsp-ui-mode + :init + (add-hook 'lsp-mode-hook 'lsp-ui-mode))) (use-package company-lsp :commands company-lsp) From d0026677064d35ad30747e8d006109b45da80ec5 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 24 Jun 2019 21:41:39 -0700 Subject: [PATCH 006/303] Automatically run lsp when opening Julia files --- modules/config-modes.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 355ccf4f..154ed0ca 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -355,7 +355,7 @@ :init (require 'lsp-julia) - (add-hook 'julia-mode-hook #'lsp-mode)) + (add-hook 'julia-mode-hook #'lsp-deferred)) (use-package evil :config From b213cd921b335e4da2d309eba8a316de6ae6c374 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 24 Jun 2019 21:43:17 -0700 Subject: [PATCH 007/303] Disable lsp-mode flymake integration --- modules/config-modes.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 154ed0ca..083234a8 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1534,6 +1534,8 @@ ;; :hook (python-mode . lsp-deferred) :commands (lsp-mode) :config + (setq lsp-prefer-flymake nil) + (use-package lsp-ui :commands lsp-ui-mode :init From d9d6e5d3654ec04b5b6ee2b1f2776ee8d130d3ac Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 24 Jun 2019 21:47:00 -0700 Subject: [PATCH 008/303] Automatically guess project roots in lsp-mode with projectile --- modules/config-modes.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 083234a8..7103f8d3 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1534,7 +1534,8 @@ ;; :hook (python-mode . lsp-deferred) :commands (lsp-mode) :config - (setq lsp-prefer-flymake nil) + (setq lsp-prefer-flymake nil + lsp-auto-guess-root t) (use-package lsp-ui :commands lsp-ui-mode From fbb82e6ad7c6473d6120d388a0e8a552774f0217 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 25 Jun 2019 22:53:41 -0700 Subject: [PATCH 009/303] Add texlab support for LaTeX --- modules/config-tex.el | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 461bcb13..4c2cf39b 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -11,6 +11,28 @@ company-math-symbols-latex company-math-symbols-unicode)) +(with-eval-after-load 'lsp-mode + ;; Copied from `lsp-clients--rust-window-progress' in `lsp-rust'. + (defun lsp-latex-window-progress (_workspace params) + "Progress report handling. +PARAMS progress report notification data." + ;; Minimal implementation - we could show the progress as well. + (lsp-log (gethash "title" params))) + + (lsp-register-client + (make-lsp-client :new-connection + (lsp-stdio-connection + (list "env" "PATH=/Library/TeX/texbin/" (expand-file-name (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab")))) + :major-modes '(tex-mode yatex-mode latex-mode) + :server-id 'texlab + :notification-handlers + (lsp-ht + ("window/progress" + 'lsp-latex-window-progress)))) + + (add-to-list 'lsp-language-id-configuration '(tex-mode . "tex")) + (add-to-list 'lsp-language-id-configuration '(latex-mode . "tex"))) + (use-package tex :recipe auctex :commands (bib-cite-minor-mode @@ -168,12 +190,8 @@ command." (set-face-attribute 'ml/huge nil :height 1.35) (set-face-attribute 'ml/hhuge nil :height 1.4)) - (use-package company-auctex - :recipe (company-auctex :type git - :host github - :repo "PythonNut/company-auctex") - :commands (company-auctex-symbols - company-auctex-environments)) + + (add-hook 'TeX-mode-hook #'lsp-deferred) (add-hook 'TeX-mode-hook @@ -181,11 +199,7 @@ command." (let ((old-backends company-backends)) (set (make-local-variable 'company-backends) (append (list (append - '(company-auctex-macros - company-auctex-symbols - company-auctex-environments - company-latex-commands - company-math-symbols-latex + '(company-lsp company-dabbrev) (cdar old-backends))) '((company-ispell)) From 52f435c55804a4f8d2b841b267a66045da320c56 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 29 Jul 2019 15:04:20 -0700 Subject: [PATCH 010/303] Switch from anaconda-mode to lsp-python-ms --- modules/config-python.el | 54 ++++++++-------------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 189195ed..6359e6d9 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -46,53 +46,19 @@ (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) - (use-package company-anaconda - :defer-install t - :commands (company-anaconda)) - - (use-package anaconda-mode - :defer-install t - :commands (anaconda-mode) - :diminish (anaconda-mode . " ✶") - :config - (setq anaconda-mode-installation-directory (locate-user-emacs-file - "data/anaconda-mode")) - - (defun my/anaconda-eldoc-callback-fallback (docstring) - (let ((docstring - (cond ((stringp docstring) - docstring) - ((arrayp docstring) - (s-join " " (--map - (s-collapse-whitespace - (aref it 3)) - docstring)))))) - (when docstring - (eldoc-message - (substring docstring 0 (min (frame-width) (length docstring))))))) - - (defun my/anaconda-eldoc-callback (result) - (if result - (eldoc-message (anaconda-mode-eldoc-format result)) - (anaconda-mode-call - "goto_definitions" - #'my/anaconda-eldoc-callback-fallback))) - - ;; also show object docstrings - (defun nadvice/anaconda-mode-eldoc-function () - (anaconda-mode-call "eldoc" #'my/anaconda-eldoc-callback) - nil) - - (advice-add 'anaconda-mode-eldoc-function :override - #'nadvice/anaconda-mode-eldoc-function)) + (use-package lsp-python-ms + :init + (require 'lsp-python-ms) + (add-hook 'python-mode-hook #'lsp-deferred) - (use-package evil :config - (evil-define-key 'normal python-mode-map "gd" #'anaconda-mode-goto)) + ;; when on arch, check if we can use the system ls + (setq lsp-python-ms-dir + (let ((system-ls "/usr/lib/microsoft-python-language-server/")) + (if (file-directory-p system-ls) + system-ls + (locate-user-emacs-file "data/mspyls"))))) - (define-key python-mode-map (kbd "M-.") #'anaconda-mode-goto) - (add-hook 'python-mode-hook #'anaconda-eldoc-mode) - (add-hook 'python-mode-hook #'anaconda-mode) (add-hook 'python-mode-hook #'eldoc-mode) (use-package traad From 8a7512d0eff69225bddb32c3b710e160a192e1b9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 29 Jul 2019 15:25:15 -0700 Subject: [PATCH 011/303] Automatically detect the system Microsoft.Python.LanguageServer --- modules/config-company.el | 2 +- modules/config-python.el | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index 2bcbdfa3..b30b7aa2 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -42,7 +42,7 @@ ('web-mode-hook '(company-web-html)) ('scheme-mode-hook '(geiser-company-backend)) ('texinfo-mode-hook '(company-semantic)) - ('python-mode-hook '(company-anaconda)) + ('python-mode-hook '(company-lsp)) ('text-mode-hook '(company-ispell)) ('livescript-mode-hook '(company-tide)) ('go-mode-hook '(company-go))))))) diff --git a/modules/config-python.el b/modules/config-python.el index 6359e6d9..8d614156 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -46,18 +46,26 @@ (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) - (use-package lsp-python-ms - :init - (require 'lsp-python-ms) - (add-hook 'python-mode-hook #'lsp-deferred) - - :config - ;; when on arch, check if we can use the system ls - (setq lsp-python-ms-dir - (let ((system-ls "/usr/lib/microsoft-python-language-server/")) - (if (file-directory-p system-ls) - system-ls - (locate-user-emacs-file "data/mspyls"))))) + ;; Use the Microsoft python ls if we can + (when (executable-find "dotnet") + (use-package lsp-python-ms + :init + (require 'lsp-python-ms) + (add-hook 'python-mode-hook #'lsp-deferred) + + :config + ;; when on arch, check if we can use the system ls + (let ((system-ls "/usr/lib/microsoft-python-language-server/") + (system-ls-bin (executable-find "mspyls"))) + (if (and (file-directory-p system-ls) system-ls-bin) + (setq lsp-python-ms-dir system-ls + lsp-python-ms-executable system-ls-bin) + (setq lsp-python-ms-dir + (locate-user-emacs-file "data/mspyls") + lsp-python-ms-executable + (concat lsp-python-ms-dir + "Microsoft.Python.LanguageServer" + (and (eq system-type 'windows-nt) ".exe"))))))) (add-hook 'python-mode-hook #'eldoc-mode) From 5a72a7aa9d9316a146f9d754400318227071ffc9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 29 Jul 2019 15:45:29 -0700 Subject: [PATCH 012/303] Automatically discover poetry/pipenv venvs for lsp-python-ms --- modules/config-python.el | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index 8d614156..a5237d85 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -46,6 +46,32 @@ (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) + (defun my/python-find-virtualenv () + "Find a virtualenv corresponding to the current buffer. +Return either a string or nil." + ;; Stolen from raxod502/radian + (cl-block nil + (when (and (executable-find "poetry") + (locate-dominating-file default-directory "pyproject.toml")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process + "poetry" nil '(t nil) nil "run" "which" "python")) + (goto-char (point-min)) + (when (looking-at "\\(.+\\)/bin/python\n") + (let ((venv (match-string 1))) + (when (file-directory-p venv) + (cl-return venv))))))) + (when (and (executable-find "pipenv") + (locate-dominating-file default-directory "Pipfile")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) + (goto-char (point-min)) + (let ((venv (string-trim (buffer-string)))) + (when (file-directory-p venv) + (cl-return venv)))))))) + ;; Use the Microsoft python ls if we can (when (executable-find "dotnet") (use-package lsp-python-ms @@ -65,7 +91,17 @@ lsp-python-ms-executable (concat lsp-python-ms-dir "Microsoft.Python.LanguageServer" - (and (eq system-type 'windows-nt) ".exe"))))))) + (and (eq system-type 'windows-nt) ".exe"))))) + + (advice-add + 'lsp-python-ms--extra-init-params :before + (my/defun-as-value my/lsp-python-ms-discover-virtualenvs (&rest _) + ;; Stolen from raxod502/radian + (when-let ((venv (my/python-find-virtualenv))) + (setq-local lsp-python-ms-extra-paths + (file-expand-wildcards + (expand-file-name + "lib/python*/site-packages" venv)))))))) (add-hook 'python-mode-hook #'eldoc-mode) From c32497f24be56f86fc7803116fc737a65b0478d4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 30 Jul 2019 19:08:21 -0700 Subject: [PATCH 013/303] Don't start LSP on remote python files --- modules/config-python.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index a5237d85..0d7775f0 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -77,7 +77,10 @@ Return either a string or nil." (use-package lsp-python-ms :init (require 'lsp-python-ms) - (add-hook 'python-mode-hook #'lsp-deferred) + (add-hook 'python-mode-hook + (my/defun-as-value my/maybe-lsp (&rest _) + (unless (file-remote-p buffer-file-name) + (lsp-deferred)))) :config ;; when on arch, check if we can use the system ls From fa7421d835ab9af1dbf16cdbd4096d8c2a96670b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 2 Aug 2019 23:22:52 -0700 Subject: [PATCH 014/303] Accept optional directory in my/python-find-virtualenv --- modules/config-python.el | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 0d7775f0..34765f46 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -46,31 +46,32 @@ (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) - (defun my/python-find-virtualenv () + (defun my/python-find-virtualenv (&optional dir) "Find a virtualenv corresponding to the current buffer. Return either a string or nil." - ;; Stolen from raxod502/radian - (cl-block nil - (when (and (executable-find "poetry") - (locate-dominating-file default-directory "pyproject.toml")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (call-process - "poetry" nil '(t nil) nil "run" "which" "python")) - (goto-char (point-min)) - (when (looking-at "\\(.+\\)/bin/python\n") - (let ((venv (match-string 1))) + (let ((default-directory (or dir default-directory))) + ;; Stolen from raxod502/radian + (cl-block nil + (when (and (executable-find "poetry") + (locate-dominating-file default-directory "pyproject.toml")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process + "poetry" nil '(t nil) nil "run" "which" "python")) + (goto-char (point-min)) + (when (looking-at "\\(.+\\)/bin/python\n") + (let ((venv (match-string 1))) + (when (file-directory-p venv) + (cl-return venv))))))) + (when (and (executable-find "pipenv") + (locate-dominating-file default-directory "Pipfile")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) + (goto-char (point-min)) + (let ((venv (string-trim (buffer-string)))) (when (file-directory-p venv) - (cl-return venv))))))) - (when (and (executable-find "pipenv") - (locate-dominating-file default-directory "Pipfile")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) - (goto-char (point-min)) - (let ((venv (string-trim (buffer-string)))) - (when (file-directory-p venv) - (cl-return venv)))))))) + (cl-return venv))))))))) ;; Use the Microsoft python ls if we can (when (executable-find "dotnet") From 799f21bdb555a886a013267bb16eed8c4415fe42 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 3 Aug 2019 00:41:40 -0700 Subject: [PATCH 015/303] Don't use childframes on mac for lsp-ui-doc --- modules/config-modes.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 7103f8d3..911c5138 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1540,7 +1540,9 @@ (use-package lsp-ui :commands lsp-ui-mode :init - (add-hook 'lsp-mode-hook 'lsp-ui-mode))) + (add-hook 'lsp-mode-hook 'lsp-ui-mode) + (when (memq window-system '(mac ns)) + (setq lsp-ui-doc-use-childframe nil)))) (use-package company-lsp :commands company-lsp) From 0b033e7ab432aec364ad377d2a0b41825176a5bb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 3 Aug 2019 09:56:35 -0700 Subject: [PATCH 016/303] Automatically detect virtualenv for pyvenv --- modules/config-python.el | 65 +++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 34765f46..5ae93626 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -5,6 +5,33 @@ ;; Python ====================================================================== ;; ============================================================================= +(defun my/python-find-virtualenv (&optional dir) + "Find a virtualenv corresponding to the current buffer. +Return either a string or nil." + (let ((default-directory (or dir default-directory))) + ;; Stolen from raxod502/radian + (cl-block nil + (when (and (executable-find "poetry") + (locate-dominating-file default-directory "pyproject.toml")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process + "poetry" nil '(t nil) nil "run" "which" "python")) + (goto-char (point-min)) + (when (looking-at "\\(.+\\)/bin/python\n") + (let ((venv (match-string 1))) + (when (file-directory-p venv) + (cl-return venv))))))) + (when (and (executable-find "pipenv") + (locate-dominating-file default-directory "Pipfile")) + (with-temp-buffer + ;; May create virtualenv, but whatever. + (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) + (goto-char (point-min)) + (let ((venv (string-trim (buffer-string)))) + (when (file-directory-p venv) + (cl-return venv))))))))) + (with-eval-after-load 'pythonic (eval-when-compile (with-demoted-errors "Load error: %s" @@ -35,6 +62,17 @@ (advice-add 'pythonic-remote-host :override #'nadvice/pythonic-remote-host)) +(use-package pyvenv + :config + (defun nadvice/pyvenv-activate (&optional arg) + (interactive "P") + (let ((default-venv (my/python-find-virtualenv))) + (if (or (not default-venv) (consp (car arg))) + (list (read-directory-name "Activate venv: ")) + (list default-venv)))) + + (advice-add 'pyvenv-activate :filter-args #'nadvice/pyvenv-activate)) + (use-package python :ensure nil :config @@ -46,33 +84,6 @@ (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) - (defun my/python-find-virtualenv (&optional dir) - "Find a virtualenv corresponding to the current buffer. -Return either a string or nil." - (let ((default-directory (or dir default-directory))) - ;; Stolen from raxod502/radian - (cl-block nil - (when (and (executable-find "poetry") - (locate-dominating-file default-directory "pyproject.toml")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (call-process - "poetry" nil '(t nil) nil "run" "which" "python")) - (goto-char (point-min)) - (when (looking-at "\\(.+\\)/bin/python\n") - (let ((venv (match-string 1))) - (when (file-directory-p venv) - (cl-return venv))))))) - (when (and (executable-find "pipenv") - (locate-dominating-file default-directory "Pipfile")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) - (goto-char (point-min)) - (let ((venv (string-trim (buffer-string)))) - (when (file-directory-p venv) - (cl-return venv))))))))) - ;; Use the Microsoft python ls if we can (when (executable-find "dotnet") (use-package lsp-python-ms From e61529d50981114c0bb0b7ca45edca9caf1c08ed Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 20 Aug 2019 20:45:15 -0700 Subject: [PATCH 017/303] Add hy-mode --- modules/config-python.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config-python.el b/modules/config-python.el index 5ae93626..c2bfcbd8 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -230,4 +230,10 @@ Return either a string or nil." (funcall old-fun "sage")))) (funcall old-fun arg)))) +(use-package hy-mode + :defer-install t + :commands (hy-mode) + :mode ("\\.hy\\'" . hy-mode) + :interpreter ("hy" . hy-mode)) + (provide 'config-python) From 7f1f87768da1332bb1ee10102b8473ca7840df48 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Aug 2019 12:54:01 -0700 Subject: [PATCH 018/303] lsp-mode depends on yasnippet --- modules/config-modes.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 911c5138..9f962859 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1534,6 +1534,7 @@ ;; :hook (python-mode . lsp-deferred) :commands (lsp-mode) :config + (require 'yasnippet) (setq lsp-prefer-flymake nil lsp-auto-guess-root t) From 2a98273c8873a9ebc75492c6e6a25a6bb04e0286 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Aug 2019 12:54:40 -0700 Subject: [PATCH 019/303] Fix smerge faces --- modules/config-vcs.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 4d5a6742..768b2351 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -334,7 +334,13 @@ if ARG is omitted or nil. (add-hook 'find-file-hook #'smerge-mode) :config - (diminish 'smerge-mode)) + (diminish 'smerge-mode) + (set-face-attribute 'smerge-refined-added nil + :background nil + :inherit 'magit-diff-added-highlight) + (set-face-attribute 'smerge-refined-removed nil + :background nil + :inherit 'magit-diff-removed-highlight)) (use-package projectile :init From 27ab1d7a85b077019b83055f9644bf49e1b0f76d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Aug 2019 12:54:48 -0700 Subject: [PATCH 020/303] Add undo keybinding in smerge hydra --- modules/config-vcs.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 768b2351..e7036111 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -197,7 +197,7 @@ (defhydra hydra/smerge-tools (:color blue :hint nil :idle 0.3) " -_p_ ← → _n_ Keep _a_ll _b_ase _m_ine _o_ther | _C_ombine _E_diff _R_efine _r_esolve +_p_ ← → _n_ Keep _a_ll _b_ase _m_ine _o_ther _u_ndo | _C_ombine _E_diff _R_efine _r_esolve Diff _=<_ base/mine _==_ mine/other _=>_ base/other " ("C" smerge-combine-with-next) @@ -214,6 +214,8 @@ Diff _=<_ base/mine _==_ mine/other _=>_ base/other ("n" smerge-next :color red) ("p" smerge-prev :color red) + ("u" undo :color red) + ("=<" smerge-diff-base-mine) ("==" smerge-diff-mine-other) ("=>" smerge-diff-base-other)) From 497d8fdf58cdc15ebf3824cf1220829ad9576214 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Aug 2019 12:55:16 -0700 Subject: [PATCH 021/303] Set jka-compr-use-shell to nil --- modules/config-setq.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-setq.el b/modules/config-setq.el index 74d039d3..e3a58297 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -26,6 +26,7 @@ jit-lock-stealth-nice 0.1 jit-lock-stealth-time 0.2 jit-lock-stealth-verbose nil + jka-compr-use-shell nil left-margin-width 0 max-lisp-eval-depth 5000 max-specpdl-size 10000 From d8c2310747725308198dc992a82c8ec7d6b97d7a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Aug 2019 12:56:53 -0700 Subject: [PATCH 022/303] Add TRAMP support to my/python-find-virtualenv --- modules/config-python.el | 45 +++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index c2bfcbd8..cf8f04a0 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -5,32 +5,57 @@ ;; Python ====================================================================== ;; ============================================================================= +(defun my/local-executable-find (name) + ;; TODO: This should be moved out of config-python + (if (tramp-tramp-file-p default-directory) + (with-parsed-tramp-file-name default-directory vec + (tramp-find-executable + vec "poetry" (tramp-get-remote-path vec) t t)) + (executable-find name))) + +(defun my/tramp-build-name-from-localname (localname) + (with-parsed-tramp-file-name default-directory parsed + (tramp-make-tramp-file-name + parsed-method + parsed-user + parsed-domain + parsed-host + parsed-port + localname + parsed-hop))) + (defun my/python-find-virtualenv (&optional dir) "Find a virtualenv corresponding to the current buffer. Return either a string or nil." (let ((default-directory (or dir default-directory))) ;; Stolen from raxod502/radian (cl-block nil - (when (and (executable-find "poetry") + (when (and (my/local-executable-find "poetry") (locate-dominating-file default-directory "pyproject.toml")) (with-temp-buffer ;; May create virtualenv, but whatever. - (when (= 0 (call-process + (when (= 0 (process-file "poetry" nil '(t nil) nil "run" "which" "python")) (goto-char (point-min)) (when (looking-at "\\(.+\\)/bin/python\n") - (let ((venv (match-string 1))) - (when (file-directory-p venv) - (cl-return venv))))))) - (when (and (executable-find "pipenv") + (let* ((path (match-string 1)) + (universal-path (if (tramp-tramp-file-p default-directory) + (my/tramp-build-name-from-localname path) + path))) + (when (file-directory-p universal-path) + (cl-return universal-path))))))) + (when (and (my/local-executable-find "pipenv") (locate-dominating-file default-directory "Pipfile")) (with-temp-buffer ;; May create virtualenv, but whatever. - (when (= 0 (call-process "pipenv" nil '(t nil) nil "--venv")) + (when (= 0 (process-file "pipenv" nil '(t nil) nil "--venv")) (goto-char (point-min)) - (let ((venv (string-trim (buffer-string)))) - (when (file-directory-p venv) - (cl-return venv))))))))) + (let* ((path (string-trim (buffer-string))) + (universal-path (if (tramp-tramp-file-p default-directory) + (my/tramp-build-name-from-localname path) + path))) + (when (file-directory-p universal-path) + (cl-return universal-path))))))))) (with-eval-after-load 'pythonic (eval-when-compile From d787e57ae596e8e423086bebe27093b1c471c804 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 12 Sep 2019 19:45:18 -0700 Subject: [PATCH 023/303] Add support for system texlab on linux --- modules/config-tex.el | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 4c2cf39b..75ea49da 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -19,19 +19,28 @@ PARAMS progress report notification data." ;; Minimal implementation - we could show the progress as well. (lsp-log (gethash "title" params))) - (lsp-register-client - (make-lsp-client :new-connection - (lsp-stdio-connection - (list "env" "PATH=/Library/TeX/texbin/" (expand-file-name (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab")))) - :major-modes '(tex-mode yatex-mode latex-mode) - :server-id 'texlab - :notification-handlers - (lsp-ht - ("window/progress" - 'lsp-latex-window-progress)))) - - (add-to-list 'lsp-language-id-configuration '(tex-mode . "tex")) - (add-to-list 'lsp-language-id-configuration '(latex-mode . "tex"))) + (let* ((local-texlab-path (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab")) + (system-texlab (executable-find "texlab")) + (texlab-command (cond ((file-executable-p local-texlab-path) + (let ((path (expand-file-name local-texlab-path))) + (if (eq system-type 'darwin) + (list "env" "PATH=/Library/TeX/texbin/" path) + path))) + (system-texlab system-texlab)))) + (when texlab-command + (lsp-register-client + (make-lsp-client :new-connection + (lsp-stdio-connection + texlab-command) + :major-modes '(tex-mode yatex-mode latex-mode) + :server-id 'texlab + :notification-handlers + (lsp-ht + ("window/progress" + 'lsp-latex-window-progress)))) + + (add-to-list 'lsp-language-id-configuration '(tex-mode . "tex")) + (add-to-list 'lsp-language-id-configuration '(latex-mode . "tex"))))) (use-package tex :recipe auctex From 035cad71aaeb9d471128da88236a1bbe19e8b3a4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 19 Sep 2019 11:39:53 -0700 Subject: [PATCH 024/303] Add rsyncx method to TRAMP --- modules/config-tramp.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index bdf0ca07..130ff5d8 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -23,6 +23,24 @@ (with-eval-after-load 'tramp (eval-when-compile (require 'tramp)) + ;; Define a rsyncx method analogous to scpx + (add-to-list 'tramp-methods + '("rsyncx" + (tramp-login-program "ssh") + (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") + ("-t" "-t") ("%h") ("/bin/sh"))) + (tramp-async-args (("-q"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-login ("-l")) + (tramp-remote-shell-args ("-c")) + (tramp-copy-program "rsync") + (tramp-copy-args (("-t" "%k") ("-p") ("-r") ("-s") ("-c"))) + (tramp-copy-env (("RSYNC_RSH") + ("ssh" "%c"))) + (tramp-copy-keep-date t) + (tramp-copy-keep-tmpfile t) + (tramp-copy-recursive t))) + (setq tramp-backup-directory-alist `((,(rx (zero-or-more anything)) . ,my/tramp-backup-directory)))) From 717a6f82adb21d56a183f739d369e133b5c14650 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 19 Sep 2019 11:40:20 -0700 Subject: [PATCH 025/303] Add some mathmematical terms to the user dictionary --- data/user-dict.en.pws | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index e41eceb7..2c3331f8 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,11 +1,18 @@ -personal_ws-1.1 en 10 +personal_ws-1.1 en 17 +cardinality nondecreasing durations Gaussians satisfiable +Lipschitz conjugacy +surjection nonincreasing +unknotted +Reidemeister +integrable Hayase contrapositive +pointwise bijection inequivalent From a25ed3aca3aaede8f9203d5728ce8355d0f3213b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 20 Sep 2019 15:00:26 -0700 Subject: [PATCH 026/303] Load recentf in idle time --- modules/config-package.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-package.el b/modules/config-package.el index 5ff79301..77adc925 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -221,6 +221,7 @@ second, floating-point values are rounded down to the nearest integer.)" (idle-job-add-require 'helm-semantic) (idle-job-add-require 'helm-for-files) +(idle-job-add-require 'recentf) (idle-job-add-require 'helm-bookmark) (idle-job-add-require 'bookmark) (idle-job-add-require 'browse-url) From 7e76de9c892a13883987495b2f439e6d80dff255 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 20 Sep 2019 20:28:40 -0700 Subject: [PATCH 027/303] Don't show hover in sideline (because of texlab) --- modules/config-modes.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 9f962859..aa9a4ac8 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1542,6 +1542,9 @@ :commands lsp-ui-mode :init (add-hook 'lsp-mode-hook 'lsp-ui-mode) + ;; TODO: This is only because texlab compiles on hover, which is + ;; very expensive + (setq lsp-ui-sideline-show-hover nil) (when (memq window-system '(mac ns)) (setq lsp-ui-doc-use-childframe nil)))) From a3324e2f7a3b66fb427be8704c2dfeae9f7f0f5d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 30 Sep 2019 22:12:14 -0700 Subject: [PATCH 028/303] Add more mathematical terms to the dictionary --- data/user-dict.en.pws | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index 2c3331f8..e4a71bf3 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,9 +1,12 @@ -personal_ws-1.1 en 17 +personal_ws-1.1 en 22 +infimum cardinality nondecreasing +colorable durations Gaussians satisfiable +colorings Lipschitz conjugacy surjection @@ -12,7 +15,9 @@ unknotted Reidemeister integrable Hayase +subadditivity contrapositive pointwise +nontrivially bijection inequivalent From 7f4b648360c5a4dd7a1b00a8b61b21220f5f1268 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 30 Sep 2019 22:20:49 -0700 Subject: [PATCH 029/303] Move lsp-mode session file to :/data --- .gitignore | 1 + modules/config-modes.el | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8bc56ac9..c642ddab 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ flycheck_* /eshell /data/authinfo.gpg +/data/.lsp-session-v1 diff --git a/modules/config-modes.el b/modules/config-modes.el index aa9a4ac8..97c9fff4 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1536,7 +1536,8 @@ :config (require 'yasnippet) (setq lsp-prefer-flymake nil - lsp-auto-guess-root t) + lsp-auto-guess-root t + lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1"))) (use-package lsp-ui :commands lsp-ui-mode From 814fb89eb2d33c304c56135d58263c4157dadac0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 10 Oct 2019 11:29:15 -0700 Subject: [PATCH 030/303] Ignore saveplace file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c642ddab..fb288a65 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,4 @@ flycheck_* /data/authinfo.gpg /data/.lsp-session-v1 +/data/places From 96552f08a47a22f286a487d2b1ec2fbc33756b0f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 10 Oct 2019 11:33:57 -0700 Subject: [PATCH 031/303] Ignore transient persistence files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb288a65..21cf58b4 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,4 @@ flycheck_* /data/authinfo.gpg /data/.lsp-session-v1 /data/places +/data/transient From 4cb4451a34faa23803f4fc0d83a547e6cc877a43 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 10 Oct 2019 11:55:49 -0700 Subject: [PATCH 032/303] Update recentf symlink --- recentf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recentf b/recentf index 33767abf..e5f49842 120000 --- a/recentf +++ b/recentf @@ -1 +1 @@ -data/.recentf \ No newline at end of file +data/recentf \ No newline at end of file From 7f996ee39543aa5c69106e1162f237a932b03aca Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 5 Nov 2019 01:04:30 -0800 Subject: [PATCH 033/303] Avoid infinite save loop caused by modified real-auto-save-mode --- modules/config-safety.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/config-safety.el b/modules/config-safety.el index 01b382f4..b1e007bf 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -146,15 +146,20 @@ when `auto-save-mode' is invoked manually.") :commands (real-auto-save-mode) :config (setq real-auto-save-interval 0.3) - (defun nadvice/real-auto-save-start-timer () - "Start real-auto-save-timer." - (setq real-auto-save-timer - (run-with-idle-timer real-auto-save-interval - t - 'real-auto-save-buffers))) (advice-add 'real-auto-save-start-timer :override - #'nadvice/real-auto-save-start-timer)) + (my/defun-as-value nadvice/real-auto-save-start-timer () + "Start real-auto-save-timer." + (setq real-auto-save-timer + (run-with-idle-timer real-auto-save-interval + t + 'real-auto-save-buffers)))) + + (advice-add + 'real-auto-save-buffers :around + (my/defun-as-value nadvice/real-auto-save-buffers (old-fun &rest args) + (cl-letf* (((symbol-function #'real-auto-save-restart-timer) #'ignore)) + (apply old-fun args))))) (provide 'config-safety) From a67599fafdf5762882fc77b759dc179ac9eb7d28 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 28 Nov 2019 14:36:53 -0800 Subject: [PATCH 034/303] Use homebrew rsync on macOS by default, closes #132 --- modules/config-tramp.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 130ff5d8..ddf4721a 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -25,7 +25,7 @@ (eval-when-compile (require 'tramp)) ;; Define a rsyncx method analogous to scpx (add-to-list 'tramp-methods - '("rsyncx" + `("rsyncx" (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) @@ -33,7 +33,11 @@ (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")) - (tramp-copy-program "rsync") + (tramp-copy-program + ,(if (and (eq system-type 'darwin) + (file-executable-p "/usr/local/bin/rsync")) + "/usr/local/bin/rsync" + "rsync")) (tramp-copy-args (("-t" "%k") ("-p") ("-r") ("-s") ("-c"))) (tramp-copy-env (("RSYNC_RSH") ("ssh" "%c"))) From db45fd18e6a2e91368645c30c1856bd8b97d0066 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 29 Nov 2019 15:55:58 -0800 Subject: [PATCH 035/303] Support local release builds of texlab --- .gitignore | 1 + modules/config-tex.el | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 21cf58b4..6042cb66 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,4 @@ flycheck_* /data/.lsp-session-v1 /data/places /data/transient +/data/lsp diff --git a/modules/config-tex.el b/modules/config-tex.el index 75ea49da..823c3bd1 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -12,6 +12,10 @@ company-math-symbols-unicode)) (with-eval-after-load 'lsp-mode + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'lsp-mode))) + ;; Copied from `lsp-clients--rust-window-progress' in `lsp-rust'. (defun lsp-latex-window-progress (_workspace params) "Progress report handling. @@ -19,14 +23,21 @@ PARAMS progress report notification data." ;; Minimal implementation - we could show the progress as well. (lsp-log (gethash "title" params))) - (let* ((local-texlab-path (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab")) + (let* ((local-texlab-debug-path + (expand-file-name + (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab"))) + (local-texlab-release-path + (expand-file-name + (locate-user-emacs-file "data/lsp/texlab/target/release/texlab"))) (system-texlab (executable-find "texlab")) - (texlab-command (cond ((file-executable-p local-texlab-path) - (let ((path (expand-file-name local-texlab-path))) - (if (eq system-type 'darwin) - (list "env" "PATH=/Library/TeX/texbin/" path) - path))) - (system-texlab system-texlab)))) + (texlab-path (cond ((file-executable-p local-texlab-debug-path) + local-texlab-debug-path) + ((file-executable-p local-texlab-release-path) + local-texlab-release-path) + (system-texlab system-texlab))) + (texlab-command (if (and texlab-path (eq system-type 'darwin)) + (list "env" "PATH=/Library/TeX/texbin/" texlab-path) + texlab-path))) (when texlab-command (lsp-register-client (make-lsp-client :new-connection From f9b9113f39a1873314dc11c25acfbc6cde0167ee Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Dec 2019 10:43:22 -0800 Subject: [PATCH 036/303] Remove recentf-autosave --- modules/config-desktop.el | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 1b20e7bb..2a132c5e 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -332,24 +332,6 @@ where it was when you previously visited the same file." (dolist (hook recentf-used-hooks) (apply #'remove-hook hook)) (recentf-mode +1) - (let ((recentf-autosave-timer nil)) - (defun nadvice/recentf-autosave (&rest _args) - (when (timerp recentf-autosave-timer) - (cancel-timer recentf-autosave-timer)) - (setq recentf-autosave-timer - (run-with-idle-timer - 3 nil - (lambda () - ;; TODO: Yeah so this is actually another horrifying hack. - (let ((inhibit-message t) - (write-file-functions - (remove 'recentf-track-opened-file - write-file-functions))) - (recentf-save-list))))))) - - (advice-add 'recentf-track-opened-file :after - #'nadvice/recentf-autosave) - (defun nadvice/recentf-quiet (old-fun &rest args) (let ((inhibit-message t)) (apply old-fun args))) From 5012fca0ad520aa74df9753ec79a5f6b38a987a9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 3 Jan 2020 22:27:24 -0800 Subject: [PATCH 037/303] Fix errors byte-compiling exec-path-from-shell config --- modules/config-package.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-package.el b/modules/config-package.el index 77adc925..adc80ec6 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -394,6 +394,10 @@ these values are used to call `use-package-ensure-function'.") (setq exec-path-from-shell-check-startup-files nil) :init + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'exec-path-from-shell))) + (when (memq window-system '(mac ns)) (setq exec-path (or (eval-when-compile From 24e022836d6e3d3a26d0aa3761d1bbfbc1dadb4d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 3 Jan 2020 22:27:44 -0800 Subject: [PATCH 038/303] Silence byte-compiler warning for unused prompt in y-or-n-p override --- modules/config-package.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-package.el b/modules/config-package.el index adc80ec6..547000c0 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -308,7 +308,7 @@ second, floating-point values are rounded down to the nearest integer.)" (advice-add 'straight-use-package-ensure-function :around (my/defun-as-value nadvice/straight-use-package-ensure-function (old-fun &rest args) - (cl-letf* (((symbol-function #'y-or-n-p) (lambda (prompt) t))) + (cl-letf* (((symbol-function #'y-or-n-p) (lambda (_prompt) t))) (apply old-fun args)))) (el-patch-defun use-package-handler/:ensure (name keyword ensure rest state) From 7a1bfd56d4e78a58ea02719856b2671b3b78aaeb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 7 Jan 2020 22:40:30 -0800 Subject: [PATCH 039/303] Fix my/local-executable-find only finding poetry on remote systems --- modules/config-python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index cf8f04a0..976840e4 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -10,7 +10,7 @@ (if (tramp-tramp-file-p default-directory) (with-parsed-tramp-file-name default-directory vec (tramp-find-executable - vec "poetry" (tramp-get-remote-path vec) t t)) + vec name (tramp-get-remote-path vec) t t)) (executable-find name))) (defun my/tramp-build-name-from-localname (localname) From 334490b6a404e2819bec1d18d8de6f77f2cfd0dd Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 00:59:58 -0800 Subject: [PATCH 040/303] Add safer method for finding poetry virtualenvs --- modules/config-python.el | 90 ++++++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 976840e4..d68dfb1e 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -28,34 +28,70 @@ "Find a virtualenv corresponding to the current buffer. Return either a string or nil." (let ((default-directory (or dir default-directory))) + (message "Searching for Python virtual environment at %s" default-directory) ;; Stolen from raxod502/radian - (cl-block nil - (when (and (my/local-executable-find "poetry") - (locate-dominating-file default-directory "pyproject.toml")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (process-file - "poetry" nil '(t nil) nil "run" "which" "python")) - (goto-char (point-min)) - (when (looking-at "\\(.+\\)/bin/python\n") - (let* ((path (match-string 1)) - (universal-path (if (tramp-tramp-file-p default-directory) - (my/tramp-build-name-from-localname path) - path))) - (when (file-directory-p universal-path) - (cl-return universal-path))))))) - (when (and (my/local-executable-find "pipenv") - (locate-dominating-file default-directory "Pipfile")) - (with-temp-buffer - ;; May create virtualenv, but whatever. - (when (= 0 (process-file "pipenv" nil '(t nil) nil "--venv")) - (goto-char (point-min)) - (let* ((path (string-trim (buffer-string))) - (universal-path (if (tramp-tramp-file-p default-directory) - (my/tramp-build-name-from-localname path) - path))) - (when (file-directory-p universal-path) - (cl-return universal-path))))))))) + (let* ((path + (cl-block nil + (when (and (my/local-executable-find "poetry") + (locate-dominating-file default-directory + "pyproject.toml")) + ;; First, we try poetry debug:info, which is safe and a bit + ;; faster, but only works in poetry versions 1.0 and up + (let* ((return-code 0) + (output + (with-output-to-string + (with-current-buffer + standard-output + (setq return-code + (process-file "poetry" nil '(t nil) nil + "debug:info" + "-n" + "--no-ansi")))))) + (when (and (= 0 return-code) + (string-match (rx "\n * Path: " + (group (1+ any)) + "\n * Valid:") + output)) + (cl-return (match-string 1 output))) + ;; Fall back to poetry <1.0 check TODO: This code + ;; will become stale over time, so get rid of it + ;; after a while. + ;; Radon: May create virtualenv, but whatever. + (let* ((return-code 0) + (output + (with-output-to-string + (with-current-buffer + standard-output + (setq return-code + (process-file + "poetry" nil '(t nil) nil + "run" + "which" + "python")))))) + (when (and (= 0 return-code) + (string-match (rx bol + (group (1+ any)) + "/bin/python\n") + output)) + (cl-return (match-string 1 output)))))) + (when (and (my/local-executable-find "pipenv") + (locate-dominating-file default-directory + "Pipfile")) + (let* ((return-code 0) + (output + (with-output-to-string + (with-current-buffer + standard-output + (setq return-code + (process-file "pipenv" nil '(t nil) nil + "--venv")))))) + (when (= 0 return-code) + (cl-return (string-trim output))))))) + (universal-path (if (tramp-tramp-file-p default-directory) + (my/tramp-build-name-from-localname path) + path))) + (when (file-directory-p universal-path) + universal-path)))) (with-eval-after-load 'pythonic (eval-when-compile From b191363eba5738435bb08986c2d29d8299abe238 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 01:04:14 -0800 Subject: [PATCH 041/303] Add support for pyls through TRAMP --- modules/config-python.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/config-python.el b/modules/config-python.el index d68dfb1e..b9838600 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -181,6 +181,29 @@ Return either a string or nil." (add-hook 'python-mode-hook #'eldoc-mode) + (with-eval-after-load 'lsp-mode + (lsp-register-client + (make-lsp-client + :new-connection + (lsp-tramp-connection + (my/defun-as-value my/python-find-project-pyls () + (let ((pyls-path (expand-file-name + "bin/pyls" + (my/python-find-virtualenv)))) + (when (file-executable-p pyls-path) + (with-parsed-tramp-file-name pyls-path parsed + parsed-localname))))) + :major-modes '(python-mode) + :remote? t + :server-id 'pyls-remote + :library-folders-fn + (lambda (_workspace) + lsp-clients-python-library-directories) + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (lsp-configuration-section "pyls"))))))) + (use-package traad :defer-install t :commands (traad-open From d7761ea072fdff8ea0cdab0d36c0b3ac648c9604 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 01:04:27 -0800 Subject: [PATCH 042/303] Remove pipenv package --- modules/config-python.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index b9838600..092231f8 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -242,12 +242,6 @@ Return either a string or nil." :defer-install t :commands (live-py-mode)) - (use-package pipenv - :init - (add-hook 'python-mode-hook #'pipenv-mode) - (setq pipenv-projectile-after-switch-function - #'pipenv-projectile-after-switch-extended)) - (use-package conda) (use-package blacken From 15eb01e3e27f147bf5502ab76cc99ad285723deb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 01:04:46 -0800 Subject: [PATCH 043/303] Don't error when sh-mode is not visiting a file --- modules/config-modes.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 97c9fff4..8db4c2eb 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -216,7 +216,8 @@ 'sh-mode-hook (my/defun-as-value my/sh-mode-detect-zsh () (setq mode-name "sh") - (if (string-match-p (rx ".zsh" line-end) buffer-file-name) + (if (and buffer-file-name + (string-match-p (rx ".zsh" line-end) buffer-file-name)) (sh-set-shell "zsh")))) (defun my/sh-smart-newline (&optional arg interactive) From b86a2233194fb4dfd23d2a32f7d8ebb393a46129 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 01:05:06 -0800 Subject: [PATCH 044/303] Add pacfiles-mode --- modules/config-modes.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 8db4c2eb..a2f67d3c 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1097,6 +1097,10 @@ :commands (pkgbuild-mode) :mode (("/PKGBUILD\\'" . pkgbuild-mode))) +(use-package pacfiles-mode + :defer-install t + :commands (pacfiles)) + (use-package dockerfile-mode :defer-install t :commands (dockerfile-build-buffer From 18e4daaa43e32b18afafaf7f8bfc132a3ded03fb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 01:10:16 -0800 Subject: [PATCH 045/303] Fix function names in undo-tree-make-history-save-file-name advice --- modules/config-undo.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-undo.el b/modules/config-undo.el index b07140ad..df93a686 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -64,12 +64,12 @@ (cond ((executable-find "zstd") (advice-add 'undo-tree-make-history-save-file-name :filter-return - (my/defun-as-value nadvice/undo-tree/lz4-compress (ret) + (my/defun-as-value nadvice/undo-tree/zstd-compress (ret) (concat ret ".zst")))) ((executable-find "gzip") (advice-add 'undo-tree-make-history-save-file-name :filter-return - (my/defun-as-value nadvice/undo-tree/xz-compress (ret) + (my/defun-as-value nadvice/undo-tree/gzip-compress (ret) (concat ret ".gz"))))) (advice-add From 41bd193821d7dc2f5f10e278aa6c9744038e8029 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 11:18:46 -0800 Subject: [PATCH 046/303] Remove traad --- modules/config-python.el | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 092231f8..16bf4f12 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -204,40 +204,6 @@ Return either a string or nil." (with-lsp-workspace workspace (lsp--set-configuration (lsp-configuration-section "pyls"))))))) - (use-package traad - :defer-install t - :commands (traad-open - traad-close - traad-running? - traad-display-task-status - traad-display-full-task-status - traad-undo - traad-redo - traad-display-history - traad-undo-info - traad-redo-info - traad-rename-current-file - traad-rename - traad-normalize-arguments - traad-remove-argument - traad-extract-method - traad-extract-variable - traad-organize-imports - traad-expand-star-imports - traad-froms-to-imports - traad-relatives-to-absolutes - traad-handle-long-imports - traad-imports-super-smackdown - traad-display-occurrences - traad-display-implementations - traad-goto-definition - traad-findit - traad-code-assist - traad-display-calltip - traad-popup-calltip - traad-display-doc - traad-popup-doc)) - (use-package live-py-mode :defer-install t :commands (live-py-mode)) From bce01edf94885b981244a4102e90ee5825a9b2eb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 12:43:50 -0800 Subject: [PATCH 047/303] Fix compilation of pyls-remote configuration --- modules/config-python.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-python.el b/modules/config-python.el index 16bf4f12..67dd4fdf 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -182,6 +182,9 @@ Return either a string or nil." (add-hook 'python-mode-hook #'eldoc-mode) (with-eval-after-load 'lsp-mode + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'lsp-mode))) (lsp-register-client (make-lsp-client :new-connection From d5225a9faf7a042d5a00239abb8bd02989e1ba28 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 15:36:41 -0800 Subject: [PATCH 048/303] Add helper to output the result of process-file to a string --- modules/config-python.el | 114 +++++++++++++++++---------------------- modules/config-setq.el | 10 ++++ 2 files changed, 59 insertions(+), 65 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 67dd4fdf..0628b9e2 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -1,5 +1,6 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros)) +(eval-when-compile (require 'config-setq)) ;; ============================================================================= ;; Python ====================================================================== @@ -27,71 +28,54 @@ (defun my/python-find-virtualenv (&optional dir) "Find a virtualenv corresponding to the current buffer. Return either a string or nil." - (let ((default-directory (or dir default-directory))) - (message "Searching for Python virtual environment at %s" default-directory) - ;; Stolen from raxod502/radian - (let* ((path - (cl-block nil - (when (and (my/local-executable-find "poetry") - (locate-dominating-file default-directory - "pyproject.toml")) - ;; First, we try poetry debug:info, which is safe and a bit - ;; faster, but only works in poetry versions 1.0 and up - (let* ((return-code 0) - (output - (with-output-to-string - (with-current-buffer - standard-output - (setq return-code - (process-file "poetry" nil '(t nil) nil - "debug:info" - "-n" - "--no-ansi")))))) - (when (and (= 0 return-code) - (string-match (rx "\n * Path: " - (group (1+ any)) - "\n * Valid:") - output)) - (cl-return (match-string 1 output))) - ;; Fall back to poetry <1.0 check TODO: This code - ;; will become stale over time, so get rid of it - ;; after a while. - ;; Radon: May create virtualenv, but whatever. - (let* ((return-code 0) - (output - (with-output-to-string - (with-current-buffer - standard-output - (setq return-code - (process-file - "poetry" nil '(t nil) nil - "run" - "which" - "python")))))) - (when (and (= 0 return-code) - (string-match (rx bol - (group (1+ any)) - "/bin/python\n") - output)) - (cl-return (match-string 1 output)))))) - (when (and (my/local-executable-find "pipenv") - (locate-dominating-file default-directory - "Pipfile")) - (let* ((return-code 0) - (output - (with-output-to-string - (with-current-buffer - standard-output - (setq return-code - (process-file "pipenv" nil '(t nil) nil - "--venv")))))) - (when (= 0 return-code) - (cl-return (string-trim output))))))) - (universal-path (if (tramp-tramp-file-p default-directory) - (my/tramp-build-name-from-localname path) - path))) - (when (file-directory-p universal-path) - universal-path)))) + (message "Searching for Python virtual environment at %s" default-directory) + (let* ((default-directory (or dir default-directory)) + (path + (cl-block nil + (when (and (my/local-executable-find "poetry") + (locate-dominating-file default-directory + "pyproject.toml")) + ;; First, we try poetry debug:info, which is safe and a bit + ;; faster, but only works in poetry versions 1.0 and up + (cl-destructuring-bind (return-code . output) + (my/process-file-to-string "poetry" nil '(t nil) nil + "debug:info" + "-n" + "--no-ansi") + (when (and (= 0 return-code) + (string-match (rx "\n * Path: " + (group (1+ any)) + "\n * Valid:") + output)) + (cl-return (match-string 1 output)))) + ;; Fall back to poetry <1.0 check TODO: This code + ;; will become stale over time, so get rid of it + ;; after a while. + ;; Radon: May create virtualenv, but whatever. + (cl-destructuring-bind (return-code . output) + (my/process-file-to-string "poetry" nil '(t nil) nil + "run" + "which" + "python") + (when (and (= 0 return-code) + (string-match (rx bol + (group (1+ any)) + "/bin/python\n") + output)) + (cl-return (match-string 1 output))))) + (when (and (my/local-executable-find "pipenv") + (locate-dominating-file default-directory + "Pipfile")) + (cl-destructuring-bind (return-code . output) + (my/process-file-to-string "pipenv" nil '(t nil) nil + "--venv") + (when (= 0 return-code) + (cl-return (string-trim output))))))) + (universal-path (if (tramp-tramp-file-p default-directory) + (my/tramp-build-name-from-localname path) + path))) + (when (file-directory-p universal-path) + universal-path))) (with-eval-after-load 'pythonic (eval-when-compile diff --git a/modules/config-setq.el b/modules/config-setq.el index e3a58297..62744aef 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -274,4 +274,14 @@ response as a no." (let ((shell-file-name (my/detect-shell))) (apply old-fun args)))) +(defun my/process-file-to-string (&rest args) + (let* ((return-code 0) + (output + (with-output-to-string + (with-current-buffer + standard-output + (setq return-code + (apply #'process-file args)))))) + (cons return-code output))) + (provide 'config-setq) From a3cea590d5adfce4560e85f31fedb37fe1ebb747 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Jan 2020 15:43:20 -0800 Subject: [PATCH 049/303] Avoid shell-command-to-string in nadvice/xclip-selection-value --- modules/config-paste.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index 89d66ae9..1521c394 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -91,8 +91,9 @@ move the yanking point; just return the Nth kill forward." 'xclip-selection-value :around (my/defun-as-value nadvice/xclip-selection-value (old-fun &rest args) (let ((default-directory "/")) - (unless (string-match-p "^Error: Can't open display: .*\n$" - (shell-command-to-string "xclip -o > /dev/null")) + (unless (string-match-p + (rx bol "Error: Can't open display: ") + (cdr (my/process-file-to-string "xclip" nil t nil "-o"))) (apply old-fun args)))))) (use-package bracketed-paste From 6a52e9b58f08329fe90e196a1259ffbe9889469e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2020 16:35:25 -0800 Subject: [PATCH 050/303] Fix el-patch for recentf-used-hooks --- modules/config-desktop.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 2a132c5e..0f08e61b 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -297,7 +297,7 @@ where it was when you previously visited the same file." recentf-track-closed-file recentf-save-list) :init - + ;; TODO: Why is this necessary? (defun my/recentf-track-closed-file-maybe () (and buffer-file-name (recentf-track-closed-file))) @@ -305,12 +305,11 @@ where it was when you previously visited the same file." (el-patch-feature recentf) (el-patch-defconst recentf-used-hooks - '( - (find-file-hook recentf-track-opened-file) + '((find-file-hook recentf-track-opened-file) (write-file-functions recentf-track-opened-file) - (kill-buffer-hook my/recentf-track-closed-file-maybe) - (kill-emacs-hook recentf-save-list) - ) + (kill-buffer-hook (el-patch-swap recentf-track-closed-file + my/recentf-track-closed-file-maybe)) + (kill-emacs-hook recentf-save-list)) "Hooks used by recentf.") (add-hook From 822d2a220eaa6946af0816776a0e2400e4d721e9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2020 16:36:08 -0800 Subject: [PATCH 051/303] Update savehist el-patch --- modules/config-desktop.el | 55 +++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 0f08e61b..7f9808cf 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -126,13 +126,30 @@ To undo this, call `savehist-uninstall'." (el-patch-define-minor-mode savehist-mode "Toggle saving of minibuffer history (Savehist mode). With a prefix argument ARG, enable Savehist mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil. +positive, and disable it otherwise. If called from Lisp, +also enable the mode if ARG is omitted or nil. When Savehist mode is enabled, minibuffer history is saved -periodically and when exiting Emacs. When Savehist mode is -enabled for the first time in an Emacs session, it loads the -previous minibuffer history from `savehist-file'. +to `savehist-file' periodically and when exiting Emacs. When +Savehist mode is enabled for the first time in an Emacs session, +it loads the previous minibuffer histories from `savehist-file'. +The variable `savehist-autosave-interval' controls the +periodicity of saving minibuffer histories. + +If `savehist-save-minibuffer-history' is non-nil (the default), +all recorded minibuffer histories will be saved. You can arrange +for additional history variables to be saved and restored by +customizing `savehist-additional-variables', which by default is +an empty list. For example, to save the history of commands +invoked via \\[execute-extended-command], add `command-history' to the list in +`savehist-additional-variables'. + +Alternatively, you could customize `savehist-save-minibuffer-history' +to nil, and add to `savehist-additional-variables' only those +history variables you want to save. + +To ignore some history variables, add their symbols to the list +in `savehist-ignored-variables'. This mode should normally be turned on from your Emacs init file. Calling it at any other time replaces your current minibuffer @@ -141,21 +158,21 @@ histories, which is probably undesirable." (if (not savehist-mode) (savehist-uninstall) (when (and (not savehist-loaded) - (file-exists-p savehist-file)) + (file-exists-p savehist-file)) (condition-case errvar - (progn - ;; Don't set coding-system-for-read -- we rely on the - ;; coding cookie to convey that information. That way, if - ;; the user changes the value of savehist-coding-system, - ;; we can still correctly load the old file. - (load savehist-file nil (not (called-interactively-p 'interactive))) - (setq savehist-loaded t)) - (error - ;; Don't install the mode if reading failed. Doing so would - ;; effectively destroy the user's data at the next save. - (setq savehist-mode nil) - (savehist-uninstall) - (signal (car errvar) (cdr errvar))))) + (progn + ;; Don't set coding-system-for-read -- we rely on the + ;; coding cookie to convey that information. That way, if + ;; the user changes the value of savehist-coding-system, + ;; we can still correctly load the old file. + (load savehist-file nil (not (called-interactively-p 'interactive))) + (setq savehist-loaded t)) + (error + ;; Don't install the mode if reading failed. Doing so would + ;; effectively destroy the user's data at the next save. + (setq savehist-mode nil) + (savehist-uninstall) + (signal (car errvar) (cdr errvar))))) (savehist-install))) (savehist-mode +1) From 3d8b3517f13b6752a1d5dfb2daf36b2b476c4bb6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2020 16:58:32 -0800 Subject: [PATCH 052/303] Update projectile el-patches --- modules/config-vcs.el | 86 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 9 deletions(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index e7036111..69969e2f 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -365,7 +365,7 @@ tramp.") :link '(url-link :tag "Online Manual" "https://projectile.readthedocs.io/") :link '(emacs-commentary-link :tag "Commentary" "projectile")) - (el-patch-defcustom projectile-keymap-prefix (kbd "C-c p") + (el-patch-defcustom projectile-keymap-prefix nil "Projectile keymap prefix." :group 'projectile :type 'string) @@ -422,9 +422,13 @@ tramp.") (define-key map (kbd "v") #'projectile-vc) (define-key map (kbd "V") #'projectile-browse-dirty-projects) (define-key map (kbd "x e") #'projectile-run-eshell) + (define-key map (kbd "x i") #'projectile-run-ielm) (define-key map (kbd "x t") #'projectile-run-term) (define-key map (kbd "x s") #'projectile-run-shell) + (define-key map (kbd "x v") #'projectile-run-vterm) (define-key map (kbd "z") #'projectile-cache-current-file) + (define-key map (kbd "") #'projectile-previous-project-buffer) + (define-key map (kbd "") #'projectile-next-project-buffer) (define-key map (kbd "ESC") #'projectile-project-buffers-other-buffer) map) "Keymap for Projectile commands after `projectile-keymap-prefix'.") @@ -432,14 +436,65 @@ tramp.") (el-patch-defvar projectile-mode-map (let ((map (make-sparse-keymap))) - (define-key map projectile-keymap-prefix 'projectile-command-map) + (when projectile-keymap-prefix + (define-key map projectile-keymap-prefix 'projectile-command-map)) + (easy-menu-define projectile-mode-menu map + "Menu for Projectile" + '("Projectile" + ["Find file" projectile-find-file] + ["Find file in known projects" projectile-find-file-in-known-projects] + ["Find test file" projectile-find-test-file] + ["Find directory" projectile-find-dir] + ["Find file in directory" projectile-find-file-in-directory] + ["Find other file" projectile-find-other-file] + ["Switch to buffer" projectile-switch-to-buffer] + ["Jump between implementation file and test file" projectile-toggle-between-implementation-and-test] + ["Kill project buffers" projectile-kill-buffers] + ["Save project buffers" projectile-save-project-buffers] + ["Recent files" projectile-recentf] + ["Previous buffer" projectile-previous-project-buffer] + ["Next buffer" projectile-next-project-buffer] + "--" + ["Toggle project wide read-only" projectile-toggle-project-read-only] + ["Edit .dir-locals.el" projectile-edit-dir-locals] + "--" + ["Switch to project" projectile-switch-project] + ["Switch to open project" projectile-switch-open-project] + ["Discover projects in directory" projectile-discover-projects-in-directory] + ["Browse dirty projects" projectile-browse-dirty-projects] + ["Open project in dired" projectile-dired] + "--" + ["Search in project (grep)" projectile-grep] + ["Search in project (ag)" projectile-ag] + ["Replace in project" projectile-replace] + ["Multi-occur in project" projectile-multi-occur] + "--" + ["Run shell" projectile-run-shell] + ["Run eshell" projectile-run-eshell] + ["Run ielm" projectile-run-ielm] + ["Run term" projectile-run-term] + "--" + ["Cache current file" projectile-cache-current-file] + ["Invalidate cache" projectile-invalidate-cache] + ["Regenerate [e|g]tags" projectile-regenerate-tags] + "--" + ["Configure project" projectile-configure-project] + ["Compile project" projectile-compile-project] + ["Test project" projectile-test-project] + ["Run project" projectile-run-project] + ["Repeat last external command" projectile-repeat-last-command] + "--" + ["Project info" projectile-project-info] + ["About" projectile-version])) map) "Keymap for Projectile mode.") + (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) + (el-patch-defcustom projectile-indexing-method (if (eq system-type 'windows-nt) 'native 'alien) "Specifies the indexing method used by Projectile. -There are two indexing methods - native and alien. +There are three indexing methods - native, hybrid and alien. The native method is implemented in Emacs Lisp (therefore it is native to Emacs). Its advantage is that it is portable and will @@ -447,15 +502,28 @@ work everywhere that Emacs does. Its disadvantage is that it is a bit slow (especially for large projects). Generally it's a good idea to pair the native indexing method with caching. -The alien indexing method uses external tools (e.g. git, find, -etc) to speed up the indexing process. The disadvantage of this -method is that it's not well supported on Windows systems. - -By default alien indexing is the default on all operating -systems, except Windows." +The hybrid indexing method uses external tools (e.g. git, find, +etc) to speed up the indexing process. Still, the files will be +post-processed by Projectile for sorting/filtering purposes. +In this sense that approach is a hybrid between native indexing +and alien indexing. + +The alien indexing method optimizes to the limit the speed +of the hybrid indexing method. This means that Projectile will +not do any processing of the files returned by the external +commands and you're going to get the maximum performance +possible. This behaviour makes a lot of sense for most people, +as they'd typically be putting ignores in their VCS config and +won't care about any additional ignores/unignores/sorting that +Projectile might also provide. + +The disadvantage of the hybrid and alien methods is that they are not well +supported on Windows systems. That's why by default alien indexing is the +default on all operating systems, except Windows." :group 'projectile :type '(radio (const :tag "Native" native) + (const :tag "Hybrid" hybrid) (const :tag "Alien" alien))) (el-patch-defcustom projectile-enable-caching (eq projectile-indexing-method 'native) From 12a4306886cee60bc8a5f43acbde70f4af0c706e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2020 16:58:51 -0800 Subject: [PATCH 053/303] Update adaptive-wrap el-patches --- modules/config-whitespace.el | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index 1a54b4ef..def589d0 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -46,11 +46,20 @@ extra indent = 2 (make-variable-buffer-local 'adaptive-wrap-extra-indent) - (el-patch-defun adaptive-wrap-fill-context-prefix (beg en) + (el-patch-defun adaptive-wrap-fill-context-prefix (beg end) "Like `fill-context-prefix', but with length adjusted by `adaptive-wrap-extra-indent'." - ;; Note: fill-context-prefix may return nil; See: - ;; http://article.gmane.org/gmane.emacs.devel/156285 - (let* ((fcp (or (fill-context-prefix beg en) "")) + (let* ((fcp + ;; `fill-context-prefix' ignores prefixes that look like paragraph + ;; starts, in order to avoid inadvertently creating a new paragraph + ;; while filling, but here we're only dealing with single-line + ;; "paragraphs" and we don't actually modify the buffer, so this + ;; restriction doesn't make much sense (and is positively harmful in + ;; taskpaper-mode where paragraph-start matches everything). + (or (let ((paragraph-start "\\`\\'a")) + (fill-context-prefix beg end)) + ;; Note: fill-context-prefix may return nil; See: + ;; http://article.gmane.org/gmane.emacs.devel/156285 + "")) (fcp-len (string-width fcp)) (fill-char (if (< 0 fcp-len) (string-to-char (substring fcp -1)) @@ -81,19 +90,27 @@ extra indent = 2 (setq beg (point)) (while (< (point) end) (let ((lbp (point))) - (put-text-property (point) - (progn (search-forward "\n" end 'move) (point)) - 'wrap-prefix - (let ((pfx (adaptive-wrap-fill-context-prefix - lbp (point)))) - ;; Remove any `wrap-prefix' property that - ;; might have been added earlier. - ;; Otherwise, we end up with a string - ;; containing a `wrap-prefix' string - ;; containing a `wrap-prefix' string ... - (remove-text-properties - 0 (length pfx) '(wrap-prefix) pfx) - pfx)))) + (put-text-property + (point) (progn (search-forward "\n" end 'move) (point)) + 'wrap-prefix + (let ((pfx (adaptive-wrap-fill-context-prefix + lbp (point)))) + ;; Remove any `wrap-prefix' property that + ;; might have been added earlier. + ;; Otherwise, we end up with a string + ;; containing a `wrap-prefix' string + ;; containing a `wrap-prefix' string ... + (remove-text-properties + 0 (length pfx) '(wrap-prefix) pfx) + (let ((dp (get-text-property 0 'display pfx))) + (when (and dp (eq dp (get-text-property (1- lbp) 'display))) + ;; There's a `display' property which covers not just the + ;; prefix but also the previous newline. So it's not just making + ;; the prefix more pretty and could interfere or even defeat our + ;; efforts (e.g. it comes from `visual-fill-mode'). + (remove-text-properties + 0 (length pfx) '(display) pfx))) + pfx)))) `(jit-lock-bounds ,beg . ,end)) (el-patch-define-minor-mode adaptive-wrap-prefix-mode From 7ceea62e8e0287116291d75ae8ca60495115bcaa Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2020 16:59:16 -0800 Subject: [PATCH 054/303] Add :locate information to evil el-path-deftypes --- modules/config-package.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-package.el b/modules/config-package.el index 547000c0..b9e4fdbc 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -284,18 +284,22 @@ second, floating-point values are rounded down to the nearest integer.)" def-body)))) (el-patch-deftype evil-define-command :classify el-patch-classify-function + :locate el-patch-locate-function :declare ((doc-string 3) (indent defun))) (el-patch-deftype evil-define-motion :classify el-patch-classify-function + :locate el-patch-locate-function :declare ((doc-string 3) (indent defun))) (el-patch-deftype evil-define-text-object :classify el-patch-classify-function + :locate el-patch-locate-function :declare ((doc-string 3) (indent defun))) (el-patch-deftype evil-define-operator :classify el-patch-classify-function + :locate el-patch-locate-function :declare ((doc-string 3) (indent defun)))) From f0f413e12d4c83b9f16cc9acc13296966057d0e4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jan 2020 13:52:48 -0800 Subject: [PATCH 055/303] Update for poetry > 1.0.0 --- modules/config-python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index 0628b9e2..8234b79c 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -39,7 +39,7 @@ Return either a string or nil." ;; faster, but only works in poetry versions 1.0 and up (cl-destructuring-bind (return-code . output) (my/process-file-to-string "poetry" nil '(t nil) nil - "debug:info" + "debug" "-n" "--no-ansi") (when (and (= 0 return-code) From b0ef4fc0e67064c73e94996985c69946a027ad4a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 19 Jan 2020 13:03:30 -0500 Subject: [PATCH 056/303] Add binding for macrostep mode --- modules/config-modes.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index a2f67d3c..20124d13 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -83,7 +83,11 @@ (symbol-name sym-here))))))) (use-package macrostep :defer-install t - :commands (macrostep-mode macrostep-expand)) + :commands (macrostep-mode macrostep-expand) + :init + (define-key emacs-lisp-mode-map (kbd "C-c C-e") #'macrostep-expand) + :config + (evil-make-intercept-map macrostep-keymap)) ;; ============================================================================= ;; C-like ====================================================================== From fec43488f3789d9b488f168a95848d182525c863 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 19 Jan 2020 17:02:12 -0500 Subject: [PATCH 057/303] Use portry env instead of poetry debug for poetry >= 1.0 --- modules/config-python.el | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 8234b79c..8cfdc325 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -35,19 +35,15 @@ Return either a string or nil." (when (and (my/local-executable-find "poetry") (locate-dominating-file default-directory "pyproject.toml")) - ;; First, we try poetry debug:info, which is safe and a bit + ;; First, we try poetry env, which is safe and a bit ;; faster, but only works in poetry versions 1.0 and up (cl-destructuring-bind (return-code . output) (my/process-file-to-string "poetry" nil '(t nil) nil - "debug" - "-n" - "--no-ansi") - (when (and (= 0 return-code) - (string-match (rx "\n * Path: " - (group (1+ any)) - "\n * Valid:") - output)) - (cl-return (match-string 1 output)))) + "env" + "info" + "-p") + (when (= 0 return-code) + (cl-return output))) ;; Fall back to poetry <1.0 check TODO: This code ;; will become stale over time, so get rid of it ;; after a while. From 92f937aa58edcfa2459cd38ac69610771b4e7b4c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 25 Jan 2020 11:14:10 -0800 Subject: [PATCH 058/303] Patch lsp-ui-doc to delay request instead of delaying display --- modules/config-modes.el | 54 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 20124d13..82aedc3f 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1556,7 +1556,59 @@ ;; very expensive (setq lsp-ui-sideline-show-hover nil) (when (memq window-system '(mac ns)) - (setq lsp-ui-doc-use-childframe nil)))) + (setq lsp-ui-doc-use-childframe nil))) + + (with-eval-after-load 'lsp-ui-doc + (el-patch-feature lsp-ui-doc) + + (el-patch-defun lsp-ui-doc--make-request nil + "Request the documentation to the LS." + (when (and (not (eq this-command 'lsp-ui-doc-hide)) + (not (bound-and-true-p lsp-ui-peek-mode)) + (lsp--capability "hoverProvider")) + (-if-let (bounds (or (and (symbol-at-point) (bounds-of-thing-at-point 'symbol)) + (and (looking-at "[[:graph:]]") (cons (point) (1+ (point)))))) + (unless (equal lsp-ui-doc--bounds bounds) + (el-patch-add (lsp-ui-doc--hide-frame) + (and lsp-ui-doc--timer (cancel-timer lsp-ui-doc--timer))) + (el-patch-let + (($request + (lsp--send-request-async + (lsp--make-request "textDocument/hover" (lsp--text-document-position-params)) + (lambda (hover) (lsp-ui-doc--callback hover bounds (current-buffer)))))) + (el-patch-swap + $request + (setq lsp-ui-doc--timer + (run-with-idle-timer + lsp-ui-doc-delay nil + (lambda nil $request)))))) + (lsp-ui-doc--hide-frame)))) + + (el-patch-defun lsp-ui-doc--callback (hover bounds buffer) + "Process the received documentation. +HOVER is the doc returned by the LS. +BOUNDS are points of the symbol that have been requested. +BUFFER is the buffer where the request has been made." + (if (and hover + (>= (point) (car bounds)) (<= (point) (cdr bounds)) + (eq buffer (current-buffer))) + (progn + (setq lsp-ui-doc--bounds bounds) + (el-patch-remove (and lsp-ui-doc--timer (cancel-timer lsp-ui-doc--timer))) + (el-patch-let + (($display + (lsp-ui-doc--display + (thing-at-point 'symbol t) + (-some->> (gethash "contents" hover) + lsp-ui-doc--extract + (replace-regexp-in-string "\r" ""))))) + (el-patch-swap + (setq lsp-ui-doc--timer + (run-with-idle-timer + lsp-ui-doc-delay nil + (lambda nil $display))) + $display))) + (lsp-ui-doc--hide-frame))))) (use-package company-lsp :commands company-lsp) From 539a92c0454fdf13b0d598f35591ff2e038c2640 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 25 Jan 2020 20:32:55 -0800 Subject: [PATCH 059/303] Migrate from intero to Haskell IDE Engine --- modules/config-modes.el | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 82aedc3f..932ebdc5 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -370,26 +370,6 @@ ;; Haskell ===================================================================== ;; ============================================================================= -(use-package intero - :defer-install t - :commands (intero-mode - intero-mode-whitelis - intero-mode-blacklist - intero-global-mode - intero-highlight-uses-mode)) - -(use-package hindent - :defer-install t - :commands (hindent-mode - hindent-reformat-decl - hindent-reformat-buffer - hindent-reformat-decl-or-fill - hindent-reformat-region) - :config - (unless (executable-find "hindent") - (when (file-exists-p (expand-file-name "~/.local/bin/hindent")) - (setq hindent-process-path (expand-file-name "~/.local/bin/hindent"))))) - (use-package haskell :recipe haskell-mode :defer-install t @@ -500,11 +480,16 @@ :init (add-to-list 'completion-ignored-extensions ".hi")) -(use-package haskell-mode - :ensure nil - :config - (add-hook 'haskell-mode-hook #'intero-mode) - (add-hook 'haskell-mode-hook #'hindent-mode)) +(use-package lsp-haskell) + +(with-eval-after-load 'haskell-mode + (require 'lsp-haskell) + (add-hook 'haskell-mode-hook 'interactive-haskell-mode)) + +(with-eval-after-load 'haskell-interactive-mode + (evil-set-initial-state 'haskell-interactive-mode 'insert) + (setq haskell-process-suggest-remove-import-lines t + haskell-process-auto-import-loaded-modules t)) ;; ============================================================================= ;; Web Development ============================================================= From 25d1847d98660ecbe8e34672c745cd42dbd35249 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 3 Feb 2020 11:23:09 -0800 Subject: [PATCH 060/303] Fix flyspell-correct configuration --- modules/config-intel.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index de1c4142..63f25b4c 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -313,9 +313,9 @@ Return a selected word to use as a replacement or a tuple of (command, word) to be used by `flyspell-do-correct'.")) (use-package flyspell-correct - :commands (flyspell-correct-word-generic) :init - (define-key flyspell-mode-map (kbd "C-M-i") #'flyspell-correct-word-generic) + (with-eval-after-load 'flyspell + (define-key flyspell-mode-map (kbd "C-M-i") #'flyspell-correct-at-point)) :config (setq flyspell-correct-interface #'flyspell-correct-ivy)) From 6375e64231ca15b2d76cd23cb14b3bc614aa0e26 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 4 Feb 2020 13:04:38 -0800 Subject: [PATCH 061/303] Define a version of Haskell IDE Engine that runs over TRAMP --- modules/config-modes.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 932ebdc5..9a0d4fad 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -480,7 +480,14 @@ :init (add-to-list 'completion-ignored-extensions ".hi")) -(use-package lsp-haskell) +(use-package lsp-haskell + :config + (lsp-register-client + (make-lsp--client + :new-connection (lsp-tramp-connection (lambda () (lsp-haskell--hie-command))) + :major-modes '(haskell-mode) + :server-id 'hie-remote + :remote? t))) (with-eval-after-load 'haskell-mode (require 'lsp-haskell) From 3faa2b94889045dc1b94809093f9fe6ca5b27367 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 8 Feb 2020 22:20:29 -0800 Subject: [PATCH 062/303] Show lsp-ui-doc popup on the top right --- modules/config-modes.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 9a0d4fad..c13c7830 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1535,6 +1535,9 @@ ;; :hook (python-mode . lsp-deferred) :commands (lsp-mode) :config + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'lsp-mode))) (require 'yasnippet) (setq lsp-prefer-flymake nil lsp-auto-guess-root t @@ -1544,9 +1547,8 @@ :commands lsp-ui-mode :init (add-hook 'lsp-mode-hook 'lsp-ui-mode) - ;; TODO: This is only because texlab compiles on hover, which is - ;; very expensive - (setq lsp-ui-sideline-show-hover nil) + (setq lsp-ui-doc-position 'top) + (when (memq window-system '(mac ns)) (setq lsp-ui-doc-use-childframe nil))) From 37e3dd5d92eec5267fc216554e90e913d037adfe Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 11 Feb 2020 22:53:40 -0800 Subject: [PATCH 063/303] Run haskell-process-load-file once when using multiple-cursors --- data/.mc-lists.el | 1 + 1 file changed, 1 insertion(+) diff --git a/data/.mc-lists.el b/data/.mc-lists.el index 900bc94b..a87d8840 100644 --- a/data/.mc-lists.el +++ b/data/.mc-lists.el @@ -57,5 +57,6 @@ evil-normal-state evil-window-middle handle-select-window + haskell-process-load-file hydra/projectile-tools/body )) From a1376a997b3148b645cb1128fd7a8cf69ef33745 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 11 Feb 2020 22:54:07 -0800 Subject: [PATCH 064/303] Add some basic algebra terms --- data/user-dict.en.pws | 44 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index e4a71bf3..eb03f7c4 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,23 +1,33 @@ -personal_ws-1.1 en 22 -infimum +personal_ws-1.1 en 32 +Gaussians +Hayase +Lipschitz +Reidemeister +biconditional +bijection cardinality -nondecreasing colorable -durations -Gaussians -satisfiable colorings -Lipschitz conjugacy -surjection -nonincreasing -unknotted -Reidemeister -integrable -Hayase -subadditivity contrapositive -pointwise -nontrivially -bijection +durations +factorizations inequivalent +infimum +injective +integrable +integrands +irreducibles +nondecreasing +nonincreasing +nontrivially +pointwise +satisfiable +subadditivity +subfield +subring +subrings +superset +surjection +surjective +unknotted From 2246038be070c3f87362c6bb9966193a51e840e4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 25 Feb 2020 15:57:14 -0800 Subject: [PATCH 065/303] Add some more algebra and analysis terms --- data/user-dict.en.pws | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index eb03f7c4..21e2f82f 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,4 +1,4 @@ -personal_ws-1.1 en 32 +personal_ws-1.1 en 37 Gaussians Hayase Lipschitz @@ -18,6 +18,11 @@ injective integrable integrands irreducibles +cosets +durations +inequivalent +infimum +integrable nondecreasing nonincreasing nontrivially From 7c329cc3d5b2ff163fba995e77e20e68855cd583 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 1 Mar 2020 13:05:55 -0800 Subject: [PATCH 066/303] Use Skim on MacOS for TeX preview when possible --- modules/config-tex.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 823c3bd1..c2a264ec 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -122,6 +122,13 @@ PARAMS progress report notification data." (when (executable-find "zathura") (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Zathura")) + (when (executable-find "evince") + (add-to-list 'TeX-output-view-style '("^pdf$" "." "evince --page-index=%(outpage) %o"))) + + (when (and (eq system-type 'darwin) + (file-directory-p "/Applications/Skim.app")) + (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Skim")) + (defun my/LaTeX-format-name () (save-excursion (goto-char (point-min)) @@ -323,7 +330,6 @@ command." (magic-latex-buffer)))) (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) (add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode) - (add-to-list 'TeX-output-view-style '("^pdf$" "." "evince --page-index=%(outpage) %o")) (use-package auctex-latexmk :commands (auctex-latexmk-setup) From e4292c8d4389406088ba4820aaeb74d42c41fe9e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 3 Mar 2020 16:03:47 -0800 Subject: [PATCH 067/303] Always use local copy of fasd for directory jumping --- modules/config-helm.el | 125 +++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index fb8b0a23..8c22aefd 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -49,68 +49,69 @@ (use-package helm-files :ensure nil :config - (let (fasd-env-cache) - (defun my/fasd-execute (&rest args) - (require 's) - (require 'exec-path-from-shell) - (s-trim - (let* ((env (or fasd-env-cache - (setq fasd-env-cache - (exec-path-from-shell-getenvs - (list "PATH" "_FASD_DATA" "_FASD_FUZZY"))))) - (exec-path (parse-colon-path (cdr (assoc "PATH" env)))) - (fasd-path (executable-find "fasd")) - (process-environment process-environment)) - (cl-assert fasd-path nil "fasd not found!") - (add-to-list 'process-environment - (format "_FASD_DATA=%s" (cdr (assoc "_FASD_DATA" env)))) - (add-to-list 'process-environment - (format "_FASD_FUZZY=%s" (cdr (assoc "_FASD_FUZZY" env)))) - (with-output-to-string - (with-current-buffer - standard-output - (apply #'process-file fasd-path nil t nil args)))))) - - (defun helm-fasd-init () - (require 'exec-path-from-shell) - "Initialize async process for `helm-source-fasd'." - (let* ((env (or fasd-env-cache - (setq fasd-env-cache - (exec-path-from-shell-getenvs - (list "PATH" "_FASD_DATA" "_FASD_FUZZY"))))) - (exec-path (parse-colon-path (cdr (assoc "PATH" env)))) - (fasd-path (executable-find "fasd")) - (process-environment process-environment) - (cmd (concat fasd-path " -R -l -d " (shell-quote-argument helm-pattern)))) - (cl-assert fasd-path nil "fasd not found!") - (add-to-list 'process-environment - (format "_FASD_DATA=%s" (cdr (assoc "_FASD_DATA" env)))) - (add-to-list 'process-environment - (format "_FASD_FUZZY=%s" (cdr (assoc "_FASD_FUZZY" env)))) - (helm-log "Starting helm-fasd process") - (helm-log "Command line used was:\n\n%s" - (concat ">>> " (propertize cmd 'face 'font-lock-comment-face) "\n\n")) - (prog1 - (start-process - "fasd-process" helm-buffer - fasd-path "-R" "-l" "-d" helm-pattern) - (set-process-sentinel - (get-buffer-process helm-buffer) - #'(lambda (_process event) - (if (string= event "finished\n") - (with-helm-window - (setq mode-line-format - '(" " mode-line-buffer-identification " " - (:eval (format "L%s" (helm-candidate-number-at-point))) " " - (:eval (propertize - (format "[fasd process finished - (%s results)]" - (max (1- (count-lines - (point-min) (point-max))) - 0)) - 'face 'helm-locate-finish)))) - (force-mode-line-update)) - (helm-log "Error: Fasd %s" - (replace-regexp-in-string "\n" "" event))))))))) + (defvar my/fasd-env-cache nil "Cache for FASD environment variables") + (defun my/fasd-execute (&rest args) + (require 's) + (require 'exec-path-from-shell) + (s-trim + (let* ((default-directory "/") + (env (or my/fasd-env-cache + (setq my/fasd-env-cache + (exec-path-from-shell-getenvs + (list "PATH" "_FASD_DATA" "_FASD_FUZZY"))))) + (exec-path (parse-colon-path (cdr (assoc "PATH" env)))) + (fasd-path (executable-find "fasd")) + (process-environment process-environment)) + (cl-assert fasd-path nil "fasd not found!") + (add-to-list 'process-environment + (format "_FASD_DATA=%s" (cdr (assoc "_FASD_DATA" env)))) + (add-to-list 'process-environment + (format "_FASD_FUZZY=%s" (cdr (assoc "_FASD_FUZZY" env)))) + (with-output-to-string + (with-current-buffer + standard-output + (apply #'process-file fasd-path nil t nil args)))))) + + (defun helm-fasd-init () + (require 'exec-path-from-shell) + "Initialize async process for `helm-source-fasd'." + (let* ((env (or my/fasd-env-cache + (setq my/fasd-env-cache + (exec-path-from-shell-getenvs + (list "PATH" "_FASD_DATA" "_FASD_FUZZY"))))) + (exec-path (parse-colon-path (cdr (assoc "PATH" env)))) + (fasd-path (executable-find "fasd")) + (process-environment process-environment) + (cmd (concat fasd-path " -R -l -d " (shell-quote-argument helm-pattern)))) + (cl-assert fasd-path nil "fasd not found!") + (add-to-list 'process-environment + (format "_FASD_DATA=%s" (cdr (assoc "_FASD_DATA" env)))) + (add-to-list 'process-environment + (format "_FASD_FUZZY=%s" (cdr (assoc "_FASD_FUZZY" env)))) + (helm-log "Starting helm-fasd process") + (helm-log "Command line used was:\n\n%s" + (concat ">>> " (propertize cmd 'face 'font-lock-comment-face) "\n\n")) + (prog1 + (start-process + "fasd-process" helm-buffer + fasd-path "-R" "-l" "-d" helm-pattern) + (set-process-sentinel + (get-buffer-process helm-buffer) + #'(lambda (_process event) + (if (string= event "finished\n") + (with-helm-window + (setq mode-line-format + '(" " mode-line-buffer-identification " " + (:eval (format "L%s" (helm-candidate-number-at-point))) " " + (:eval (propertize + (format "[fasd process finished - (%s results)]" + (max (1- (count-lines + (point-min) (point-max))) + 0)) + 'face 'helm-locate-finish)))) + (force-mode-line-update)) + (helm-log "Error: Fasd %s" + (replace-regexp-in-string "\n" "" event)))))))) (defun my/helm-find-files-slash (arg) (interactive "p") From 25ba4a23cc53c2dca1b6270f9579ec77ba3febe6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 3 Mar 2020 16:04:16 -0800 Subject: [PATCH 068/303] Fix configuration of lsp-julia for modern Julia versions --- modules/config-modes.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index c13c7830..080c3a79 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -359,6 +359,8 @@ :repo "non-Jedi/lsp-julia") :init + (setq lsp-julia-package-dir nil + lsp-julia-default-environment "~/.julia/environments/v1.3") (require 'lsp-julia) (add-hook 'julia-mode-hook #'lsp-deferred)) From 46dc9036cc959bdcc2886a4bb2ae857c3367f265 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 4 Mar 2020 15:36:37 -0800 Subject: [PATCH 069/303] Remove lsp-ui-doc patches since they were accepted upstream --- modules/config-modes.el | 54 +---------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 080c3a79..8d5c5b24 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1552,59 +1552,7 @@ (setq lsp-ui-doc-position 'top) (when (memq window-system '(mac ns)) - (setq lsp-ui-doc-use-childframe nil))) - - (with-eval-after-load 'lsp-ui-doc - (el-patch-feature lsp-ui-doc) - - (el-patch-defun lsp-ui-doc--make-request nil - "Request the documentation to the LS." - (when (and (not (eq this-command 'lsp-ui-doc-hide)) - (not (bound-and-true-p lsp-ui-peek-mode)) - (lsp--capability "hoverProvider")) - (-if-let (bounds (or (and (symbol-at-point) (bounds-of-thing-at-point 'symbol)) - (and (looking-at "[[:graph:]]") (cons (point) (1+ (point)))))) - (unless (equal lsp-ui-doc--bounds bounds) - (el-patch-add (lsp-ui-doc--hide-frame) - (and lsp-ui-doc--timer (cancel-timer lsp-ui-doc--timer))) - (el-patch-let - (($request - (lsp--send-request-async - (lsp--make-request "textDocument/hover" (lsp--text-document-position-params)) - (lambda (hover) (lsp-ui-doc--callback hover bounds (current-buffer)))))) - (el-patch-swap - $request - (setq lsp-ui-doc--timer - (run-with-idle-timer - lsp-ui-doc-delay nil - (lambda nil $request)))))) - (lsp-ui-doc--hide-frame)))) - - (el-patch-defun lsp-ui-doc--callback (hover bounds buffer) - "Process the received documentation. -HOVER is the doc returned by the LS. -BOUNDS are points of the symbol that have been requested. -BUFFER is the buffer where the request has been made." - (if (and hover - (>= (point) (car bounds)) (<= (point) (cdr bounds)) - (eq buffer (current-buffer))) - (progn - (setq lsp-ui-doc--bounds bounds) - (el-patch-remove (and lsp-ui-doc--timer (cancel-timer lsp-ui-doc--timer))) - (el-patch-let - (($display - (lsp-ui-doc--display - (thing-at-point 'symbol t) - (-some->> (gethash "contents" hover) - lsp-ui-doc--extract - (replace-regexp-in-string "\r" ""))))) - (el-patch-swap - (setq lsp-ui-doc--timer - (run-with-idle-timer - lsp-ui-doc-delay nil - (lambda nil $display))) - $display))) - (lsp-ui-doc--hide-frame))))) + (setq lsp-ui-doc-use-childframe nil)))) (use-package company-lsp :commands company-lsp) From daa2a0861a2a2a64e936adc39648bda36a835415 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 4 Mar 2020 15:39:05 -0800 Subject: [PATCH 070/303] Add alex-mode and happy-mode --- modules/config-modes.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 8d5c5b24..a971903b 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -500,6 +500,37 @@ (setq haskell-process-suggest-remove-import-lines t haskell-process-auto-import-loaded-modules t)) +(use-package alex-mode + :recipe (alex-mode :host github + :repo "sergv/dotemacs" + :files ("src/haskell/alex-mode.el") + :nonrecursive t) + :defer-install t + :commands (alex-mode) + :init + + (provide 'common) + + (defmacro defparameter (var &optional value doc) + "Just like CL's defparameter, sets variable value when evaluated." + (let ((tmp-var '#:store)) + `(progn + (setf ,tmp-var ,value) + (if (boundp ',var) + (setf ,var ,tmp-var) + (defvar ,var ,tmp-var ,doc)) + nil))) + + :mode "\\.x\\'") + +(use-package happy-mode + :recipe (happy-mode :host github :repo "sergv/happy-mode") + :defer-install t + :commands (happy-mode) + :mode "\\.y\\'" + :init + (use-package mmm-mode)) + ;; ============================================================================= ;; Web Development ============================================================= ;; ============================================================================= From 1635aa9e2a3222eaa58eb2acf03c0ae3975fec20 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 4 Mar 2020 15:45:00 -0800 Subject: [PATCH 071/303] Fix indentation in alex-mode --- modules/config-modes.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index a971903b..9dd7d48a 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -521,7 +521,9 @@ (defvar ,var ,tmp-var ,doc)) nil))) - :mode "\\.x\\'") + :mode "\\.x\\'" + :config + (defalias 'alex-indent-line #'indent-relative)) (use-package happy-mode :recipe (happy-mode :host github :repo "sergv/happy-mode") From f9bc42be764170085de8076804fa3a793d0e80a6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 10:13:54 -0800 Subject: [PATCH 072/303] Add mode for llvm bytecode --- modules/config-modes.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 9dd7d48a..7333f226 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1564,6 +1564,14 @@ floobits-clear-highlights floobits-add-to-workspace)) +(use-package llvm-mode + :recipe (llvm-mode :host github + :repo "llvm-mirror/llvm" + :files ("utils/emacs/llvm-mode.el")) + :defer-install t + :commands (llvm-mode) + :mode ("\\.ll\\'" . llvm-mode)) + ;;; LSP (use-package lsp-mode From 3d66a45f7309579b8377e567762eae37062b8073 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 10:14:42 -0800 Subject: [PATCH 073/303] Add some computability and algebra terms --- data/user-dict.en.pws | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index 21e2f82f..20768d6c 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,4 +1,4 @@ -personal_ws-1.1 en 37 +personal_ws-1.1 en 39 Gaussians Hayase Lipschitz @@ -11,7 +11,9 @@ colorings conjugacy contrapositive durations +equisatisfiable factorizations +indeterminates inequivalent infimum injective From d12b27429a00218205acda04c4c3d01d344c9595 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:16:12 -0800 Subject: [PATCH 074/303] Do not assume semantic is loaded in python configuration --- modules/config-python.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index 8cfdc325..2e599053 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -120,7 +120,8 @@ Return either a string or nil." (add-hook 'python-mode-hook (lambda () ;; conflicts with `eldoc-mode' - (semantic-idle-summary-mode -1) + (when (bound-and-true-p semantic-idle-summary-mode) + (semantic-idle-summary-mode -1)) (setq mode-name "Py"))) (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) From a508a3906e3f491dda936830eba491bfda8b8127 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:24:34 -0800 Subject: [PATCH 075/303] Implement python virtualenv path caching, local poetry support --- modules/config-python.el | 48 ++++++++++++++++++++++++++++++++++++---- modules/config-setq.el | 2 +- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 2e599053..9082f8d6 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -9,9 +9,10 @@ (defun my/local-executable-find (name) ;; TODO: This should be moved out of config-python (if (tramp-tramp-file-p default-directory) - (with-parsed-tramp-file-name default-directory vec + (substring-no-properties + (with-parsed-tramp-file-name default-directory vec (tramp-find-executable - vec name (tramp-get-remote-path vec) t t)) + vec name (tramp-get-remote-path vec) t t))) (executable-find name))) (defun my/tramp-build-name-from-localname (localname) @@ -73,6 +74,25 @@ Return either a string or nil." (when (file-directory-p universal-path) universal-path))) +(defvar my/python-virtualenv-cache nil) +(add-to-list 'savehist-additional-variables 'my/python-virtualenv-cache) +(defun my/python-find-virtualenv-cached (&optional dir) + (let* ((dir (or dir default-directory)) + (pyproject (locate-dominating-file dir "pyproject.toml"))) + (unless my/python-virtualenv-cache + (setq my/python-virtualenv-cache (make-hash-table :test #'equal))) + (if (and (my/local-executable-find "poetry") + dir + (not (file-exists-p (expand-file-name ".venv" dir)))) + (let ((cached (or (gethash dir my/python-virtualenv-cache) + (puthash dir + (my/python-find-virtualenv dir) + my/python-virtualenv-cache)))) + (if (file-exists-p cached) + cached + (my/python-find-virtualenv dir))) + (my/python-find-virtualenv dir)))) + (with-eval-after-load 'pythonic (eval-when-compile (with-demoted-errors "Load error: %s" @@ -107,7 +127,7 @@ Return either a string or nil." :config (defun nadvice/pyvenv-activate (&optional arg) (interactive "P") - (let ((default-venv (my/python-find-virtualenv))) + (let ((default-venv (my/python-find-virtualenv-cached))) (if (or (not default-venv) (consp (car arg))) (list (read-directory-name "Activate venv: ")) (list default-venv)))) @@ -166,6 +186,26 @@ Return either a string or nil." (eval-when-compile (with-demoted-errors "Load error: %s" (require 'lsp-mode))) + (lsp-register-client + (make-lsp-client + :new-connection + (lsp-stdio-connection + (my/defun-as-value my/python-find-project-pyls () + (let ((pyls-path (expand-file-name + "bin/pyls" + (my/python-find-virtualenv-cached)))) + (when (file-executable-p pyls-path) + pyls-path)))) + :major-modes '(python-mode) + :server-id 'pyls-poetry + :library-folders-fn + (lambda (_workspace) + lsp-clients-python-library-directories) + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (lsp-configuration-section "pyls")))))) + (lsp-register-client (make-lsp-client :new-connection @@ -173,7 +213,7 @@ Return either a string or nil." (my/defun-as-value my/python-find-project-pyls () (let ((pyls-path (expand-file-name "bin/pyls" - (my/python-find-virtualenv)))) + (my/python-find-virtualenv-cached)))) (when (file-executable-p pyls-path) (with-parsed-tramp-file-name pyls-path parsed parsed-localname))))) diff --git a/modules/config-setq.el b/modules/config-setq.el index 62744aef..f3a94c96 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -282,6 +282,6 @@ response as a no." standard-output (setq return-code (apply #'process-file args)))))) - (cons return-code output))) + (cons return-code (substring-no-properties output)))) (provide 'config-setq) From fc0f2ca03a8e76002100a92b9b330df9b35b8e70 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:31:46 -0800 Subject: [PATCH 076/303] Make it easier to reset my/pythonic-host-cache --- modules/config-python.el | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 9082f8d6..9eda08e7 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -98,29 +98,28 @@ Return either a string or nil." (with-demoted-errors "Load error: %s" (require 'tramp))) - (let (my/pythonic-remote-host-cache) - (defun nadvice/pythonic-remote-host () - "Get host of the connection to the remote python interpreter." - (unless my/pythonic-remote-host-cache - (setq my/pythonic-remote-host-cache (make-hash-table :test #'equal))) - - (with-parsed-tramp-file-name default-directory parsed - (let ((hostname (replace-regexp-in-string "#.*\\'" "" parsed-host))) - (if (member parsed-method '("ssh" - "scp" - "scpx" - "sshx" - "rsync")) - (or (gethash hostname my/pythonic-remote-host-cache) - (puthash hostname - (with-temp-buffer - (call-process "ssh" nil t nil "-G" hostname) - (goto-char (point-min)) - (search-forward "\nhostname ") - (buffer-substring-no-properties (point) (line-end-position))) - my/pythonic-remote-host-cache)) - hostname))))) - + (defvar my/pythonic-remote-host-cache nil) + (defun nadvice/pythonic-remote-host () + "Get host of the connection to the remote python interpreter." + (unless my/pythonic-remote-host-cache + (setq my/pythonic-remote-host-cache (make-hash-table :test #'equal))) + + (with-parsed-tramp-file-name default-directory parsed + (let ((hostname (replace-regexp-in-string "#.*\\'" "" parsed-host))) + (if (member parsed-method '("ssh" + "scp" + "scpx" + "sshx" + "rsync")) + (or (gethash hostname my/pythonic-remote-host-cache) + (puthash hostname + (with-temp-buffer + (call-process "ssh" nil t nil "-G" hostname) + (goto-char (point-min)) + (search-forward "\nhostname ") + (buffer-substring-no-properties (point) (line-end-position))) + my/pythonic-remote-host-cache)) + hostname)))) (advice-add 'pythonic-remote-host :override #'nadvice/pythonic-remote-host)) (use-package pyvenv From 8be6ff2c85dfa9afc9ae0b26be712bc46da73120 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:32:55 -0800 Subject: [PATCH 077/303] Optimize usage of looking-back in ml/search --- modules/config-tex.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index c2a264ec..ec0e8f55 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -215,7 +215,32 @@ command." (set-face-attribute 'ml/llarge nil :height 1.25) (set-face-attribute 'ml/xlarge nil :height 1.3) (set-face-attribute 'ml/huge nil :height 1.35) - (set-face-attribute 'ml/hhuge nil :height 1.4)) + (set-face-attribute 'ml/hhuge nil :height 1.4) + + (el-patch-feature magic-latex-buffer) + (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) + "Like `search-regexp' but skips escaped chars, comments and +verbish environments. This function raise an error on +failure. When POINT-SAFE is non-nil, the point must not be in the +matching string." + (ml/safe-excursion + (let ((case-fold-search nil)) + (if backward + (search-backward-regexp regex bound) + (search-forward-regexp regex bound))) + (or (save-match-data + (save-excursion + (and (goto-char (match-beginning 0)) + (not (and point-safe + (< (point) ml/jit-point) + (< ml/jit-point (match-end 0)))) + (looking-back (el-patch-swap + "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" + (rx (or (not-char "\\") bol) + (zero-or-more "\\\\"))) + (el-patch-add (line-beginning-position))) + (not (ml/skip-comments-and-verbs backward))))) + (ml/search-regexp regex bound backward point-safe))))) (add-hook 'TeX-mode-hook #'lsp-deferred) From 5b23c75f574839c5c16a91a5c7240211a4a363fa Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:35:50 -0800 Subject: [PATCH 078/303] Disable semantic by default --- modules/config-intel.el | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 63f25b4c..9df3eee1 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -77,9 +77,6 @@ by doing (clear-string STRING)." (use-package semantic :ensure nil :init - ;; enable semantic code LALR(1) parser - (add-hook 'prog-mode-hook #'semantic-mode) - (with-eval-after-load 'semantic/db-file (advice-add 'semanticdb-file-directory-exists-p :around @@ -93,10 +90,6 @@ by doing (clear-string STRING)." srecode-map-save-file (locate-user-emacs-file "data/srecode-map.el")) - (global-semanticdb-minor-mode +1) - (global-semantic-idle-scheduler-mode +1) - (global-semantic-idle-summary-mode +1) - (advice-add 'semantic-idle-summary-idle-function :around (my/defun-as-value nadvice/semantic-idle-summary-idle-function (old-fun &rest args) From 8c16f314efa3ba98653d5c8eb61d0f3514149408 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 11:36:13 -0800 Subject: [PATCH 079/303] Reenable undo-in-region --- modules/config-undo.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-undo.el b/modules/config-undo.el index df93a686..c2503bd9 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -14,7 +14,7 @@ ;; It sounds like an interesting feature, but unfortunately ;; the implementation is very buggy and regularly causes you ;; to lose your undo history. - undo-tree-enable-undo-in-region nil + undo-tree-enable-undo-in-region t undo-tree-history-directory-alist `((,(rx (zero-or-more anything)) . ,(expand-file-name (locate-user-emacs-file "data/undo-backups/"))))) From 631b6bee093718de4a5b344c287f5b5f7f9b94d1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Mar 2020 16:35:10 -0800 Subject: [PATCH 080/303] Move some TRAMP helper functions out of config-python --- modules/config-python.el | 20 -------------------- modules/config-setq.el | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 9eda08e7..88df012c 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -6,26 +6,6 @@ ;; Python ====================================================================== ;; ============================================================================= -(defun my/local-executable-find (name) - ;; TODO: This should be moved out of config-python - (if (tramp-tramp-file-p default-directory) - (substring-no-properties - (with-parsed-tramp-file-name default-directory vec - (tramp-find-executable - vec name (tramp-get-remote-path vec) t t))) - (executable-find name))) - -(defun my/tramp-build-name-from-localname (localname) - (with-parsed-tramp-file-name default-directory parsed - (tramp-make-tramp-file-name - parsed-method - parsed-user - parsed-domain - parsed-host - parsed-port - localname - parsed-hop))) - (defun my/python-find-virtualenv (&optional dir) "Find a virtualenv corresponding to the current buffer. Return either a string or nil." diff --git a/modules/config-setq.el b/modules/config-setq.el index f3a94c96..235ebcfb 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -284,4 +284,25 @@ response as a no." (apply #'process-file args)))))) (cons return-code (substring-no-properties output)))) +(defun my/local-executable-find (name) + (if (tramp-tramp-file-p default-directory) + (let ((response (with-parsed-tramp-file-name default-directory vec + (tramp-find-executable + vec name (tramp-get-remote-path vec) t t)))) + (if (stringp response) + (substring-no-properties response) + response)) + (executable-find name))) + +(defun my/tramp-build-name-from-localname (localname) + (with-parsed-tramp-file-name default-directory parsed + (tramp-make-tramp-file-name + parsed-method + parsed-user + parsed-domain + parsed-host + parsed-port + localname + parsed-hop))) + (provide 'config-setq) From d8c6f829284eff4a5d853fc4fb423bebe2b76666 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 7 Mar 2020 02:19:01 -0800 Subject: [PATCH 081/303] Support remote microsoft python language servers --- modules/config-python.el | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 88df012c..81c8634b 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -136,6 +136,29 @@ Return either a string or nil." (lsp-deferred)))) :config + (lsp-register-client + (make-lsp-client + :new-connection (lsp-tramp-connection + (my/defun-as-value my/python-find-mspyls () + (my/local-executable-find "mspyls"))) + :major-modes (append '(python-mode) lsp-python-ms-extra-major-modes) + :remote? t + :server-id 'mspyls-remote + :priority -2 + :initialization-options 'lsp-python-ms--extra-init-params + :notification-handlers + (lsp-ht ("python/languageServerStarted" + 'lsp-python-ms--language-server-started-callback) + ("telemetry/event" 'ignore) + ("python/reportProgress" + 'lsp-python-ms--report-progress-callback) + ("python/beginProgress" 'lsp-python-ms--begin-progress-callback) + ("python/endProgress" 'lsp-python-ms--end-progress-callback)) + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (lsp-configuration-section "python")))))) + ;; when on arch, check if we can use the system ls (let ((system-ls "/usr/lib/microsoft-python-language-server/") (system-ls-bin (executable-find "mspyls"))) @@ -153,11 +176,17 @@ Return either a string or nil." 'lsp-python-ms--extra-init-params :before (my/defun-as-value my/lsp-python-ms-discover-virtualenvs (&rest _) ;; Stolen from raxod502/radian - (when-let ((venv (my/python-find-virtualenv))) + (when-let ((venv (my/python-find-virtualenv-cached))) (setq-local lsp-python-ms-extra-paths + (mapcar (lambda (path) + (if (tramp-tramp-file-p path) + (with-parsed-tramp-file-name path parsed + parsed-localname) + path) + ) (file-expand-wildcards (expand-file-name - "lib/python*/site-packages" venv)))))))) + "lib/python*/site-packages" venv))))))))) (add-hook 'python-mode-hook #'eldoc-mode) @@ -198,6 +227,7 @@ Return either a string or nil." parsed-localname))))) :major-modes '(python-mode) :remote? t + :priority -3 :server-id 'pyls-remote :library-folders-fn (lambda (_workspace) From 23d99e143d5720b22f6885f071bb4efcad7b8524 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Mar 2020 14:49:42 -0700 Subject: [PATCH 082/303] Automatically use the most recent Julia environment --- modules/config-modes.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 7333f226..e506dadb 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -360,7 +360,9 @@ :init (setq lsp-julia-package-dir nil - lsp-julia-default-environment "~/.julia/environments/v1.3") + lsp-julia-default-environment + (car (last (file-expand-wildcards + (expand-file-name "~/.julia/environments/v*"))))) (require 'lsp-julia) (add-hook 'julia-mode-hook #'lsp-deferred)) From ce53e19ce69913e5c59afdff2fcff857957d94d8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Mar 2020 14:50:22 -0700 Subject: [PATCH 083/303] Tweak checksum behavior in pkgbuild-mode --- modules/config-modes.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index e506dadb..c7f26b6c 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1128,7 +1128,20 @@ (use-package pkgbuild-mode :defer-install t :commands (pkgbuild-mode) - :mode (("/PKGBUILD\\'" . pkgbuild-mode))) + :mode (("/PKGBUILD\\'" . pkgbuild-mode)) + :config + (setq pkgbuild-update-sums-on-save nil) + + (el-patch-feature pkgbuild-mode) + (el-patch-defun pkgbuild-update-sums-line-hook () + "Update sum lines if the file was modified" + (if (and pkgbuild-update-sums-on-save (not pkgbuild-in-hook-recursion)) + (progn + (setq pkgbuild-in-hook-recursion t) + (save-buffer) ;always save BUFFER 2 times so we get the correct sums in this hook + (el-patch-add (message "Recalculating sums...")) + (setq pkgbuild-in-hook-recursion nil) + (pkgbuild-update-sums-line))))) (use-package pacfiles-mode :defer-install t From aa02b3923bd3168d925cfc2b1dfc9ae5cbca8374 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Mar 2020 14:55:36 -0700 Subject: [PATCH 084/303] Remove some major-modes that have never been used --- modules/config-modes.el | 47 ---------------------------------------- modules/config-python.el | 6 ----- 2 files changed, 53 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index c7f26b6c..511e73e4 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -114,14 +114,6 @@ :mode (("\\.cu\\'" . cuda-mode) ("\\.cuh\\'" . cuda-mode))) -(use-package glsl-mode - :defer-install t - :commands (glsl-mode) - :mode (("\\.vert\\'" . glsl-mode) - ("\\.frag\\'" . glsl-mode) - ("\\.geom\\'" . glsl-mode) - ("\\.glsl\\'" . glsl-mode))) - (use-package asy-mode :defer-install t :commands (asy-mode) @@ -298,14 +290,6 @@ (sh-font-lock-quoted-subshell end))))))) (point) end))) -(use-package fish-mode - :defer-install t - :commands (fish_indent-before-save - fish-mode) - :mode (("\\.fish\\'" . fish-mode) - ("/fish_funced\\..*\\'" . fish-mode)) - :interpreter ("fish" . fish-mode)) - ;; ============================================================================= ;; PowerShell Scripts ========================================================== ;; ============================================================================= @@ -628,11 +612,6 @@ ("\\.amk$" . php-mode)) :interpreter ("php" . php-mode)) -(use-package dart-mode - :defer-install t - :commands (dart-mode) - :mode ("\\.dart\\'" . dart-mode)) - (use-package typescript-mode :defer-install t :commands (typescript-mode) @@ -647,12 +626,6 @@ (add-hook 'typescript-mode-hook #'tide-setup)) -(use-package handlebars-mode - :defer-install t - :commands (handlebars-mode) - :mode (("\\.handlebars$" . handlebars-mode) - ("\\.hbs$" . handlebars-mode))) - (use-package impatient-mode :defer-install t :commands (impatient-mode)) @@ -1198,11 +1171,6 @@ :commands (yaml-mode) :mode (("\\.e?ya?ml$" . yaml-mode))) -(use-package haml-mode - :defer-install t - :commands (haml-mode) - :mode (("\\.haml\\'" . haml-mode))) - (use-package markdown-mode :defer-install t :commands (markdown-mode gfm-mode) @@ -1219,11 +1187,6 @@ markdown-preview-cleanup markdown-preview-mode)) -(use-package bbcode-mode - :defer-install t - :commands (bbcode-mode) - :mode (("\\.bbcode$" . bbcode-mode))) - ;; ============================================================================= ;; Org mode ==================================================================== ;; ============================================================================= @@ -1531,11 +1494,6 @@ :commands (gap-mode) :mode ("\\.\\(g\\(?:ap\\|[di]\\)?\\)\\'" . gap-mode)) -(use-package fstar-mode - :defer-install t - :commands (fstar-mode) - :mode ("\\.fsti?\\'" . fstar-mode)) - (use-package sml-mode :defer-install t :commands (run-sml @@ -1552,11 +1510,6 @@ (add-to-list 'completion-ignored-extensions ".cm/") (add-to-list 'completion-ignored-extensions "CM/")) -(use-package salt-mode - :defer-install t - :commands (salt-mode) - :mode ("\\.sls\\'" . salt-mode)) - (use-package ahk-mode :defer-install t :commands (ahk-mode) diff --git a/modules/config-python.el b/modules/config-python.el index 81c8634b..79533d50 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -248,12 +248,6 @@ Return either a string or nil." :commands (blacken-buffer blacken-mode))) -(use-package django-html-mode - :recipe django-mode - :defer-install t - :commands (django-html-mode) - :mode ("\\.djhtml$" . django-html-mode)) - (use-package cython-mode :defer-install t :commands (cython-mode) From fb73eafdd8d526fefd2eeab9b52ef1cbc9bf83f1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Mar 2020 15:00:15 -0700 Subject: [PATCH 085/303] Move rainbow-delimiters into config-ui --- modules/config-rainbow-delimiters.el | 77 --------------------------- modules/config-ui.el | 78 ++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 77 deletions(-) delete mode 100644 modules/config-rainbow-delimiters.el diff --git a/modules/config-rainbow-delimiters.el b/modules/config-rainbow-delimiters.el deleted file mode 100644 index 44be7605..00000000 --- a/modules/config-rainbow-delimiters.el +++ /dev/null @@ -1,77 +0,0 @@ -;; -*- lexical-binding: t -*- - -(use-package rainbow-delimiters - :init - ;; the equivalent of a global mode, but does not - ;; turn on for odd non-programming modes - (defun my/maybe-enable-rainbow-delimiters () - (when (display-graphic-p) - (rainbow-delimiters-mode +1))) - - (unless (bound-and-true-p my/slow-device) - (add-hook 'prog-mode-hook #'my/maybe-enable-rainbow-delimiters) - (add-hook 'text-mode-hook #'my/maybe-enable-rainbow-delimiters)) - - :config - (defvar-local my/rainbow-delimiters-switch nil - "t if rainbow-delimiters are currently punched") - (defvar-local my/rainbow-delimiters-face-cookies nil - "a list of face-remap-add-relative cookies to reset") - - (defun my/rainbow-delimiters-setup-faces () - (set-face-foreground 'rainbow-delimiters-depth-1-face "#889899") - (set-face-foreground 'rainbow-delimiters-depth-2-face "#9b7b6b") - (set-face-foreground 'rainbow-delimiters-depth-3-face "#7b88a5") - (set-face-foreground 'rainbow-delimiters-depth-4-face "#889899") - (set-face-foreground 'rainbow-delimiters-depth-5-face "#839564") - (set-face-foreground 'rainbow-delimiters-depth-6-face "#6391aa") - (set-face-foreground 'rainbow-delimiters-depth-7-face "#9d748f") - (set-face-foreground 'rainbow-delimiters-depth-8-face "#7b88a5") - (set-face-foreground 'rainbow-delimiters-depth-9-face "#659896")) - - (my/rainbow-delimiters-setup-faces) - (add-hook 'load-theme-hook #'my/rainbow-delimiters-setup-faces) - - (defun my/rainbow-delimiters-focus-on () - "Punch the rainbow-delimiters" - (setq my/rainbow-delimiters-face-cookies - (list - (face-remap-add-relative 'rainbow-delimiters-depth-1-face - '((:foreground "#3B9399") rainbow-delimiters-depth-1-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-2-face - '((:foreground "#9B471D") rainbow-delimiters-depth-2-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-3-face - '((:foreground "#284FA5") rainbow-delimiters-depth-3-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-4-face - '((:foreground "#3B9399") rainbow-delimiters-depth-4-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-5-face - '((:foreground "#679519") rainbow-delimiters-depth-5-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-6-face - '((:foreground "#0E73AA") rainbow-delimiters-depth-6-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-7-face - '((:foreground "#9D2574") rainbow-delimiters-depth-7-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-8-face - '((:foreground "#284FA5") rainbow-delimiters-depth-8-face)) - (face-remap-add-relative 'rainbow-delimiters-depth-9-face - '((:foreground "#199893") rainbow-delimiters-depth-9-face))) - my/rainbow-delimiters-switch t)) - - (defun my/rainbow-delimiters-focus-off () - "Reset the rainbow-delimiters faces" - (mapc #'face-remap-remove-relative my/rainbow-delimiters-face-cookies) - (setq my/rainbow-delimiters-switch nil)) - - (defun my/rainbow-delimiters-focus-toggle-maybe () - "Punch the rainbow-delimiters if the point is on a paren" - (if (or (looking-at (rx (any "[](){}"))) - (and - (evil-insert-state-p) - (looking-back (rx (any "[](){}")) (1- (point))))) - (unless (or my/rainbow-delimiters-switch (minibufferp)) - (my/rainbow-delimiters-focus-on)) - (when my/rainbow-delimiters-switch - (my/rainbow-delimiters-focus-off)))) - - (run-with-idle-timer 0.1 t 'my/rainbow-delimiters-focus-toggle-maybe)) - -(provide 'config-rainbow-delimiters) diff --git a/modules/config-ui.el b/modules/config-ui.el index 86146c63..e8432f53 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -140,6 +140,84 @@ (global-set-key (kbd "C-x ^") #'my/window-resize-hydra/lambda-^) (global-set-key (kbd "C-x -") #'my/window-resize-hydra/lambda--) +;;; =================================================== +;;; Rainbow-delimiters - Easily see paren nesting level +;;; ===================================================g + +(use-package rainbow-delimiters + :init + ;; the equivalent of a global mode, but does not + ;; turn on for odd non-programming modes + (defun my/maybe-enable-rainbow-delimiters () + (when (display-graphic-p) + (rainbow-delimiters-mode +1))) + + (unless (bound-and-true-p my/slow-device) + (add-hook 'prog-mode-hook #'my/maybe-enable-rainbow-delimiters) + (add-hook 'text-mode-hook #'my/maybe-enable-rainbow-delimiters)) + + :config + (defvar-local my/rainbow-delimiters-switch nil + "t if rainbow-delimiters are currently punched") + (defvar-local my/rainbow-delimiters-face-cookies nil + "a list of face-remap-add-relative cookies to reset") + + (defun my/rainbow-delimiters-setup-faces () + (set-face-foreground 'rainbow-delimiters-depth-1-face "#889899") + (set-face-foreground 'rainbow-delimiters-depth-2-face "#9b7b6b") + (set-face-foreground 'rainbow-delimiters-depth-3-face "#7b88a5") + (set-face-foreground 'rainbow-delimiters-depth-4-face "#889899") + (set-face-foreground 'rainbow-delimiters-depth-5-face "#839564") + (set-face-foreground 'rainbow-delimiters-depth-6-face "#6391aa") + (set-face-foreground 'rainbow-delimiters-depth-7-face "#9d748f") + (set-face-foreground 'rainbow-delimiters-depth-8-face "#7b88a5") + (set-face-foreground 'rainbow-delimiters-depth-9-face "#659896")) + + (my/rainbow-delimiters-setup-faces) + (add-hook 'load-theme-hook #'my/rainbow-delimiters-setup-faces) + + (defun my/rainbow-delimiters-focus-on () + "Punch the rainbow-delimiters" + (setq my/rainbow-delimiters-face-cookies + (list + (face-remap-add-relative 'rainbow-delimiters-depth-1-face + '((:foreground "#3B9399") rainbow-delimiters-depth-1-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-2-face + '((:foreground "#9B471D") rainbow-delimiters-depth-2-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-3-face + '((:foreground "#284FA5") rainbow-delimiters-depth-3-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-4-face + '((:foreground "#3B9399") rainbow-delimiters-depth-4-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-5-face + '((:foreground "#679519") rainbow-delimiters-depth-5-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-6-face + '((:foreground "#0E73AA") rainbow-delimiters-depth-6-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-7-face + '((:foreground "#9D2574") rainbow-delimiters-depth-7-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-8-face + '((:foreground "#284FA5") rainbow-delimiters-depth-8-face)) + (face-remap-add-relative 'rainbow-delimiters-depth-9-face + '((:foreground "#199893") rainbow-delimiters-depth-9-face))) + my/rainbow-delimiters-switch t)) + + (defun my/rainbow-delimiters-focus-off () + "Reset the rainbow-delimiters faces" + (mapc #'face-remap-remove-relative my/rainbow-delimiters-face-cookies) + (setq my/rainbow-delimiters-switch nil)) + + (defun my/rainbow-delimiters-focus-toggle-maybe () + "Punch the rainbow-delimiters if the point is on a paren" + (if (or (looking-at (rx (any "[](){}"))) + (and + (evil-insert-state-p) + (looking-back (rx (any "[](){}")) (1- (point))))) + (unless (or my/rainbow-delimiters-switch (minibufferp)) + (my/rainbow-delimiters-focus-on)) + (when my/rainbow-delimiters-switch + (my/rainbow-delimiters-focus-off)))) + + (run-with-idle-timer 0.1 t 'my/rainbow-delimiters-focus-toggle-maybe)) + ;;; ==================================== ;;; iflib - switch buffers alt-tab style ;;; ==================================== From 94c696a7f94e6f0b69239993b2640652f492b4af Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Mar 2020 15:03:19 -0700 Subject: [PATCH 086/303] Add some misc evil-commands to mc-lists --- data/.mc-lists.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/.mc-lists.el b/data/.mc-lists.el index a87d8840..ae76c00d 100644 --- a/data/.mc-lists.el +++ b/data/.mc-lists.el @@ -24,6 +24,7 @@ end-of-visual-line-or-end evil-backward-char evil-cycle-spacing + evil-delete evil-delete-backward-char-and-join evil-delete-backward-word-smart evil-delete-whole-line @@ -55,6 +56,7 @@ evil-goto-line evil-mouse-drag-region evil-normal-state + evil-smart-scroll-page-down evil-window-middle handle-select-window haskell-process-load-file From 5a9e0093391499f45b1330a5da1b1f9865e38ef3 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 29 Mar 2020 19:13:57 -0700 Subject: [PATCH 087/303] Improve patches to add TRAMP support for lsp-python-ms --- modules/config-python.el | 210 +++++++++++++++++++++++++++------------ 1 file changed, 148 insertions(+), 62 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 79533d50..a593c94e 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -52,7 +52,7 @@ Return either a string or nil." (my/tramp-build-name-from-localname path) path))) (when (file-directory-p universal-path) - universal-path))) + (substring-no-properties universal-path)))) (defvar my/python-virtualenv-cache nil) (add-to-list 'savehist-additional-variables 'my/python-virtualenv-cache) @@ -126,67 +126,153 @@ Return either a string or nil." (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) ;; Use the Microsoft python ls if we can - (when (executable-find "dotnet") - (use-package lsp-python-ms - :init - (require 'lsp-python-ms) - (add-hook 'python-mode-hook - (my/defun-as-value my/maybe-lsp (&rest _) - (unless (file-remote-p buffer-file-name) - (lsp-deferred)))) - - :config - (lsp-register-client - (make-lsp-client - :new-connection (lsp-tramp-connection - (my/defun-as-value my/python-find-mspyls () - (my/local-executable-find "mspyls"))) - :major-modes (append '(python-mode) lsp-python-ms-extra-major-modes) - :remote? t - :server-id 'mspyls-remote - :priority -2 - :initialization-options 'lsp-python-ms--extra-init-params - :notification-handlers - (lsp-ht ("python/languageServerStarted" - 'lsp-python-ms--language-server-started-callback) - ("telemetry/event" 'ignore) - ("python/reportProgress" - 'lsp-python-ms--report-progress-callback) - ("python/beginProgress" 'lsp-python-ms--begin-progress-callback) - ("python/endProgress" 'lsp-python-ms--end-progress-callback)) - :initialized-fn - (lambda (workspace) - (with-lsp-workspace workspace - (lsp--set-configuration (lsp-configuration-section "python")))))) - - ;; when on arch, check if we can use the system ls - (let ((system-ls "/usr/lib/microsoft-python-language-server/") - (system-ls-bin (executable-find "mspyls"))) - (if (and (file-directory-p system-ls) system-ls-bin) - (setq lsp-python-ms-dir system-ls - lsp-python-ms-executable system-ls-bin) - (setq lsp-python-ms-dir - (locate-user-emacs-file "data/mspyls") - lsp-python-ms-executable - (concat lsp-python-ms-dir - "Microsoft.Python.LanguageServer" - (and (eq system-type 'windows-nt) ".exe"))))) - - (advice-add - 'lsp-python-ms--extra-init-params :before - (my/defun-as-value my/lsp-python-ms-discover-virtualenvs (&rest _) - ;; Stolen from raxod502/radian - (when-let ((venv (my/python-find-virtualenv-cached))) - (setq-local lsp-python-ms-extra-paths - (mapcar (lambda (path) - (if (tramp-tramp-file-p path) - (with-parsed-tramp-file-name path parsed - parsed-localname) - path) - ) - (file-expand-wildcards - (expand-file-name - "lib/python*/site-packages" venv))))))))) + (use-package lsp-python-ms + :init + (require 'lsp-python-ms) + (add-hook 'python-mode-hook + (my/defun-as-value my/maybe-lsp (&rest _) + (unless (file-remote-p buffer-file-name) + (lsp-deferred)))) + + :config + (lsp-register-client + (make-lsp-client + :new-connection (lsp-tramp-connection + (my/defun-as-value my/python-find-mspyls () + (my/local-executable-find "mspyls"))) + :major-modes (append '(python-mode) lsp-python-ms-extra-major-modes) + :remote? t + :server-id 'mspyls-remote + :priority -2 + :initialization-options 'lsp-python-ms--extra-init-params + :notification-handlers + (lsp-ht ("python/languageServerStarted" + 'lsp-python-ms--language-server-started-callback) + ("telemetry/event" 'ignore) + ("python/reportProgress" + 'lsp-python-ms--report-progress-callback) + ("python/beginProgress" 'lsp-python-ms--begin-progress-callback) + ("python/endProgress" 'lsp-python-ms--end-progress-callback)) + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (lsp-configuration-section "python")))))) + + ;; when on arch, check if we can use the system ls + (let ((system-ls "/usr/lib/microsoft-python-language-server/") + (system-ls-bin (executable-find "mspyls"))) + (if (and (file-directory-p system-ls) system-ls-bin) + (setq lsp-python-ms-dir system-ls + lsp-python-ms-executable system-ls-bin) + (setq lsp-python-ms-dir + (locate-user-emacs-file "data/mspyls") + lsp-python-ms-executable + (concat lsp-python-ms-dir + "Microsoft.Python.LanguageServer" + (and (eq system-type 'windows-nt) ".exe"))))) + + (el-patch-feature lsp-python-ms) + + (el-patch-defun lsp-python-ms-locate-python () + "Look for virtual environments local to the workspace" + (let* ((el-patch-add + (virtualenv (my/python-find-virtualenv-cached)) + (virtualenv-python (f-expand "bin/python" virtualenv))) + (venv (locate-dominating-file default-directory "venv/")) + (sys-python (executable-find + lsp-python-ms-python-executable-cmd)) + (venv-python (f-expand "venv/bin/python" venv))) + (cond + (el-patch-add + ((and virtualenv (f-executable? virtualenv-python)) + (if (tramp-tramp-file-p virtualenv-python) virtualenv-python))) + ((and venv (f-executable? venv-python)) venv-python) + (sys-python)))) + + (el-patch-defun lsp-python-ms--get-python-ver-and-syspath (workspace-root) + "Return list with pyver-string and list of python search paths. + +The WORKSPACE-ROOT will be prepended to the list of python search +paths and then the entire list will be json-encoded." + (when-let + ((python (lsp-python-ms-locate-python)) + (default-directory workspace-root) + (init "from __future__ import print_function; import sys; \ +sys.path = list(filter(lambda p: p != '', sys.path)); import json;") + (ver "v=(\"%s.%s\" % (sys.version_info[0], sys.version_info[1]));") + (sp (concat "sys.path.insert(0, '" workspace-root "'); p=sys.path;")) + (ex "e=sys.executable;") + (val "print(json.dumps({\"version\":v,\"paths\":p,\"executable\":e}))")) + + (with-temp-buffer + (el-patch-wrap 3 + (if (tramp-tramp-file-p python) + (with-parsed-tramp-file-name python parsed + (let ((default-directory (file-name-directory python))) + (process-file parsed-localname nil t nil "-c" + (concat init ver sp ex val)))) + (call-process python nil t nil "-c" + (concat init ver sp ex val)))) + + + (let* ((json-array-type 'vector) + (json-key-type 'string) + (json-object-type 'hash-table) + (json-string (buffer-string)) + (json-hash (json-read-from-string json-string))) + (list (gethash "version" json-hash) + (gethash "paths" json-hash) + (gethash "executable" json-hash)))))) + + (el-patch-defun lsp-python-ms--extra-init-params (&optional workspace) + "Return form describing parameters for language server. + +Old lsp will pass in a WORKSPACE, new lsp has a global +lsp-workspace-root function that finds the current buffer's +workspace root. If nothing works, default to the current file's +directory" + (let ((workspace-root + (if workspace (lsp--workspace-root workspace) + (lsp-python-ms--workspace-root)))) + (when lsp-python-ms-parse-dot-env-enabled + (lsp-python-ms--parse-dot-env workspace-root)) + (cl-destructuring-bind (pyver pysyspath pyintpath) + (lsp-python-ms--get-python-ver-and-syspath workspace-root) + `(:interpreter + (:properties + (:InterpreterPath + ,(el-patch-wrap 3 + (if (tramp-tramp-file-p pyintpath) + (with-parsed-tramp-file-name pyintpath parsed + parsed-localname) + pyintpath)) + :UseDefaultDatabase t + :Version ,pyver)) + ;; preferredFormat "markdown" or "plaintext" experiment + ;; to find what works best -- over here mostly plaintext + :displayOptions + (:preferredFormat + "markdown" + :trimDocumentationLines :json-false + :maxDocumentationLineLength 0 + :trimDocumentationText :json-false + :maxDocumentationTextLength 0) + :searchPaths + ,(if lsp-python-ms-extra-paths + (vconcat lsp-python-ms-extra-paths nil) + (el-patch-wrap 2 + (mapcar (lambda (fname) + (if (tramp-tramp-file-p fname) + (with-parsed-tramp-file-name fname parsed + parsed-localname) + fname)) + pysyspath))) + :analysisUpdates t + :asyncStartup t + :logLevel ,lsp-python-ms-log-level + :typeStubSearchPaths + ,(vector (expand-file-name + (f-join lsp-python-ms-dir "Typeshed")))))))) (add-hook 'python-mode-hook #'eldoc-mode) From 6a19e8e895d4b79bc628dc07e8f596b4e15e1b0c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 30 Mar 2020 12:50:30 -0700 Subject: [PATCH 088/303] Fix invocation of commands in AUCTeX on macOS --- modules/config-tex.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index ec0e8f55..88b81159 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -127,7 +127,19 @@ PARAMS progress report notification data." (when (and (eq system-type 'darwin) (file-directory-p "/Applications/Skim.app")) - (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Skim")) + (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Skim") + + ;; Due to the way AUCTeX invokes commands, the programs need to be + ;; in the PATH, however for some reason on macOS the required + ;; directories are only added to exec-path and not PATH, so we + ;; correct this here. + (advice-add + 'TeX-run-command :around + (my/defun-as-value my/TeX-run-command/add-exec-path (old-fun &rest args) + (let ((process-environment process-environment)) + (setenv "PATH" + (concat "$PATH" (string-join exec-path path-separator)) t) + (apply old-fun args))))) (defun my/LaTeX-format-name () (save-excursion From 99b48bb4f349ffc8a661c1a98a056481c153ac56 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 30 Mar 2020 14:18:32 -0700 Subject: [PATCH 089/303] Update for new texlab support directly in lsp-mode --- modules/config-tex.el | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 88b81159..895158cd 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -16,13 +16,6 @@ (with-demoted-errors "Load error: %s" (require 'lsp-mode))) - ;; Copied from `lsp-clients--rust-window-progress' in `lsp-rust'. - (defun lsp-latex-window-progress (_workspace params) - "Progress report handling. -PARAMS progress report notification data." - ;; Minimal implementation - we could show the progress as well. - (lsp-log (gethash "title" params))) - (let* ((local-texlab-debug-path (expand-file-name (locate-user-emacs-file "data/lsp/texlab/target/debug/texlab"))) @@ -39,19 +32,7 @@ PARAMS progress report notification data." (list "env" "PATH=/Library/TeX/texbin/" texlab-path) texlab-path))) (when texlab-command - (lsp-register-client - (make-lsp-client :new-connection - (lsp-stdio-connection - texlab-command) - :major-modes '(tex-mode yatex-mode latex-mode) - :server-id 'texlab - :notification-handlers - (lsp-ht - ("window/progress" - 'lsp-latex-window-progress)))) - - (add-to-list 'lsp-language-id-configuration '(tex-mode . "tex")) - (add-to-list 'lsp-language-id-configuration '(latex-mode . "tex"))))) + (setq lsp-clients-texlab-executable texlab-command)))) (use-package tex :recipe auctex From 3b478be58dd5d658c722d1d93994f93ac43751d0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 10:47:13 -0700 Subject: [PATCH 090/303] Avoid deprecated use of char in rx --- modules/config-tex.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 895158cd..bf43dd06 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -285,10 +285,10 @@ matching string." (zero-or-more (or (and "[" - (zero-or-more char) + (zero-or-more any) "]") (and "{" - (zero-or-more char) + (zero-or-more any) "}"))))))) (beg (save-excursion (while (not (or From 25262cd835e1902a542f1df1d47447d33de5999c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 10:48:19 -0700 Subject: [PATCH 091/303] Add docstring for read-passwd-show-hash-mode --- modules/config-intel.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 9df3eee1..9a50bde3 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -3,7 +3,9 @@ (require 'cl-lib) (require 'config-tramp) -(define-minor-mode read-passwd-show-hash-mode :init-value t :global t) +(define-minor-mode read-passwd-show-hash-mode + "Show the hashes of passwords read by read-passwd" + :init-value t :global t) (el-patch-defun read-passwd (prompt &optional confirm default) "Read a password, prompting with PROMPT, and return it. From 4d5a257c660f50015c55a94b9d5cfb43c8d08681 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 10:50:54 -0700 Subject: [PATCH 092/303] Update for extra arg in abort-if-file-too-large --- modules/config-intel.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 9a50bde3..11b06fb6 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -449,7 +449,7 @@ is binary, activate `hexl-mode'." (advice-add 'abort-if-file-too-large :around (my/defun-as-value nadvice/abort-if-file-too-large (_old-fun &rest args) - (cl-destructuring-bind (size op-type filename) args + (cl-destructuring-bind (size op-type filename &rest _offer-raw) args (when (and size (not (zerop size)) large-file-warning-threshold From 0addfb987aec8fd97363c6a75d10379db636c609 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 10:51:11 -0700 Subject: [PATCH 093/303] Remove vestigial reference to config-rainbow-delimiters --- modules/config-ui.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index e8432f53..710c01cc 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -7,7 +7,6 @@ (require 'config-undo) (require 'config-smartparens) -(require 'config-rainbow-delimiters) (setq mouse-wheel-scroll-amount '(3 ((shift) . 1)) mouse-wheel-progressive-speed nil From e863e96734ad9b5aca306fb0e5ee6eaa26e3c2f7 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 14:56:21 -0700 Subject: [PATCH 094/303] Remove ac-js2 --- modules/config-modes.el | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 511e73e4..0cf9b483 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -137,19 +137,6 @@ js2-jsx-mode) :interpreter ("node" . js2-mode) :config - (use-package ac-js2 - :commands (ac-js2-expand-function - ac-js2-completion-function - ac-js2-company - ac-js2-jump-to-definition - ac-js2-mode) - :init - (add-hook 'js2-mode-hook 'ac-js2-mode) - :config - ;; I really shouldn't have to do this. :/ - (require 'cl)) - - (use-package js2-refactor :defer-install t :commands (js2r-add-keybindings-with-prefix From fa1728b04244d9c2fae1ace1d5e53c6e67f9e328 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 31 Mar 2020 20:16:58 -0700 Subject: [PATCH 095/303] Fix byte compilation of lsp macros in lsp-python-ms config --- modules/config-python.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-python.el b/modules/config-python.el index a593c94e..dc8dec25 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -135,6 +135,10 @@ Return either a string or nil." (lsp-deferred)))) :config + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'lsp))) + (lsp-register-client (make-lsp-client :new-connection (lsp-tramp-connection From 0431b50143b4ab85e20666afa950c44d0a685c5b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 11:36:15 -0700 Subject: [PATCH 096/303] Update and cleanup projectile patches --- modules/config-package.el | 13 ----- modules/config-vcs.el | 116 ++++++++------------------------------ 2 files changed, 24 insertions(+), 105 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index b9e4fdbc..0bd1bb4b 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -269,19 +269,6 @@ second, floating-point values are rounded down to the nearest integer.)" (defvar el-patch--patches (make-hash-table)) (with-eval-after-load 'el-patch - (el-patch-deftype defadvice - :classify el-patch-classify-function - :declare ((doc-string 3) - (indent 2) - (debug (&define name ;; thing being advised. - (name ;; class is [&or "before" "around" "after" - ;; "activation" "deactivation"] - name ;; name of advice - &rest sexp ;; optional position and flags - ) - [&optional stringp] - [&optional ("interactive" interactive)] - def-body)))) (el-patch-deftype evil-define-command :classify el-patch-classify-function :locate el-patch-locate-function diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 69969e2f..0a894141 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -346,6 +346,10 @@ if ARG is omitted or nil. (use-package projectile :init + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'el-patch))) + (autoload #'projectile-find-file-hook-function "projectile" "Called by `find-file-hook' when `projectile-mode' is on. @@ -356,6 +360,12 @@ tramp.") (autoload #'projectile-track-known-projects-find-file-hook "projectile" "Function for caching projects with `find-file-hook'.") + (autoload #'delete-file-projectile-remove-from-cache "projectile") + + (autoload #'compilation-find-file-projectile-find-compilation-buffer "projectile" + "Try to find a buffer for FILENAME, if we cannot find it, +fallback to the original function.") + (el-patch-feature projectile) (defgroup projectile nil "Manage and navigate projects easily." @@ -425,6 +435,7 @@ tramp.") (define-key map (kbd "x i") #'projectile-run-ielm) (define-key map (kbd "x t") #'projectile-run-term) (define-key map (kbd "x s") #'projectile-run-shell) + (define-key map (kbd "x g") #'projectile-run-gdb) (define-key map (kbd "x v") #'projectile-run-vterm) (define-key map (kbd "z") #'projectile-cache-current-file) (define-key map (kbd "") #'projectile-previous-project-buffer) @@ -469,6 +480,8 @@ tramp.") ["Replace in project" projectile-replace] ["Multi-occur in project" projectile-multi-occur] "--" + ["Run GDB" projectile-run-gdb] + "--" ["Run shell" projectile-run-shell] ["Run eshell" projectile-run-eshell] ["Run ielm" projectile-run-ielm] @@ -491,84 +504,6 @@ tramp.") (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) - (el-patch-defcustom projectile-indexing-method (if (eq system-type 'windows-nt) 'native 'alien) - "Specifies the indexing method used by Projectile. - -There are three indexing methods - native, hybrid and alien. - -The native method is implemented in Emacs Lisp (therefore it is -native to Emacs). Its advantage is that it is portable and will -work everywhere that Emacs does. Its disadvantage is that it is a -bit slow (especially for large projects). Generally it's a good -idea to pair the native indexing method with caching. - -The hybrid indexing method uses external tools (e.g. git, find, -etc) to speed up the indexing process. Still, the files will be -post-processed by Projectile for sorting/filtering purposes. -In this sense that approach is a hybrid between native indexing -and alien indexing. - -The alien indexing method optimizes to the limit the speed -of the hybrid indexing method. This means that Projectile will -not do any processing of the files returned by the external -commands and you're going to get the maximum performance -possible. This behaviour makes a lot of sense for most people, -as they'd typically be putting ignores in their VCS config and -won't care about any additional ignores/unignores/sorting that -Projectile might also provide. - -The disadvantage of the hybrid and alien methods is that they are not well -supported on Windows systems. That's why by default alien indexing is the -default on all operating systems, except Windows." - :group 'projectile - :type '(radio - (const :tag "Native" native) - (const :tag "Hybrid" hybrid) - (const :tag "Alien" alien))) - - (el-patch-defcustom projectile-enable-caching (eq projectile-indexing-method 'native) - "When t enables project files caching. - -Project caching is automatically enabled by default if you're -using the native indexing method." - :group 'projectile - :type 'boolean) - - (el-patch-defadvice delete-file (before purge-from-projectile-cache (filename &optional trash)) - (if (and projectile-enable-caching (projectile-project-p)) - (let* ((project-root (projectile-project-root)) - (true-filename (file-truename filename)) - (relative-filename (file-relative-name true-filename project-root))) - (if (projectile-file-cached-p relative-filename project-root) - (projectile-purge-file-from-cache relative-filename))))) - - (el-patch-defadvice compilation-find-file (around projectile-compilation-find-file) - "Try to find a buffer for FILENAME, if we cannot find it, -fallback to the original function." - (let ((filename (ad-get-arg 1)) - full-filename) - (ad-set-arg 1 - (or - (if (file-exists-p (expand-file-name filename)) - filename) - ;; Try to find the filename using projectile - (and (projectile-project-p) - (let ((root (projectile-project-root)) - (dirs (cons "" (projectile-current-project-dirs)))) - (when (setq full-filename - (car (cl-remove-if-not - #'file-exists-p - (mapcar - (lambda (f) - (expand-file-name - filename - (expand-file-name f root))) - dirs)))) - full-filename))) - ;; Fall back to the old argument - filename)) - ad-do-it)) - (el-patch-define-minor-mode projectile-mode "Minor mode to assist project management and navigation. @@ -581,7 +516,7 @@ nil or positive. If ARG is `toggle', toggle `projectile-mode'. Otherwise behave as if called interactively. \\{projectile-mode-map}" - :lighter projectile-mode-line + :lighter projectile--mode-line :keymap projectile-mode-map :group 'projectile :require 'projectile @@ -589,6 +524,8 @@ Otherwise behave as if called interactively. (cond (projectile-mode (el-patch-remove + ;; setup the commander bindings + (projectile-commander-bindings) ;; initialize the projects cache if needed (unless projectile-projects-cache (setq projectile-projects-cache @@ -597,22 +534,22 @@ Otherwise behave as if called interactively. (unless projectile-projects-cache-time (setq projectile-projects-cache-time (make-hash-table :test 'equal))) + ;; load the known projects + (projectile-load-known-projects) ;; update the list of known projects - (projectile-cleanup-known-projects) + (projectile--cleanup-known-projects) (projectile-discover-projects-in-search-path)) - (add-hook 'find-file-hook 'projectile-find-file-hook-function) (add-hook 'projectile-find-dir-hook #'projectile-track-known-projects-find-file-hook t) (add-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook t t) - (ad-activate 'compilation-find-file) - (ad-activate 'delete-file)) + (advice-add 'compilation-find-file :around #'compilation-find-file-projectile-find-compilation-buffer) + (advice-add 'delete-file :before #'delete-file-projectile-remove-from-cache)) (t (remove-hook 'find-file-hook #'projectile-find-file-hook-function) (remove-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook t) - (ad-deactivate 'compilation-find-file) - (ad-deactivate 'delete-file)))) + (advice-remove 'compilation-find-file #'compilation-find-file-projectile-find-compilation-buffer) + (advice-remove 'delete-file #'delete-file-projectile-remove-from-cache)))) - :init (setq projectile-mode-line-prefix (if (display-graphic-p) " ↠" " /")) (projectile-mode +1) @@ -628,12 +565,7 @@ Otherwise behave as if called interactively. projectile-cache-file (locate-user-emacs-file "data/.projectile.cache") projectile-completion-system 'ivy - projectile-dynamic-mode-line nil) - - ;; Enable the mode again now that we have all the supporting hooks - ;; and stuff defined. - (projectile-mode +1)) - + projectile-dynamic-mode-line nil)) (use-package diff :ensure nil From 8ba771522a2cd69fef4149463954587d6f788102 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 11:58:44 -0700 Subject: [PATCH 097/303] Ensure el-patch loads all features when verifying patches --- modules/config-modes.el | 4 +++- modules/config-python.el | 10 +++++++--- modules/config-tex.el | 3 ++- modules/config-tramp.el | 2 -- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 0cf9b483..8908c988 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -69,11 +69,13 @@ (global-set-key (kbd "C-h f") #'helpful-callable) (global-set-key (kbd "C-h k") #'helpful-key) (global-set-key (kbd "C-h v") #'helpful-variable) + + (el-patch-feature helpful) + :config (define-key helpful-mode-map "J" #'forward-button) (define-key helpful-mode-map "K" #'backward-button) - (el-patch-feature helpful) (el-patch-defun helpful--read-symbol (prompt predicate) (let ((sym-here (symbol-at-point))) (read (completing-read prompt (el-patch-swap obarray diff --git a/modules/config-python.el b/modules/config-python.el index dc8dec25..39d3d95d 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -115,6 +115,9 @@ Return either a string or nil." (use-package python :ensure nil + :init + (el-patch-feature python) + :config (add-hook 'python-mode-hook (lambda () @@ -134,10 +137,13 @@ Return either a string or nil." (unless (file-remote-p buffer-file-name) (lsp-deferred)))) + (el-patch-feature lsp-python-ms) + :config (eval-when-compile (with-demoted-errors "Load error: %s" - (require 'lsp))) + (require 'lsp) + (require 'el-patch))) (lsp-register-client (make-lsp-client @@ -175,8 +181,6 @@ Return either a string or nil." "Microsoft.Python.LanguageServer" (and (eq system-type 'windows-nt) ".exe"))))) - (el-patch-feature lsp-python-ms) - (el-patch-defun lsp-python-ms-locate-python () "Look for virtual environments local to the workspace" (let* ((el-patch-add diff --git a/modules/config-tex.el b/modules/config-tex.el index bf43dd06..6d4021e6 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -201,6 +201,8 @@ command." (use-package magic-latex-buffer :defer-install t :commands (magic-latex-buffer) + :init + (el-patch-feature magic-latex-buffer) :config (setq magic-latex-enable-block-align nil magic-latex-enable-inline-image nil) @@ -210,7 +212,6 @@ command." (set-face-attribute 'ml/huge nil :height 1.35) (set-face-attribute 'ml/hhuge nil :height 1.4) - (el-patch-feature magic-latex-buffer) (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) "Like `search-regexp' but skips escaped chars, comments and verbish environments. This function raise an error on diff --git a/modules/config-tramp.el b/modules/config-tramp.el index ddf4721a..9abe4b32 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -154,8 +154,6 @@ (with-demoted-errors "Load error: %s" (require 'el-patch))) - (el-patch-feature su) - (defun nadvice/su-disable-maybe-setup (flag) (if (and (not flag) (bound-and-true-p su-auto-save-mode)) (su-auto-save-mode -1))) From 38cd9b1a55ac82ae6564c2b7b0c2c29085b13ee5 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 12:04:29 -0700 Subject: [PATCH 098/303] Avoid evil loading projectile during init --- modules/config-modes.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 8908c988..98e063b0 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -55,8 +55,9 @@ (define-key emacs-lisp-mode-map (kbd "M-.") #'emacs-lisp-goto-definition) (define-key emacs-lisp-mode-map (kbd "M-,") #'evil-jump-backward) - (use-package evil - :config + (with-eval-after-load 'evil + (with-demoted-errors "Load error: %s" + (require 'evil)) (evil-define-key 'normal emacs-lisp-mode-map "gd" #'emacs-lisp-goto-definition))) From 2fb50d90ed1aa348ff9bba321fe6099f7cb58491 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 12:04:50 -0700 Subject: [PATCH 099/303] Update el-patch for helpful--read-symbol --- modules/config-modes.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 98e063b0..24e46df8 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -78,12 +78,25 @@ (define-key helpful-mode-map "K" #'backward-button) (el-patch-defun helpful--read-symbol (prompt predicate) - (let ((sym-here (symbol-at-point))) - (read (completing-read prompt (el-patch-swap obarray - #'help--symbol-completion-table) - predicate t nil nil - (when (funcall predicate sym-here) - (symbol-name sym-here))))))) + (let* ((sym-here (symbol-at-point)) + (default-val + (when (funcall predicate sym-here) + (symbol-name sym-here)))) + (when default-val + ;; TODO: Only modify the prompt when we don't have ido/ivy/helm, + ;; because the default is obvious for them. + (setq prompt + (replace-regexp-in-string + (rx ": " eos) + (format " (default: %s): " default-val) + prompt))) + (intern (completing-read + prompt + (el-patch-swap obarray + #'help--symbol-completion-table) + predicate t nil nil + default-val))))) + (use-package macrostep :defer-install t :commands (macrostep-mode macrostep-expand) From 52ad015caac8842f3a858950b202ee36be1ee92c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 12:09:08 -0700 Subject: [PATCH 100/303] Update el-patch for historian-load --- modules/config-ivy.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index c66318a5..ca96aea0 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -71,7 +71,8 @@ recursion depth in the minibuffer prompt. This is only useful if (if (file-exists-p historian-save-file) (with-temp-buffer (insert-file-contents historian-save-file) - (read (current-buffer))) + (with-demoted-errors "corrupt historian save file: %s" + (read (current-buffer)))) (make-hash-table)))) (el-patch-define-minor-mode historian-mode From e84c4166574cab4b355a33b3f404585bde33e21d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 12:17:57 -0700 Subject: [PATCH 101/303] Update el-patch for read-passwd --- modules/config-intel.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 11b06fb6..9b06a710 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -38,14 +38,14 @@ by doing (clear-string STRING)." (clear-this-command-keys) (setq beg (min end (max (minibuffer-prompt-end) beg))) - (move-overlay ol (point-max) (point-max)) - (let ((len (- (point-max) (minibuffer-prompt-end))) - (hash (md5 (minibuffer-contents-no-properties)))) - (overlay-put ol 'after-string - (if (and (> len 10) read-passwd-show-hash-mode) - (format " [%d chars, #%s]" - len (substring hash 0 4))))) - + (el-patch-add + (move-overlay ol (point-max) (point-max)) + (let ((len (- (point-max) (minibuffer-prompt-end))) + (hash (md5 (minibuffer-contents-no-properties)))) + (overlay-put ol 'after-string + (if (and (> len 10) read-passwd-show-hash-mode) + (format " [%d chars, #%s]" + len (substring hash 0 4)))))) (dotimes (i (- end beg)) (put-text-property (+ i beg) (+ 1 i beg) 'display (string (or read-hide-char ?.)))))) @@ -59,12 +59,12 @@ by doing (clear-string STRING)." (setq-local select-active-regions nil) (use-local-map read-passwd-map) (setq-local inhibit-modification-hooks nil) ;bug#15501. - (setq-local show-paren-mode nil) ;bug#16091. + (setq-local show-paren-mode nil) ;bug#16091. (el-patch-add (setq ol (make-overlay (point-max) (point-max) nil t t))) (add-hook 'after-change-functions hide-chars-fun nil 'local)) (unwind-protect (let ((enable-recursive-minibuffers t) - (read-hide-char (or read-hide-char ?.))) + (read-hide-char (or read-hide-char ?.))) (read-string prompt nil t default)) ; t = "no history" (when (buffer-live-p minibuf) (with-current-buffer minibuf From 3ad102ee83def5c67c205da7084fb849014d42f8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Apr 2020 12:22:11 -0700 Subject: [PATCH 102/303] Update el-patch for evil-visual-paste --- modules/config-paste.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index 1521c394..d14f1fd9 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -387,7 +387,8 @@ move the yanking point; just return the Nth kill forward." (el-patch-evil-define-command evil-visual-paste (count &optional register) "Paste over Visual selection." :suppress-operator t - (interactive "P") + (interactive "*P") + (setq count (prefix-numeric-value count)) ;; evil-visual-paste is typically called from evil-paste-before or ;; evil-paste-after, but we have to mark that the paste was from ;; visual state From 409b09605f702c849a0ad874ed7c6d3fba6bc20f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 2 Apr 2020 15:25:13 -0700 Subject: [PATCH 103/303] Update lsp-python-ms patches for native JSON serialization --- modules/config-python.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 39d3d95d..61a7bea5 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -193,7 +193,7 @@ Return either a string or nil." (cond (el-patch-add ((and virtualenv (f-executable? virtualenv-python)) - (if (tramp-tramp-file-p virtualenv-python) virtualenv-python))) + virtualenv-python)) ((and venv (f-executable? venv-python)) venv-python) (sys-python)))) @@ -268,8 +268,8 @@ directory" :searchPaths ,(if lsp-python-ms-extra-paths (vconcat lsp-python-ms-extra-paths nil) - (el-patch-wrap 2 - (mapcar (lambda (fname) + (el-patch-wrap 3 + (cl-map 'vector (lambda (fname) (if (tramp-tramp-file-p fname) (with-parsed-tramp-file-name fname parsed parsed-localname) From 0965d0a5e095686604d1e41c80e3a320bbff4bbc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 4 Apr 2020 19:37:17 -0700 Subject: [PATCH 104/303] Load language-modules at the end of config-mode --- modules/config-modes.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 24e46df8..ab196ae5 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -2,9 +2,6 @@ (eval-when-compile (require 'config-macros)) (require 'cl-lib) (require 'config-package) -(require 'config-tex) -(require 'config-c) -(require 'config-python) (eval-when-compile (with-demoted-errors "Load error: %s" @@ -1568,4 +1565,8 @@ (use-package company-lsp :commands company-lsp) +(require 'config-tex) +(require 'config-c) +(require 'config-python) + (provide 'config-modes) From 4ae43f42cff1ff384a8cde8dba63a0214ede5426 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 7 Apr 2020 19:54:04 -0700 Subject: [PATCH 105/303] Remove irony --- modules/config-c.el | 77 +-------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/modules/config-c.el b/modules/config-c.el index aff4862e..9df81e18 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -34,78 +34,6 @@ (newline) (indent-according-to-mode))))) - (use-package irony-eldoc - :defer-install t - :commands (irony-eldoc)) - - (use-package flycheck-irony - :defer-install t - :commands (flycheck-irony-setup)) - - (use-package irony - :defer-install t - :commands (irony-mode - irony-version - irony-server-kill - irony-cdb-autosetup-compile-options - irony-cdb-menu - irony-cdb-clang-complete - irony-cdb-json - irony-cdb-json-add-compile-commands-path - irony-cdb-libclang - irony-completion-at-point - irony-completion-at-point-async) - :init - (add-to-list 'safe-local-variable-values - '(irony-additional-clang-options . ("-std=c++11"))) - (add-to-list 'safe-local-variable-values - '(irony-additional-clang-options . ("-std=c++14"))) - (add-to-list 'safe-local-variable-values - '(irony-additional-clang-options . ("-std=c++17"))) - - :config - (setq irony-user-dir (locate-user-emacs-file "data/irony") - irony-server-install-prefix irony-user-dir) - (flycheck-irony-setup) - (add-hook 'irony-mode-hook 'irony-eldoc) - (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) - - (use-package company-irony - :defer-install t - :commands (company-irony - company-irony-setup-begin-commands) - :config - (setq company-irony-ignore-case t) - - (use-package company-irony - :defer-install t - :config - (advice-add - 'company-irony--filter-candidates :override - (my/defun-as-value nadvice/company-irony--filter-candidates (prefix candidates) - (let ((regex (concat "\\`" - (mapconcat - (lambda (x) - (setq x (string x)) - (concat "[^" x "]*" (regexp-quote x))) - prefix - ""))) - (case-fold-search company-irony-ignore-case)) - (cl-loop for candidate in candidates - when (string-match-p regex (car candidate)) - collect (propertize (car candidate) 'company-irony candidate)))))) - - (advice-add - 'irony-completion-post-complete :around - (my/defun-as-value nadvice/irony-completion-post-complete (old-fun &rest args) - (unless (irony-eldoc--which-funcall) - (apply old-fun args))))) - - (use-package company-irony-c-headers - :defer-install t - :defer-install t - :commands (company-irony-c-headers)) - (use-package clang-format :defer-install t :commands (clang-format @@ -128,8 +56,7 @@ (require 'cl-lib) (let ((old-backends company-backends)) (set (make-local-variable 'company-backends) - '((company-irony-c-headers - company-irony + '((company-lsp company-yasnippet company-files) (company-dabbrev-code) @@ -146,9 +73,7 @@ (mode hook) `(add-hook ,hook (lambda () (when (eq major-mode ,mode) - (irony-mode +1) (eldoc-mode +1) - (irony-eldoc +1) (aggressive-indent-mode +1) (helm-gtags-mode +1) (semantic-idle-summary-mode -1)))))) From 8b0bade2460a2f2e94ddc3cdb7669f291da636e6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 18 Apr 2020 12:05:14 -0700 Subject: [PATCH 106/303] Explicitly fontify with-editor-buffers to avoid race condition --- modules/config-vcs.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 0a894141..0a50abef 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -126,6 +126,7 @@ (add-hook 'git-rebase-mode-hook #'my/setup-magit-mode) (add-hook 'with-editor-mode-hook #'evil-insert-state) + (add-hook 'with-editor-mode-hook #'jit-lock-fontify-now) (advice-add 'magit-revert-buffers :after From be91c31e5e8fd61d29de38f80b2a73e8387a492d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 21 Apr 2020 12:41:49 -0700 Subject: [PATCH 107/303] Remove desktop autosave system --- modules/config-desktop.el | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 7f9808cf..a9703820 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -395,22 +395,6 @@ where it was when you previously visited the same file." (desktop-remove)) (desktop-read))) - (unless (daemonp) - (defvar desktop-auto-save-timer - (run-with-idle-timer 3 nil #'desktop-autosave)) - - (add-hook 'focus-out-hook - (lambda () - (ignore-errors (cancel-timer desktop-auto-save-timer)) - (setq desktop-auto-save-timer - (run-with-idle-timer 0.2 nil #'desktop-autosave)))) - - (add-hook 'focus-in-hook - (lambda () - (ignore-errors (cancel-timer desktop-auto-save-timer)) - (setq desktop-auto-save-timer - (run-with-idle-timer 3 t #'desktop-autosave))))) - :config (setq desktop-dirname (locate-user-emacs-file "data/desktop/") desktop-path (list desktop-dirname) From 68d6426583875ebb77158f854253fc8e26b2d2e0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Jun 2020 22:55:22 -0700 Subject: [PATCH 108/303] Remove customization of avy-styles-alist --- modules/config-ivy.el | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index ca96aea0..10eb7996 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -150,7 +150,8 @@ Minibuffer bindings: :config (eval-when-compile (with-demoted-errors "Load error: %s" - (require 'historian))) + (require 'historian) + (require 'ivy))) (ivy-historian-mode +1) @@ -164,16 +165,7 @@ Minibuffer bindings: (setq ivy-minibuffer-faces (list 'ivy-minibuffer-match-face-1 'ivy-minibuffer-match-face-2))) - (eval-when-compile - (with-demoted-errors "Load error: %s" - (require 'ivy))) - (diminish 'ivy-mode) - (with-eval-after-load 'avy - (eval-when-compile - (require 'avy)) - - (setf (cdr (assoc 'ivy-avy avy-styles-alist)) 'at-full)) (setq ivy-display-style 'fancy ivy-re-builders-alist '((t . ivy--regex-fuzzy)) From 22ad19df8c1b4d15d0fe4cfbf25b3ad336111b4f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 12 Jul 2020 16:59:26 -0700 Subject: [PATCH 109/303] Update helm-ff-filter-candidate-one-by-one advice --- modules/config-helm.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 8c22aefd..f5c88a08 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -166,12 +166,12 @@ (advice-add 'helm-ff-filter-candidate-one-by-one :around - (my/defun-as-value nadvice/helm-ff-filter-candidate-one-by-one (old-fun file) + (my/defun-as-value nadvice/helm-ff-filter-candidate-one-by-one (old-fun file &rest args) (when (or (not (string-match-p (rx (or "." "..") line-end) file)) (string-match-p (rx ".") (helm-basename (or (bound-and-true-p helm-input) "")))) - (funcall old-fun file))))) + (funcall old-fun file args))))) (use-package helm-buffers :ensure nil From 1d43487da281f992be50cf2775aba8fc1cd15903 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 12 Jul 2020 22:45:23 -0700 Subject: [PATCH 110/303] Add keyboard-quit and evil-visual-* to mc/cmds-to-run-once --- data/.mc-lists.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/.mc-lists.el b/data/.mc-lists.el index ae76c00d..58c12254 100644 --- a/data/.mc-lists.el +++ b/data/.mc-lists.el @@ -57,8 +57,12 @@ evil-mouse-drag-region evil-normal-state evil-smart-scroll-page-down + evil-visual-block + evil-visual-char + evil-visual-line evil-window-middle handle-select-window haskell-process-load-file hydra/projectile-tools/body + keyboard-quit )) From e0ff77885877916d05607935fd4055f2c58ecb7c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jul 2020 09:37:07 -0700 Subject: [PATCH 111/303] Update my/python-find-virtualenv to match new poetry output --- modules/config-python.el | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 61a7bea5..74b07f0b 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -9,6 +9,7 @@ (defun my/python-find-virtualenv (&optional dir) "Find a virtualenv corresponding to the current buffer. Return either a string or nil." + (require 's) (message "Searching for Python virtual environment at %s" default-directory) (let* ((default-directory (or dir default-directory)) (path @@ -24,22 +25,7 @@ Return either a string or nil." "info" "-p") (when (= 0 return-code) - (cl-return output))) - ;; Fall back to poetry <1.0 check TODO: This code - ;; will become stale over time, so get rid of it - ;; after a while. - ;; Radon: May create virtualenv, but whatever. - (cl-destructuring-bind (return-code . output) - (my/process-file-to-string "poetry" nil '(t nil) nil - "run" - "which" - "python") - (when (and (= 0 return-code) - (string-match (rx bol - (group (1+ any)) - "/bin/python\n") - output)) - (cl-return (match-string 1 output))))) + (cl-return (s-chop-suffix "\n" output))))) (when (and (my/local-executable-find "pipenv") (locate-dominating-file default-directory "Pipfile")) @@ -47,7 +33,7 @@ Return either a string or nil." (my/process-file-to-string "pipenv" nil '(t nil) nil "--venv") (when (= 0 return-code) - (cl-return (string-trim output))))))) + (cl-return (s-chop-suffix "\n" output))))))) (universal-path (if (tramp-tramp-file-p default-directory) (my/tramp-build-name-from-localname path) path))) From 609b15ab823e731b6d828bcc095e8dfaa4b896b1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jul 2020 09:38:16 -0700 Subject: [PATCH 112/303] Update ms-python-ls search path patches --- modules/config-python.el | 18 ++++-------------- modules/config-setq.el | 6 ++++++ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 74b07f0b..95dde10a 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -235,11 +235,7 @@ directory" `(:interpreter (:properties (:InterpreterPath - ,(el-patch-wrap 3 - (if (tramp-tramp-file-p pyintpath) - (with-parsed-tramp-file-name pyintpath parsed - parsed-localname) - pyintpath)) + ,(el-patch-wrap 1 (my/tramp-localname pyintpath)) :UseDefaultDatabase t :Version ,pyver)) ;; preferredFormat "markdown" or "plaintext" experiment @@ -252,15 +248,9 @@ directory" :trimDocumentationText :json-false :maxDocumentationTextLength 0) :searchPaths - ,(if lsp-python-ms-extra-paths - (vconcat lsp-python-ms-extra-paths nil) - (el-patch-wrap 3 - (cl-map 'vector (lambda (fname) - (if (tramp-tramp-file-p fname) - (with-parsed-tramp-file-name fname parsed - parsed-localname) - fname)) - pysyspath))) + ,(vconcat lsp-python-ms-extra-paths + (el-patch-wrap 3 + (cl-map 'vector #'my/tramp-localname pysyspath))) :analysisUpdates t :asyncStartup t :logLevel ,lsp-python-ms-log-level diff --git a/modules/config-setq.el b/modules/config-setq.el index 235ebcfb..074b9bbc 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -305,4 +305,10 @@ response as a no." localname parsed-hop))) +(defun my/tramp-localname (path) + (if (tramp-tramp-file-p path) + (with-parsed-tramp-file-name path parsed + parsed-localname) + path)) + (provide 'config-setq) From 3e374b18345c0317d62d24bce233024a41eb07eb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jul 2020 09:43:41 -0700 Subject: [PATCH 113/303] Remove redundant magit completion config --- modules/config-vcs.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 0a50abef..dc7641dd 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -59,9 +59,8 @@ (setenv "SSH_ASKPASS" "magit-askpass")) (setq magit-push-always-verify nil - magit-completing-read-function #'magit-ido-completing-read magit-log-format-graph-function #'magit-log-format-unicode-graph - magit-completing-read-function 'ivy-completing-read + magit-completing-read-function #'ivy-completing-read magit-diff-refine-hunk t magit-pull-or-fetch t) From 483642f579ccb8d90ef47e1b80e761a73e022fd6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jul 2020 09:45:02 -0700 Subject: [PATCH 114/303] Prefer git-grep to rg in helm-omni --- modules/config-helm.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index f5c88a08..8bc0e453 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -413,15 +413,15 @@ (unless slow-fs (append ;; code search - (if my/rg-available - (progn - (setq my/rg-used t) - '(helm-rg-process-source)) - (if (and projectile-root - (featurep 'vc-git) - (vc-git-responsible-p projectile-root) - (require 'helm-git-grep)) - '(helm-source-git-grep) + (if (and projectile-root + (featurep 'vc-git) + (vc-git-responsible-p projectile-root) + (require 'helm-git-grep)) + '(helm-source-git-grep) + (if my/rg-available + (progn + (setq my/rg-used t) + '(helm-rg-process-source)) (when my/ag-available '(helm-source-do-ag)))) From 5c181c465eb6046c1d30e7b9a8626da77abcfe2d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 14 Jul 2020 21:24:36 -0700 Subject: [PATCH 115/303] Use working fork of helm-rg --- modules/config-helm.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/config-helm.el b/modules/config-helm.el index 8bc0e453..8658f549 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -355,6 +355,11 @@ (use-package helm-git-grep) (use-package helm-rg + :recipe + (helm-rg :type git + :host github + :repo "braineo/helm-rg" + :branch "fix-helm-source") :init (defvar my/rg-available nil) From 7d2dea6a60186ddd65e25122d639c3bf6e2ac124 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 19 Jul 2020 11:27:20 -0700 Subject: [PATCH 116/303] Add command to hash buffers --- modules/config-setq.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/config-setq.el b/modules/config-setq.el index 074b9bbc..6900ffeb 100644 --- a/modules/config-setq.el +++ b/modules/config-setq.el @@ -311,4 +311,13 @@ response as a no." parsed-localname) path)) +(defun hash-buffer (alg) + (interactive + (list + (intern (completing-read "Choose algorithm: " + '(md5 sha1 sha224 sha256 sha384 sha512))))) + (let ((result (secure-hash alg (current-buffer)))) + (message "%s" result) + (kill-new result))) + (provide 'config-setq) From 3a170a4b8ea61be8d1efcab0592fade4e3077392 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 20 Jul 2020 10:57:19 -0700 Subject: [PATCH 117/303] Manually control the value of company-backends when using tide-mode --- modules/config-company.el | 1 - modules/config-intel.el | 2 -- modules/config-modes.el | 32 +++++++++++++++++++++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index b30b7aa2..6233dc0e 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -44,7 +44,6 @@ ('texinfo-mode-hook '(company-semantic)) ('python-mode-hook '(company-lsp)) ('text-mode-hook '(company-ispell)) - ('livescript-mode-hook '(company-tide)) ('go-mode-hook '(company-go))))))) :config diff --git a/modules/config-intel.el b/modules/config-intel.el index 9b06a710..95178eba 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -333,8 +333,6 @@ of (command, word) to be used by `flyspell-do-correct'.")) :condition (get-buffer-window) (my/yas-init)) - - :config (set-face-attribute 'yas-field-highlight-face nil :foreground nil diff --git a/modules/config-modes.el b/modules/config-modes.el index ab196ae5..05fe088c 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -620,11 +620,37 @@ (with-eval-after-load 'folding (when (fboundp 'folding-add-to-marks-list) (folding-add-to-marks-list 'typescript-mode "// {{{" "// }}}" ))) + (use-package tide :defer-install t - :commands (tide-setup)) - - (add-hook 'typescript-mode-hook #'tide-setup)) + :commands (tide-setup) + :config + ;; This is because tide is poorly behaved and messes with + ;; company-backends on load + (cl-delete 'company-tide company-backends)) + + (add-hook 'typescript-mode-hook #'tide-setup) + + (eval-and-compile + (cl-macrolet + ((company-define-specific-modes + (mode) + `(progn + (add-hook ,mode + (lambda () + (require 'company) + (require 'cl-lib) + (let ((old-backends company-backends)) + (set (make-local-variable 'company-backends) + '((company-tide + company-yasnippet + company-files) + (company-dabbrev-code) + company-dabbrev)))))))) + (with-no-warnings + (my/generate-calls-single + 'company-define-specific-modes + '('typescript-mode-hook)))))) (use-package impatient-mode :defer-install t From f72ae2035eb242066464d04cac0ee651b4f51f81 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 21 Jul 2020 09:36:00 -0700 Subject: [PATCH 118/303] Disable TRAMP ControlMaster when configured at system level --- modules/config-tramp.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 9abe4b32..bb59d19d 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -50,6 +50,20 @@ (with-eval-after-load 'tramp-sh (eval-when-compile (require 'cl-lib)) + (setq tramp-use-ssh-controlmaster-options + (eval-when-compile + (not + (let ((config + (with-output-to-string + (with-current-buffer + standard-output + (call-process "ssh" nil '(t nil) nil + "-G" + "quark-emacs-nonexistent-host"))))) + (and + (string-match-p (rx bol "controlmaster auto" eol) config) + (string-match-p (rx bol "controlpersist yes" eol) config)))))) + (advice-add 'tramp-do-copy-or-rename-file-directly :filter-args (my/defun-as-value nadvice/tramp-no-preserve-uid-gid-msdos (args) From e6f41b0b3e5c58ecd18cdd609f3a0955f7f6ddc9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 21 Jul 2020 09:50:48 -0700 Subject: [PATCH 119/303] Remove major mode configurations for elixir-mode and dylan-mode --- modules/config-modes.el | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 05fe088c..0b007a95 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1472,17 +1472,6 @@ :commands (fsharp-mode) :mode ("\\.fs[iylx]?$" . fsharp-mode)) -(use-package elixir-mode - :defer-install t - :commands (elixir-mode-open-mode - elixir-mode-open-elixir-home - elixir-mode-open-docs-master - elixir-mode-open-docs-stable - elixir-mode-version) - :mode (("\\.elixir\\'" . elixir-mode) - ("\\.ex\\'" . elixir-mode) - ("\\.exs\\'" . elixir-mode))) - (use-package gnuplot :defer-install t :commands (gnuplot-mode @@ -1490,13 +1479,6 @@ run-gnuplot) :mode ("\\.gp$" . gnuplot-mode)) -(use-package dylan-mode - :defer-install t - :commands (dylan-mode - dylanlid-mode) - :mode (("\\.dylan\\'" . dylan-mode) - ("\\.lid\\'" . dylanlid-mode))) - (use-package processing-mode :defer-install t :commands (processing-find-sketch From 7a7ba46b62df73760d8f66b877767c1baf4d7022 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 22 Jul 2020 12:52:31 -0700 Subject: [PATCH 120/303] Add function to option current file with a different TRAMP method --- modules/config-tramp.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index bb59d19d..b464ed37 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -194,4 +194,19 @@ #'nadvice/su-disable-maybe-setup)) (remove-hook 'before-save-hook #'su--before-save-hook t)))) +(defun tramp-switch-method (method &optional file-name) + (interactive (list + (completing-read "Choose algorithm: " + (mapcar #'car tramp-methods)))) + (find-alternate-file + (with-parsed-tramp-file-name (or file-name buffer-file-name) parsed + (tramp-make-tramp-file-name + method + parsed-user + parsed-domain + parsed-host + parsed-port + parsed-localname + parsed-hop)))) + (provide 'config-tramp) From dbc5e9fb20e8b2cb631b4721e772000804043e4d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 22 Jul 2020 15:21:54 -0700 Subject: [PATCH 121/303] Don't require ControlPersist=yes to use host ssh config in TRAMP --- modules/config-tramp.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index b464ed37..2206e350 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -60,9 +60,7 @@ (call-process "ssh" nil '(t nil) nil "-G" "quark-emacs-nonexistent-host"))))) - (and - (string-match-p (rx bol "controlmaster auto" eol) config) - (string-match-p (rx bol "controlpersist yes" eol) config)))))) + (string-match-p (rx bol "controlmaster auto" eol) config))))) (advice-add 'tramp-do-copy-or-rename-file-directly :filter-args From a12083f5e4e44118cabfb8ed7b4057902eecab42 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 26 Jul 2020 11:26:10 -0700 Subject: [PATCH 122/303] Use el-patch@master since the develop branch has vanished --- modules/config-package.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index 0bd1bb4b..ba7f2e87 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -261,8 +261,7 @@ second, floating-point values are rounded down to the nearest integer.)" (straight-use-package '(el-patch :type git :host github - :repo "raxod502/el-patch" - :branch "develop")) + :repo "raxod502/el-patch")) (eval-when-compile (require 'el-patch)) (setq el-patch-use-aggressive-defvar t) From 41da12d4cf517ab2c3a0e7bb80c19cb9384373c8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 26 Jul 2020 14:33:07 -0700 Subject: [PATCH 123/303] Add slurm-mode and slurm-script-mode --- modules/config-modes.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 0b007a95..ee8fb1e7 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -927,6 +927,26 @@ (advice-add 'ansi-term :filter-args #'nadvice/ansi-term)) +(use-package slurm-script-mode + :recipe (slurm-script-mode + :type git + :host github + :repo "PythonNut/slurm.el" + :files ("slurm-script-mode.el")) + :defer-install t + :commands (slurm-script-mode)) + +(use-package slurm-mode + :recipe (slurm-mode + :type git + :host github + :repo "PythonNut/slurm.el" + :files ("slurm-mode.el")) + :defer-install t + :commands (slurm) + :config + (evil-set-initial-state 'slurm-mode 'insert)) + (defun eshell-kill-whole-line () (interactive) (eshell-bol) From bffba4731356a9c7253a9d70132446c6e16ec22a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Aug 2020 12:56:08 -0700 Subject: [PATCH 124/303] Replace evil-latex-textobjects and ad-hoc config with evil-tex --- modules/config-tex.el | 110 ++---------------------------------------- 1 file changed, 3 insertions(+), 107 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 6d4021e6..5edbbc41 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -253,90 +253,10 @@ matching string." (use-package evil :config - (use-package evil-latex-textobjects - :recipe (evil-latex-textobjects :type git - :host github - :repo "hpdeifel/evil-latex-textobjects" - :files ("evil-latex-textobjects.el")) - :commands (evil-latex-textobjects-mode - turn-on-evil-latex-textobjects-mode - turn-off-evil-latex-textobjects-mode) - - :config - (defun my/evil-TeX--expression-range (&optional count exclusive) - (cond - ((string= (LaTeX-current-environment) "minted") - (list (cdr (evil-latex-textobjects-env-beginning)) - (car (evil-latex-textobjects-env-end)))) - (t - (let* ((terminators (rx (or "&" - "=" - "\\\\" - "\\item" - "%" - "\\label" - "\\end" - "\\]" - "\\[" - "$" - (and "\\begin{" - (zero-or-more - (or letter "*")) - "}" - (zero-or-more - (or - (and "[" - (zero-or-more any) - "]") - (and "{" - (zero-or-more any) - "}"))))))) - (beg (save-excursion - (while (not (or - (bobp) - (looking-back (if exclusive - (concat (format "\\(%s\\)" terminators) - (rx (zero-or-more (or space "\n")))) - terminators) - (max (point-min) - (- (point) 80))))) - (forward-char -1)) - (point))) - (end (save-excursion - (while (not (or - (eobp) - (looking-at (if exclusive - (concat (rx (zero-or-more (or space "\n"))) - (format "\\(%s\\)" terminators)) - terminators)))) - (forward-char 1)) - (point)))) - (list beg end))))) - - (evil-define-text-object evil-indent-i-TeX-expression (&optional count _beg _end _type) - "Text object describing the block with the same indentation as the current line." - (cl-destructuring-bind (begin end) - (my/evil-TeX--expression-range count t) - (evil-range begin end 'char))) - - (evil-define-text-object evil-indent-a-TeX-expression (&optional count _beg _end _type) - "Text object describing the block with the same indentation as the current line." - (cl-destructuring-bind (begin end) - (my/evil-TeX--expression-range count nil) - (evil-range begin end 'char))) - - (define-key evil-latex-textobjects-inner-map "=" #'evil-indent-i-TeX-expression) - (define-key evil-latex-textobjects-outer-map "=" #'evil-indent-a-TeX-expression)) - - (defun my/evil-LaTeX-setup () - (require 'evil-surround) - (evil-latex-textobjects-mode +1) - (setq evil-surround-pairs-alist - (append (list '(?\( . ("\\left( " . " \\right)")) - '(?\[ . ("\\left[ " . " \\right]")) - '(?\{ . ("\\left{ " . " \\right}"))) - evil-surround-pairs-alist))) + (use-package evil-tex + :commands (evil-tex-mode)) + (add-hook 'LaTeX-mode-hook #'evil-tex-mode) (add-hook 'LaTeX-mode-hook #'my/evil-LaTeX-setup) (evil-set-initial-state 'TeX-error-overview-mode 'insert)) @@ -386,30 +306,6 @@ matching string." (funcall old-fun string dollar) (funcall old-fun string (not dollar)))))) - (defun my/embrace-with-TeX-environment () - (let* ((input (read-string "Environment: ")) - (newline (if (= (elt input (1- (length input))) ?\n) "\n" "")) - (environment (if (or (string-empty-p newline) - (string-empty-p input)) - input - (substring input 0 (1- (length input)))))) - (cons (format "\\begin{%s}%s" (or environment "") newline) - (format "%s\\end{%s}" newline (or environment ""))))) - - (add-hook - 'LaTeX-mode-hook - (my/defun-as-value my/embrace-TeX-setup () - (require 'embrace) - (embrace-add-pair ?= "\\verb|" "|") - (embrace-add-pair ?~ "\\texttt{" "}") - (embrace-add-pair ?/ "\\(" "\\)") - (embrace-add-pair ?* "\\textbf{" "}") - (embrace-add-pair ?$ "$" "$") - (embrace-add-pair ?\\ "\\[" "\\]") - (embrace-add-pair-regexp ?e "\\\\begin{[^\}]*?}" "\\\\end{[^\}]*?}" - 'my/embrace-with-TeX-environment - (embrace-build-help "\\begin{env}" "\\end{env}")))) - (add-hook 'TeX-after-insert-macro-hook (my/defun-as-value my/auto-yasnippet-TeX-macro () From e0f59a5b82faf6bf71914a9c10aad784f91ae837 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Aug 2020 12:56:48 -0700 Subject: [PATCH 125/303] Switch back to standard source for helm-rg Since cosmicexplorer/helm-rg/pull/25 was merged. --- modules/config-helm.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 8658f549..8bc0e453 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -355,11 +355,6 @@ (use-package helm-git-grep) (use-package helm-rg - :recipe - (helm-rg :type git - :host github - :repo "braineo/helm-rg" - :branch "fix-helm-source") :init (defvar my/rg-available nil) From 40b186034d270310e25b677f6d418057210ef600 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Aug 2020 13:11:45 -0700 Subject: [PATCH 126/303] For helm-interfile-omni, avoid full-text search when not in project --- modules/config-helm.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 8bc0e453..da8212df 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -413,17 +413,17 @@ (unless slow-fs (append ;; code search - (if (and projectile-root - (featurep 'vc-git) - (vc-git-responsible-p projectile-root) - (require 'helm-git-grep)) - '(helm-source-git-grep) - (if my/rg-available - (progn - (setq my/rg-used t) - '(helm-rg-process-source)) - (when my/ag-available - '(helm-source-do-ag)))) + (when projectile-root + (if (and (featurep 'vc-git) + (vc-git-responsible-p projectile-root) + (require 'helm-git-grep)) + '(helm-source-git-grep) + (if my/rg-available + (progn + (setq my/rg-used t) + '(helm-rg-process-source)) + (when my/ag-available + '(helm-source-do-ag))))) ;; file location, of which projectile is a faster subset (unless projectile-root From 283fcc0ac81ff86f7805ec74a480fba6b6f774ca Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Aug 2020 13:12:14 -0700 Subject: [PATCH 127/303] Hide the helm header line --- modules/config-helm.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-helm.el b/modules/config-helm.el index da8212df..7ab5b347 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -29,6 +29,7 @@ (set-face-attribute 'helm-selection nil :underline nil) (setq helm-case-fold-search 'smart helm-candidate-separator (make-string 20 ?─) + helm-display-header-line nil helm-inherit-input-method nil)) (use-package helm-info From 546a087fd5e648fd2274c7358ac5a7895a4e353e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 8 Aug 2020 18:13:28 -0700 Subject: [PATCH 128/303] Disable helm-semantic in my/intrafile-omni --- modules/config-helm.el | 13 ++----------- modules/config-package.el | 2 -- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 7ab5b347..b7b66060 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -188,11 +188,6 @@ :init (setq helm-imenu-fuzzy-match t)) -(use-package helm-semantic - :ensure nil - :init - (setq helm-semantic-fuzzy-match t)) - (use-package helm-command :ensure nil :config @@ -453,12 +448,8 @@ (helm :sources (append - (if (and (featurep 'semantic) - (semantic-active-p) - (require 'helm-semantic nil t)) - '(helm-source-semantic) - (when (require 'helm-imenu nil t) - '(helm-source-imenu))) + (when (require 'helm-imenu nil t) + '(helm-source-imenu)) '(;; files helm-source-occur diff --git a/modules/config-package.el b/modules/config-package.el index ba7f2e87..055bd140 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -218,8 +218,6 @@ second, floating-point values are rounded down to the nearest integer.)" (idle-job-add-require 'ibuf-ext) (idle-job-add-require 'ibuffer) -(idle-job-add-require 'helm-semantic) - (idle-job-add-require 'helm-for-files) (idle-job-add-require 'recentf) (idle-job-add-require 'helm-bookmark) From 12dccd9341e173a8591df94bbf166ce28cabed1c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 8 Aug 2020 23:14:34 -0700 Subject: [PATCH 129/303] Remove smooth-scrolling-mode --- modules/config-ui.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index 710c01cc..8b381f4a 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -11,7 +11,6 @@ (setq mouse-wheel-scroll-amount '(3 ((shift) . 1)) mouse-wheel-progressive-speed nil mouse-wheel-follow-mouse t - smooth-scroll-margin 5 scroll-step 1 auto-window-vscroll nil scroll-conservatively 1000) @@ -43,10 +42,6 @@ (define-key isearch-mode-map "j" #'isearch-exit-chord) (define-key isearch-mode-map "k" #'isearch-exit-chord) -(use-package smooth-scrolling - :config - (smooth-scrolling-mode +1)) - (use-package multiple-cursors :commands (mc/mark-lines mc/mark-next-lines From d9dccab855b3f5e6d26e3d4be8896a823c0183e4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 9 Aug 2020 01:10:25 -0700 Subject: [PATCH 130/303] Load winner-mode during idle time --- modules/config-package.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-package.el b/modules/config-package.el index 055bd140..6ea45b7c 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -251,6 +251,8 @@ second, floating-point values are rounded down to the nearest integer.)" (idle-job-add-require 'helm-source) (idle-job-add-require 'helm-lib) +(idle-job-add-require 'winner) + (straight-use-package '(use-package :type git :host github From 30438296feadcb85df63ffddf01b8e663de5c3d6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 14 Aug 2020 17:50:06 -0700 Subject: [PATCH 131/303] Add post handlers for curly braces in typescript-mode --- modules/config-modes.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index ee8fb1e7..c54acd1d 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -621,6 +621,12 @@ (when (fboundp 'folding-add-to-marks-list) (folding-add-to-marks-list 'typescript-mode "// {{{" "// }}}" ))) + (with-eval-after-load 'smartparens + (sp-local-pair 'typescript-mode "{" nil :post-handlers + '(:add + ("||\n[i]" "RET") + ("| " "SPC")))) + (use-package tide :defer-install t :commands (tide-setup) From 4bd7da0eabc7b982d17f172b7aff02de8b402bd8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 16 Aug 2020 00:24:59 -0700 Subject: [PATCH 132/303] Remove flyspell-lazy-called-interactively-p in flyspell-lazy-mode --- modules/config-intel.el | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 95178eba..c51420ec 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -232,21 +232,6 @@ by doing (clear-string STRING)." (el-patch-feature flyspell-lazy) - (el-patch-defmacro flyspell-lazy-called-interactively-p (&optional kind) - "A backward-compatible version of `called-interactively-p'. - -Optional KIND is as documented at `called-interactively-p' -in GNU Emacs 24.1 or higher." - (cond - ((not (fboundp 'called-interactively-p)) - '(interactive-p)) - ((condition-case nil - (progn (called-interactively-p 'any) t) - (error nil)) - `(called-interactively-p ,kind)) - (t - '(called-interactively-p)))) - (el-patch-define-minor-mode flyspell-lazy-mode "Turn on flyspell-lazy-mode. @@ -266,12 +251,16 @@ is 'toggle." (cond (flyspell-lazy-mode (add-hook 'flyspell-mode-hook 'flyspell-lazy-load t) - (when (and (flyspell-lazy-called-interactively-p 'interactive) + (when (and (el-patch-swap + (flyspell-lazy-called-interactively-p 'interactive) + (called-interactively-p 'interactive)) (not flyspell-lazy-less-feedback)) (message "flyspell-lazy mode enabled"))) (t (flyspell-lazy-unload 'global) - (when (and (flyspell-lazy-called-interactively-p 'interactive) + (when (and (el-patch-swap + (flyspell-lazy-called-interactively-p 'interactive) + (called-interactively-p 'interactive)) (not flyspell-lazy-less-feedback)) (message "flyspell-lazy mode disabled"))))) From 0b1ddda5ddeb4cb75c448767069290d5072a3372 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 16 Aug 2020 00:26:08 -0700 Subject: [PATCH 133/303] Use minor modes for su.el configuration --- modules/config-tramp.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 2206e350..71cacdac 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -126,22 +126,12 @@ (progn (when su-auto-make-directory (advice-add 'basic-save-buffer :around - #'su--nadvice-make-directory-auto-root) - - (when su-enable-helm-integration - (with-eval-after-load 'helm-files - (advice-add 'helm-find-file-or-marked :around - #'su--nadvice-make-directory-auto-root)))) + #'su--nadvice-make-directory-auto-root)) (when su-auto-write-file (add-hook 'find-file-hook #'su--edit-file-as-root-maybe) (advice-add 'find-file-noselect :around - #'su--nadvice-find-file-noselect) - - (when su-enable-semantic-integration - (with-eval-after-load 'semantic/fw - (advice-add 'semantic-find-file-noselect :around - #'su--nadvice-supress-find-file-hook)))) + #'su--nadvice-find-file-noselect)) (when su-auto-read-file (advice-add 'find-file-noselect-1 :around @@ -150,17 +140,30 @@ (remove-hook 'find-file-hook #'su--edit-file-as-root-maybe) (advice-remove 'basic-save-buffer #'su--nadvice-make-directory-auto-root) - (advice-remove 'helm-find-file-or-marked - #'su--nadvice-make-directory-auto-root) (advice-remove 'find-file-noselect #'su--nadvice-find-file-noselect) - (advice-remove 'semantic-find-file-noselect - #'su--nadvice-supress-find-file-hook) (advice-remove 'find-file-noselect-1 #'su--nadvice-find-file-noselect-1))) + (el-patch-define-minor-mode su-helm-integration-mode + "Enable su-mode integration with helm." + :init-value nil + :group 'su + :global t + (if su-helm-integration-mode + (advice-add 'helm-find-file-or-marked :around + #'su--nadvice-make-directory-auto-root) + (advice-remove 'helm-find-file-or-marked + #'su--nadvice-make-directory-auto-root))) + (su-mode +1) + (with-eval-after-load 'helm-files + (su-helm-integration-mode +1)) + (with-eval-after-load 'semantic/fw + (require 'su) + (su-semantic-integration-mode +1)) + :config (eval-when-compile (with-demoted-errors "Load error: %s" From 08ec4bde6a41a6878f7d082ac8b62b35731b3b49 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 16 Aug 2020 08:03:49 -0700 Subject: [PATCH 134/303] Rename config-setq to config-core --- init-benchmark.el | 2 +- init-minimal.el | 2 +- init.el | 2 +- modules/{config-setq.el => config-core.el} | 2 +- modules/config-intel.el | 2 +- modules/config-python.el | 6 ++++-- 6 files changed, 9 insertions(+), 7 deletions(-) rename modules/{config-setq.el => config-core.el} (99%) diff --git a/init-benchmark.el b/init-benchmark.el index 46a33980..e4b824ed 100644 --- a/init-benchmark.el +++ b/init-benchmark.el @@ -32,7 +32,7 @@ (load custom-file) (error (with-temp-file custom-file))) -(require 'config-setq) +(require 'config-core) (message "[= ] package") (require 'config-package) (message "[== ] desktop") diff --git a/init-minimal.el b/init-minimal.el index b7a133ea..98eefa20 100644 --- a/init-minimal.el +++ b/init-minimal.el @@ -1,7 +1,7 @@ (eval-and-compile (add-to-list 'load-path (locate-user-emacs-file "modules/"))) -(require 'config-setq) +(require 'config-core) ;; first subtractive (menu-bar-mode -1) diff --git a/init.el b/init.el index 87f13284..ba0e9d12 100644 --- a/init.el +++ b/init.el @@ -57,7 +57,7 @@ (load custom-file) (error (with-temp-file custom-file))) - (require 'config-setq) + (require 'config-core) (message "[= ] package") (require 'config-package) (message "[== ] desktop") diff --git a/modules/config-setq.el b/modules/config-core.el similarity index 99% rename from modules/config-setq.el rename to modules/config-core.el index 6900ffeb..46ae54ca 100644 --- a/modules/config-setq.el +++ b/modules/config-core.el @@ -320,4 +320,4 @@ response as a no." (message "%s" result) (kill-new result))) -(provide 'config-setq) +(provide 'config-core) diff --git a/modules/config-intel.el b/modules/config-intel.el index c51420ec..a2cccc4c 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -540,7 +540,7 @@ is binary, activate `hexl-mode'." (defun run-file-manager () (interactive) - (require 'config-setq) + (require 'config-core) (when (file-remote-p default-directory) (error "Opening file manager with remote directory not implemented!")) (let ((dir (my/file-name-first-existing-parent diff --git a/modules/config-python.el b/modules/config-python.el index 95dde10a..8c47138f 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -1,6 +1,8 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) -(eval-when-compile (require 'config-setq)) +(eval-when-compile + (require 'config-macros) + (require 'config-core)) + ;; ============================================================================= ;; Python ====================================================================== From 286d25cf387f633cd9e95eb0ab28a44c6dc2e357 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 17 Aug 2020 21:17:12 -0700 Subject: [PATCH 135/303] Disable use of auth-info for TRAMP --- modules/config-tramp.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 71cacdac..a0f1bab2 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -23,6 +23,7 @@ (with-eval-after-load 'tramp (eval-when-compile (require 'tramp)) + (setq tramp-completion-use-auth-sources nil) ;; Define a rsyncx method analogous to scpx (add-to-list 'tramp-methods `("rsyncx" @@ -45,6 +46,11 @@ (tramp-copy-keep-tmpfile t) (tramp-copy-recursive t))) + (advice-add 'tramp-read-passwd :around + (my/defun-as-value my/tramp-disable-auth-sources (old-fun &rest args) + (let ((auth-sources)) + (apply old-fun args)))) + (setq tramp-backup-directory-alist `((,(rx (zero-or-more anything)) . ,my/tramp-backup-directory)))) From 5431983632079392386a0f9d50ed7435db5d7d49 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 17 Aug 2020 21:26:07 -0700 Subject: [PATCH 136/303] Set helm-ff-keep-cached-candidates to nil --- modules/config-helm.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index b7b66060..3e2aff4b 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -154,7 +154,7 @@ helm-ff-newfile-prompt-p nil helm-ff-skip-boring-files t helm-recentf-fuzzy-match t - + helm-ff-keep-cached-candidates nil helm-boring-file-regexp-list (append helm-boring-file-regexp-list (list (rx ".synctex.gz" line-end) (rx ".undo.xz" line-end) From dfdd3c02bd5e17724c4953beef37586d859b04a6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 19 Aug 2020 09:08:04 -0700 Subject: [PATCH 137/303] Skip unneeded work for recentf-save-list and enable recentf autosave --- modules/config-desktop.el | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index a9703820..f08af6a8 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -348,6 +348,47 @@ where it was when you previously visited the same file." (dolist (hook recentf-used-hooks) (apply #'remove-hook hook)) (recentf-mode +1) + (el-patch-defun recentf-save-list () + "Save the recent list. +Write data into the file specified by `recentf-save-file'." + (interactive) + (condition-case error + (with-temp-buffer + (erase-buffer) + (set-buffer-file-coding-system recentf-save-file-coding-system) + (insert (format-message recentf-save-file-header + (current-time-string))) + (recentf-dump-variable 'recentf-list recentf-max-saved-items) + (recentf-dump-variable 'recentf-filter-changer-current) + (insert "\n \n;; Local Variables:\n" + (format ";; coding: %s\n" recentf-save-file-coding-system) + ";; End:\n") + (el-patch-swap + (write-file (expand-file-name recentf-save-file)) + (let ((true-file (expand-file-name recentf-save-file)) + (temp-file (make-temp-file "historian"))) + (write-region nil nil temp-file nil true-file) + (rename-file temp-file true-file t))) + (when recentf-save-file-modes + (set-file-modes recentf-save-file recentf-save-file-modes)) + nil) + (error + (warn "recentf mode: %s" (error-message-string error))))) + + (let ((recentf-autosave-timer nil)) + (defun nadvice/recentf-autosave (&rest _args) + (when (timerp recentf-autosave-timer) + (cancel-timer recentf-autosave-timer)) + (setq recentf-autosave-timer + (run-with-idle-timer + 1 nil + (lambda () + (let ((inhibit-message t)) + (recentf-save-list))))))) + + (advice-add 'recentf-track-opened-file :after + #'nadvice/recentf-autosave) + (defun nadvice/recentf-quiet (old-fun &rest args) (let ((inhibit-message t)) (apply old-fun args))) From 176e69ff82b7120cf4d03eeb7265c7350324d508 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 28 Aug 2020 23:46:27 -0700 Subject: [PATCH 138/303] Remove vestigial alternative sit-for function --- modules/config-package.el | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index 6ea45b7c..aa9ed52f 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -31,21 +31,6 @@ (add-to-list 'load-path (locate-user-emacs-file "personal/")) -(defun my/sit-for (seconds) - "Redisplay, then wait for SECONDS seconds. Stop when input is available. -SECONDS may be a floating-point value. -\(On operating systems that do not support waiting for fractions of a -second, floating-point values are rounded down to the nearest integer.)" - (unless (input-pending-p t) - (redisplay) - (let ((read (let ((input-method-function nil)) - (read-event nil t seconds)))) - (when read - ;; This is from the normal definition of sit-for, but - ;; "(cons t read)" has been replaced by "read". - ;; This is to avoid nasty " is undefined" errors. - (push read unread-command-events))))) - (defvar idle-jobs nil "Symbols which need to be autoloaded.") From 4e23f5cf7d501bc6f4cd375feb0891f83e46cf61 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 29 Aug 2020 11:49:55 -0700 Subject: [PATCH 139/303] Remove srefactor --- modules/config-intel.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index a2cccc4c..742ffd49 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -99,12 +99,6 @@ by doing (clear-string STRING)." (flycheck-overlays-at (point))) (apply old-fun args))))) -(use-package srefactor - :defer-install t - :commands (srefactor-refactor-at-point) - :config - (evil-set-initial-state 'srefactor-ui-menu-mode 'emacs)) - (use-package abbrev :ensure nil :config From 23337adeec6dcd0be4361ff50fa9306514a45610 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 11 Sep 2020 10:10:08 -0700 Subject: [PATCH 140/303] Update lsp-python-ms patches to work for Emacs 27 --- modules/config-python.el | 95 +++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 8c47138f..72430113 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -169,56 +169,61 @@ Return either a string or nil." "Microsoft.Python.LanguageServer" (and (eq system-type 'windows-nt) ".exe"))))) - (el-patch-defun lsp-python-ms-locate-python () - "Look for virtual environments local to the workspace" + (el-patch-defun lsp-python-ms-locate-python (&optional dir) + "Look for virtual environments local to the workspace." (let* ((el-patch-add - (virtualenv (my/python-find-virtualenv-cached)) - (virtualenv-python (f-expand "bin/python" virtualenv))) - (venv (locate-dominating-file default-directory "venv/")) - (sys-python (executable-find - lsp-python-ms-python-executable-cmd)) - (venv-python (f-expand "venv/bin/python" venv))) - (cond - (el-patch-add - ((and virtualenv (f-executable? virtualenv-python)) - virtualenv-python)) - ((and venv (f-executable? venv-python)) venv-python) - (sys-python)))) - - (el-patch-defun lsp-python-ms--get-python-ver-and-syspath (workspace-root) + (virtualenv (my/python-find-virtualenv-cached dir)) + (virtualenv-python (and virtualenv (f-expand "bin/python" virtualenv)))) + (pyenv-python (lsp-python-ms--dominating-pyenv-python dir)) + (venv-python (lsp-python-ms--dominating-venv-python dir)) + (conda-python (lsp-python-ms--dominating-conda-python dir)) + (sys-python (if (>= emacs-major-version 27) + (executable-find lsp-python-ms-python-executable-cmd lsp-python-ms-prefer-remote-env) + (executable-find lsp-python-ms-python-executable-cmd)))) + ;; pythons by preference: local pyenv version, local conda version + + (if lsp-python-ms-guess-env + (cond ((lsp-python-ms--valid-python lsp-python-ms-python-executable)) + (el-patch-add ((lsp-python-ms--valid-python virtualenv-python))) + ((lsp-python-ms--valid-python venv-python)) + ((lsp-python-ms--valid-python pyenv-python)) + ((lsp-python-ms--valid-python conda-python)) + ((lsp-python-ms--valid-python sys-python))) + (cond ((lsp-python-ms--valid-python sys-python)))))) + + (el-patch-defun lsp-python-ms--get-python-ver-and-syspath (&optional workspace-root) "Return list with pyver-string and list of python search paths. The WORKSPACE-ROOT will be prepended to the list of python search paths and then the entire list will be json-encoded." - (when-let - ((python (lsp-python-ms-locate-python)) - (default-directory workspace-root) - (init "from __future__ import print_function; import sys; \ -sys.path = list(filter(lambda p: p != '', sys.path)); import json;") - (ver "v=(\"%s.%s\" % (sys.version_info[0], sys.version_info[1]));") - (sp (concat "sys.path.insert(0, '" workspace-root "'); p=sys.path;")) - (ex "e=sys.executable;") - (val "print(json.dumps({\"version\":v,\"paths\":p,\"executable\":e}))")) - - (with-temp-buffer - (el-patch-wrap 3 - (if (tramp-tramp-file-p python) - (with-parsed-tramp-file-name python parsed - (let ((default-directory (file-name-directory python))) - (process-file parsed-localname nil t nil "-c" - (concat init ver sp ex val)))) - (call-process python nil t nil "-c" - (concat init ver sp ex val)))) - - - (let* ((json-array-type 'vector) - (json-key-type 'string) - (json-object-type 'hash-table) - (json-string (buffer-string)) - (json-hash (json-read-from-string json-string))) - (list (gethash "version" json-hash) - (gethash "paths" json-hash) - (gethash "executable" json-hash)))))) + (let* ((python (and t (lsp-python-ms-locate-python))) + (workspace-root (and python (or workspace-root "."))) + (default-directory (and workspace-root workspace-root)) + (init (and default-directory + "from __future__ import print_function; import sys; sys.path = list(filter(lambda p: p != '', sys.path)); import json;")) + (ver (and init "v=(\"%s.%s\" % (sys.version_info[0], sys.version_info[1]));")) + (sp (and ver (concat "sys.path.insert(0, '" workspace-root "'); p=sys.path;"))) + (ex (and sp "e=sys.executable;")) + (val (and ex "print(json.dumps({\"version\":v,\"paths\":p,\"executable\":e}))"))) + (when val + (with-temp-buffer + (el-patch-wrap 3 + (if (tramp-tramp-file-p python) + (with-parsed-tramp-file-name python parsed + (let ((default-directory (file-name-directory python))) + (process-file parsed-localname nil t nil "-c" + (concat init ver sp ex val)))) + (call-process python nil t nil "-c" + (concat init ver sp ex val)))) + (let* ((json-array-type 'vector) + (json-key-type 'string) + (json-object-type 'hash-table) + (json-string (buffer-string)) + (json-hash (json-read-from-string json-string))) + (list + (gethash "version" json-hash) + (gethash "paths" json-hash) + (gethash "executable" json-hash))))))) (el-patch-defun lsp-python-ms--extra-init-params (&optional workspace) "Return form describing parameters for language server. From fb5eba290dbca1af0aa1de48c41b6c9c1d162f9e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 20 Sep 2020 22:53:58 -0700 Subject: [PATCH 141/303] Fix pyls-remote with lsp-mode 7.0 --- modules/config-modes.el | 16 ++++++++++++++++ modules/config-python.el | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index c54acd1d..1249237a 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1588,6 +1588,22 @@ lsp-auto-guess-root t lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1"))) + (el-patch-defun lsp-server-present? (final-command) + "Check whether FINAL-COMMAND is present." + ;; executable-find only gained support for remote checks after 27 release + (or (and (cond + ((not (file-remote-p default-directory)) + (executable-find (cl-first final-command))) + ((version<= "27.0" emacs-version) + (el-patch-wrap 2 + (or + (file-executable-p (my/tramp-build-name-from-localname (cl-first final-command))) + (with-no-warnings (executable-find (cl-first final-command) (file-remote-p default-directory)))))) + (t)) + (prog1 t + (lsp-log "Command \"%s\" is present on the path." (s-join " " final-command)))) + (ignore (lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command))))) + (use-package lsp-ui :commands lsp-ui-mode :init diff --git a/modules/config-python.el b/modules/config-python.el index 72430113..462bed77 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -275,7 +275,7 @@ directory" (make-lsp-client :new-connection (lsp-stdio-connection - (my/defun-as-value my/python-find-project-pyls () + (my/defun-as-value my/python-find-poetry-pyls () (let ((pyls-path (expand-file-name "bin/pyls" (my/python-find-virtualenv-cached)))) @@ -295,13 +295,12 @@ directory" (make-lsp-client :new-connection (lsp-tramp-connection - (my/defun-as-value my/python-find-project-pyls () + (my/defun-as-value my/python-find-remote-pyls () (let ((pyls-path (expand-file-name "bin/pyls" (my/python-find-virtualenv-cached)))) (when (file-executable-p pyls-path) - (with-parsed-tramp-file-name pyls-path parsed - parsed-localname))))) + (my/tramp-localname pyls-path))))) :major-modes '(python-mode) :remote? t :priority -3 From 5b30cbc1aa2806aa6d3a414b21fadaf5e040ae6d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 30 Sep 2020 00:15:28 -0700 Subject: [PATCH 142/303] Fix cua-cut-region advice --- modules/config-paste.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index d14f1fd9..ec9c6aaa 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -125,13 +125,11 @@ move the yanking point; just return the Nth kill forward." 'cua-cut-region :around (my/defun-as-value nadvice/cua-cut-region (old-fun &optional prefix) (interactive "*p") - (whole-line-or-region-call-with-region - (lambda (_beg _end &optional _prefix) - (interactive "rP") - (call-interactively - old-fun - current-prefix-arg)) - prefix t t prefix))) + (whole-line-or-region-wrap-region-kill + (lambda (_beg _end &optional _region) + (interactive (list (mark) (point) 'region)) + (funcall old-fun current-prefix-arg)) + 0))) ;; cua-yank a line if cut as a line (advice-add From bb69b3cde1fd47cbfa62cc00025bc4a69f89d490 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 30 Sep 2020 02:37:54 -0700 Subject: [PATCH 143/303] Stall for remote connections to avoid race during lsp workspace init --- modules/config-modes.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 1249237a..4887f6d2 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1588,6 +1588,14 @@ lsp-auto-guess-root t lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1"))) + (defun my/lsp-before-initialize/stall-for-remote-connections () + (when (lsp--client-remote? + (lsp--workspace-client lsp--cur-workspace)) + (sit-for 0.1))) + + (add-hook 'lsp-before-initialize-hook + #'my/lsp-before-initialize/stall-for-remote-connections) + (el-patch-defun lsp-server-present? (final-command) "Check whether FINAL-COMMAND is present." ;; executable-find only gained support for remote checks after 27 release From cf3bcc74c7bd745dbc9b803ca4f43cf5ded84a7e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 5 Oct 2020 21:11:08 -0700 Subject: [PATCH 144/303] Update helpful completion-table patch --- modules/config-modes.el | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 4887f6d2..e7e4fe56 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -74,25 +74,28 @@ (define-key helpful-mode-map "J" #'forward-button) (define-key helpful-mode-map "K" #'backward-button) - (el-patch-defun helpful--read-symbol (prompt predicate) - (let* ((sym-here (symbol-at-point)) - (default-val - (when (funcall predicate sym-here) - (symbol-name sym-here)))) - (when default-val - ;; TODO: Only modify the prompt when we don't have ido/ivy/helm, - ;; because the default is obvious for them. - (setq prompt - (replace-regexp-in-string - (rx ": " eos) - (format " (default: %s): " default-val) - prompt))) - (intern (completing-read - prompt - (el-patch-swap obarray - #'help--symbol-completion-table) - predicate t nil nil - default-val))))) + (el-patch-defun helpful--read-symbol (prompt default-val predicate) + "Read a symbol from the minibuffer, with completion. +Returns the symbol." + (when (and default-val + (not (funcall predicate default-val))) + (setq default-val nil)) + (when default-val + ;; `completing-read' expects a string. + (setq default-val (symbol-name default-val)) + + ;; TODO: Only modify the prompt when we don't have ido/ivy/helm, + ;; because the default is obvious for them. + (setq prompt + (replace-regexp-in-string + (rx ": " eos) + (format " (default: %s): " default-val) + prompt))) + (intern (completing-read prompt + (el-patch-swap obarray + #'help--symbol-completion-table) + predicate t nil nil + default-val)))) (use-package macrostep :defer-install t From f235bc3de52c60e8275d226baba188a35726490c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 5 Oct 2020 21:28:49 -0700 Subject: [PATCH 145/303] Smart expand-region or switch to visual-char on v in visual state --- modules/config-evil.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/config-evil.el b/modules/config-evil.el index e2b7f8f8..6c7a8475 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -82,7 +82,13 @@ (define-key evil-visual-state-map (kbd "C-M-z") #'evil-emacs-state) (define-key evil-motion-state-map (kbd "C-z") nil) - (define-key evil-visual-state-map (kbd "v") #'er/expand-region) + (defun evil-visual-char-or-expand-region (arg) + (interactive "p") + (if (eq evil-visual-selection 'char) + (er/expand-region arg) + (evil-visual-char (mark) (point) 'inclusive "-- VISUAL --"))) + + (define-key evil-visual-state-map (kbd "v") #'evil-visual-char-or-expand-region) ;; indent pasted regions in evil (defun nadvice/evil-paste-indent (old-fun &rest args) From f6c2186576062b1ee4b2ee6c02305de984f6a07b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 6 Oct 2020 22:33:01 -0700 Subject: [PATCH 146/303] Remove cua-mode --- modules/config-paste.el | 201 +++------------------------------------- 1 file changed, 12 insertions(+), 189 deletions(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index ec9c6aaa..fe666d6d 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -104,68 +104,17 @@ move the yanking point; just return the Nth kill forward." (smartparens-mode -1)))) (use-package whole-line-or-region - :commands (whole-line-or-region-call-with-region - whole-line-or-region-call-with-prefix)) - -(use-package cua-base - :ensure nil :init - (setq kill-do-not-save-duplicates t - cua-paste-pop-rotate-temporarily t - cua-enable-cua-keys t - cua-virtual-rectangle-edges t - cua-auto-tabify-rectangles nil - cua-rectangle-mark-key (kbd "C-x SPC")) - (cua-mode +1) - :config - (evil-define-key 'normal cua-global-keymap (kbd "C-v") nil)) - -;; cua-cut the line if no region -(advice-add - 'cua-cut-region :around - (my/defun-as-value nadvice/cua-cut-region (old-fun &optional prefix) - (interactive "*p") - (whole-line-or-region-wrap-region-kill - (lambda (_beg _end &optional _region) - (interactive (list (mark) (point) 'region)) - (funcall old-fun current-prefix-arg)) - 0))) - -;; cua-yank a line if cut as a line -(advice-add - 'cua-paste :around - (my/defun-as-value nadvice/cua-paste (old-fun raw-prefix) - ;; figure out what yank would do normally - (let ((string-to-yank (current-kill - (cond ((listp raw-prefix) 0) - ((eq raw-prefix '-) -1) - (t (1- raw-prefix))) t)) - (saved-column (current-column))) - - ;; check for whole-line prop in yanked text - (if (get-text-property 0 'whole-line-or-region string-to-yank) - (save-excursion - (end-of-line) - (insert "\n") - (let ((beg (line-beginning-position))) - (insert (string-remove-suffix "\n" string-to-yank)) - (remove-text-properties beg (1+ beg) '(whole-line-or-region nil)))) - - ;; no whole-line-or-region mark - (if (eq (car (get-text-property 0 'yank-handler - string-to-yank)) - 'evil-yank-line-handler) - (evil-paste-after raw-prefix) - (funcall old-fun raw-prefix)))))) - -(defun easy-kill-on-my-line (_n) - "Get current line, but mark as a whole line for whole-line-or-region" - (let ((str (thing-at-point 'line))) - (save-excursion - (put-text-property 0 1 'whole-line-or-region t str) - (easy-kill-adjust-candidate 'my-line str)))) + (define-key evil-emacs-state-map (kbd "C-w") nil) + (define-key evil-insert-state-map (kbd "C-w") nil) + (global-set-key (kbd " ") + #'whole-line-or-region-kill-region)) (use-package easy-kill + :init + (global-set-key (kbd " ") + #'easy-kill) + :config (setq easy-kill-try-things '(url email my-line))) @@ -288,17 +237,6 @@ move the yanking point; just return the Nth kill forward." (with-demoted-errors "Load error: %s" (require 'evil))) - (define-key evil-insert-state-map (kbd "C-x SPC") #'cua-set-rectangle-mark) - (define-key evil-emacs-state-map (kbd "C-x SPC") #'cua-set-rectangle-mark) - (define-key evil-insert-state-map (kbd "C-v") #'cua-paste) - - (put 'evil-forward-char 'CUA 'move) - (put 'evil-backward-char 'CUA 'move) - (put 'evil-next-visual-line 'CUA 'move) - (put 'evil-previous-visual-line 'CUA 'move) - (put 'evil-end-of-visual-line 'CUA 'move) - (put 'evil-beginning-of-visual-line 'CUA 'move) - ;; make evil respect whole-line-or-region (defun nadvice/evil-paste-line (&rest _args) (when (with-demoted-errors "Failed to check text properties for paste. %s" @@ -309,64 +247,8 @@ move the yanking point; just return the Nth kill forward." (advice-add 'evil-paste-before :before #'nadvice/evil-paste-line) (advice-add 'evil-paste-after :before #'nadvice/evil-paste-line) - - ;; unify evil-paste with cua rectangles - (advice-add - 'evil-paste-after :around - (my/defun-as-value nadvice/evil-paste-after (old-fun &rest args) - (if (eq (with-demoted-errors "Failed to check text properties for paste. %s" - (car (get-text-property 0 'yank-handler (car kill-ring)))) - 'rectangle--insert-for-yank) - (evil-with-state 'normal - (call-interactively #'evil-append) - (call-interactively #'cua-paste)) - (apply old-fun args)))) - - (advice-add - 'evil-paste-before :around - (my/defun-as-value nadvice/evil-paste-before (old-fun &rest args) - (if (eq (with-demoted-errors "Failed to check text properties for paste. %s" - (car (get-text-property 0 'yank-handler (car kill-ring)))) - 'rectangle--insert-for-yank) - (evil-with-state 'normal - (call-interactively #'evil-insert) - (call-interactively #'cua-paste)) - (apply old-fun args)))) - - (define-key evil-insert-state-map (kbd "C-w") nil) - - - (define-key evil-insert-state-map - (kbd " ") #'easy-kill) - (define-key evil-emacs-state-map - (kbd " ") #'easy-kill) - (define-key evil-normal-state-map - (kbd " ") #'easy-kill) - - (define-key evil-emacs-state-map - (kbd " ") #'cua-cut-region) - (define-key evil-insert-state-map - (kbd " ") #'cua-cut-region) - - (define-key evil-emacs-state-map - (kbd " ") #'cua-paste-pop) - (define-key evil-insert-state-map - (kbd " ") #'cua-paste-pop) - - (define-key evil-emacs-state-map (kbd "C-y") #'cua-paste) - (define-key evil-insert-state-map (kbd "C-y") #'cua-paste) - - ;; ensure cua-mode doesn't interfere with evil visual state - (let ((my/cua-mode-was-on)) - (add-hook 'evil-visual-state-entry-hook - (my/defun-as-value my/entering-visual-state-disable-cua () - (setq my/cua-mode-was-on cua-mode) - (when cua-mode - (cua-mode -1)))) - (add-hook 'evil-visual-state-exit-hook - (my/defun-as-value my/leaving-visual-state-enable-cua () - (when my/cua-mode-was-on - (cua-mode +1)))))) + (define-key evil-emacs-state-map (kbd "C-y") nil) + (define-key evil-insert-state-map (kbd "C-y") nil)) (use-package legalese :defer-install t @@ -376,66 +258,7 @@ move the yanking point; just return the Nth kill forward." "A quick command to drop clipboard formatting" (interactive) (with-temp-buffer - (cua-paste nil) - (push-mark (point)) - (push-mark (point-max) nil t) - (goto-char (point-min)) - (cua-cut-region nil))) - -(el-patch-evil-define-command evil-visual-paste (count &optional register) - "Paste over Visual selection." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count)) - ;; evil-visual-paste is typically called from evil-paste-before or - ;; evil-paste-after, but we have to mark that the paste was from - ;; visual state - (setq this-command 'evil-visual-paste) - (el-patch-let (($paste (if paste-eob - (evil-paste-after count register) - (evil-paste-before count register)))) - (let* ((text (if register - (evil-get-register register) - (current-kill 0))) - (yank-handler (car-safe (get-text-property - 0 'yank-handler text))) - new-kill - paste-eob) - (evil-with-undo - (let* (el-patch-swap - ((kill-ring (list (current-kill 0))) - (kill-ring-yank-pointer kill-ring)) - ((kill-ring kill-ring) - (kill-ring-yank-pointer kill-ring-yank-pointer) - (kill-ring-yank-index kill-ring-yank-index))) - (when (evil-visual-state-p) - (evil-visual-rotate 'upper-left) - ;; if we replace the last buffer line that does not end in a - ;; newline, we use `evil-paste-after' because `evil-delete' - ;; will move point to the line above - (when (and (= evil-visual-end (point-max)) - (/= (char-before (point-max)) ?\n)) - (setq paste-eob t)) - (evil-delete evil-visual-beginning evil-visual-end - (evil-visual-type)) - (when (and (eq yank-handler #'evil-yank-line-handler) - (not (eq (evil-visual-type) 'line)) - (not (= evil-visual-end (point-max)))) - (insert "\n")) - (evil-normal-state) - (setq new-kill (current-kill 0)) - (current-kill 1)) - (el-patch-remove $paste)) - (el-patch-add $paste) - (when evil-kill-on-visual-paste - (kill-new new-kill)) - ;; mark the last paste as visual-paste - (setq evil-last-paste - (list (nth 0 evil-last-paste) - (nth 1 evil-last-paste) - (nth 2 evil-last-paste) - (nth 3 evil-last-paste) - (nth 4 evil-last-paste) - t)))))) + (yank nil) + (kill-region (point-min) (point-max)))) (provide 'config-paste) From e2538f78c2fa1e55fb981f0860c0a2a78a4d5a79 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 6 Oct 2020 22:33:27 -0700 Subject: [PATCH 147/303] Add "Kolmogorov" to dictionary --- data/user-dict.en.pws | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index 20768d6c..ec7495ab 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,6 +1,7 @@ -personal_ws-1.1 en 39 +personal_ws-1.1 en 41 Gaussians Hayase +Kolmogorov Lipschitz Reidemeister biconditional @@ -10,9 +11,11 @@ colorable colorings conjugacy contrapositive +cosets durations equisatisfiable factorizations +incompressible indeterminates inequivalent infimum @@ -20,11 +23,9 @@ injective integrable integrands irreducibles -cosets -durations -inequivalent -infimum -integrable +lexicographically +monomial +monomials nondecreasing nonincreasing nontrivially @@ -37,4 +38,5 @@ subrings superset surjection surjective +unary unknotted From 9faa4f5ad9423c806fa0233b361e71d4ddc95de8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 6 Oct 2020 22:44:17 -0700 Subject: [PATCH 148/303] Remove polymode --- modules/config-modes.el | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index e7e4fe56..a48b7bf4 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1331,44 +1331,6 @@ Returns the symbol." :commands (R R-mode S) :mode (("\\.R$" . R-mode))) -;; ============================================================================= -;; Polymodes =================================================================== -;; ============================================================================= - -(use-package polymode - :defer-install t - :mode (("\\.Snw$" . poly-noweb+r-mode) - ("\\.Rnw$" . poly-noweb+r-mode) - ("\\.Rmd$" . poly-markdown+r-mode) - ("\\.rapport$" . poly-rapport-mode) - ("\\.Rhtml$" . poly-html+r-mode) - ("\\.Rbrew$" . poly-brew+r-mode) - ("\\.Rcpp$" . poly-r+c++-mode) - ("\\.cppR$" . poly-c++r-mode) - ("\\.js.erb$" . poly-javascript+erb-mode) - ("\\.coffee.erb$" . poly-coffee+erb-mode) - ("\\.html.erb$" . poly-html+erb-mode) - ("\\.slim$" . poly-slim-mode)) - - :commands (poly-markdown-mode - poly-noweb+r-mode - poly-noweb+r-mode - poly-markdown+r-mode - poly-rapport-mode - poly-html+r-mode - poly-brew+r-mode - poly-r+c++-mode - poly-c++r-mode - poly-javascript+erb-mode - poly-coffee+erb-mode - poly-html+erb-mode - poly-slim-mode) - :config - (require 'poly-R) - (require 'poly-erb) - (require 'poly-markdown) - (require 'poly-noweb) - (require 'poly-slim)) ;; ============================================================================= ;; help-mode =================================================================== From 2d04942b9e6e34071b198539709ab56252e9e95f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 6 Oct 2020 22:49:20 -0700 Subject: [PATCH 149/303] Remove major mode packages that I don't plan to use --- modules/config-modes.el | 59 ----------------------------------------- 1 file changed, 59 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index a48b7bf4..ba5b6619 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -594,18 +594,6 @@ Returns the symbol." ("\\.cson\\'" . coffee-mode)) :interpreter ("coffee" . coffee-mode)) -(use-package literate-coffee-mode - :defer-install t - :commands (litcoffee-mode) - :mode (("\\.litcoffee\\'" . litcoffee-mode) - ("\\.coffee.md\\'" . litcoffee-mode))) - -(use-package livescript-mode - :defer-install t - :commands (livescript-mode) - :mode (("\\.ls\\'" . livescript-mode) - ("Slakefile\\'" . livescript-mode))) - (use-package php-mode :defer-install t :commands (php-mode) @@ -1198,11 +1186,6 @@ Returns the symbol." ;; Qt qmake project files (add-to-list 'auto-mode-alist '("\\.pro\\'" . makefile-mode)) -(use-package hgignore-mode - :defer-install t - :commands (hgignore-mode) - :mode (("\\.hgignore\\'" . hgignore-mode))) - (use-package nginx-mode :defer-install t :commands (nginx-mode) @@ -1364,11 +1347,6 @@ Returns the symbol." ("\\.cljs\\'" . clojurescript-mode) ("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode))) -(use-package d-mode - :defer-install t - :commands (d-mode) - :mode ("\\.d[i]?\\'" . d-mode)) - (use-package go-mode :defer-install t :commands (go-mode @@ -1453,16 +1431,6 @@ Returns the symbol." scala-mode) :mode ("\\.\\(scala\\|sbt\\)\\'" . scala-mode)) -(use-package vala-mode - :defer-install t - :commands (vala-mode) - :mode ("\\.vala$" . vala-mode)) - -(use-package fsharp-mode - :defer-install t - :commands (fsharp-mode) - :mode ("\\.fs[iylx]?$" . fsharp-mode)) - (use-package gnuplot :defer-install t :commands (gnuplot-mode @@ -1476,11 +1444,6 @@ Returns the symbol." processing-mode) :mode ("\\.pde$" . processing-mode)) -(use-package actionscript-mode - :defer-install t - :commands (actionscript-mode) - :mode ("\\.as\\'" . actionscript-mode)) - (use-package puppet-mode :defer-install t :commands (puppet-mode @@ -1509,28 +1472,6 @@ Returns the symbol." (add-to-list 'completion-ignored-extensions ".cm/") (add-to-list 'completion-ignored-extensions "CM/")) -(use-package ahk-mode - :defer-install t - :commands (ahk-mode) - :mode (("\\.ahk\\'" . ahk-mode))) - -(use-package floobits - :defer-install t - :commands (floobits-debug - floobits-summon - floobits-follow-mode-toggle - floobits-follow-user - floobits-leave-workspace - floobits-complete-signup - floobits-share-dir-public - floobits-share-dir-private - floobits-join-workspace - floobits-workspace-settings - floobits-remove-from-workspace - floobits-open-workspace-in-browser - floobits-clear-highlights - floobits-add-to-workspace)) - (use-package llvm-mode :recipe (llvm-mode :host github :repo "llvm-mirror/llvm" From 8ecbafd2d30dbdb9d0c35e982fb1a46afedde8dc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 7 Oct 2020 17:55:31 -0700 Subject: [PATCH 150/303] Add basic pylance LSP configuration --- modules/config-python.el | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/modules/config-python.el b/modules/config-python.el index 462bed77..c904b5e3 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -116,6 +116,52 @@ Return either a string or nil." (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) + (require 'lsp) + (lsp-register-custom-settings + `(("python.analysis.typeCheckingMode" "basic") + ("python.analysis.diagnosticMode" "openFilesOnly") + ("python.analysis.stubPath" "./typings") + ("python.analysis.autoSearchPaths" t t) + ("python.analysis.extraPaths" nil) + ("python.analysis.diagnosticSeverityOverrides" nil) + ("python.analysis.useLibraryCodeForTypes" t t) + ("python.analysis.autoImportCompletions" t t) + ("python.analysis.completeFunctionParens" nil t) + ("python.pythonPath" (lambda () + (when-let ((venv (my/python-find-virtualenv-cached)) + (python-path (expand-file-name + "bin/python" + venv)) + (is-executable (file-executable-p python-path))) + (my/tramp-localname python-path)))))) + + (lsp-register-client + (make-lsp-client + :new-connection (lsp-stdio-connection + (executable-find "pylance-language-server")) + :major-modes '(python-mode) + :multi-root t + :server-id 'pylance + :priority 3 + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (make-hash-table :test 'equal)))))) + + (lsp-register-client + (make-lsp-client + :new-connection (lsp-tramp-connection + (executable-find "pylance-language-server" t)) + :major-modes '(python-mode) + :multi-root t + :remote? t + :server-id 'pylance-remote + :priority -1 + :initialized-fn + (lambda (workspace) + (with-lsp-workspace workspace + (lsp--set-configuration (make-hash-table :test 'equal)))))) + ;; Use the Microsoft python ls if we can (use-package lsp-python-ms :init From 35b7c4d3dfb121728d0473c09f77ecbd27395cd2 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Oct 2020 23:51:49 -0700 Subject: [PATCH 151/303] Automatically enable lsp for local C/C++ files --- modules/config-c.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/config-c.el b/modules/config-c.el index 9df81e18..03a35b3a 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -16,6 +16,10 @@ (c++-mode)))) (add-to-list 'auto-mode-alist '("\\.h\\'" . c-or-c++-header)) +(add-hook 'c-mode-hook + (my/defun-as-value my/c-mode-maybe-lsp (&rest _) + (unless (file-remote-p buffer-file-name) + (lsp-deferred)))) (use-package cc-mode :ensure nil @@ -74,9 +78,7 @@ `(add-hook ,hook (lambda () (when (eq major-mode ,mode) (eldoc-mode +1) - (aggressive-indent-mode +1) - (helm-gtags-mode +1) - (semantic-idle-summary-mode -1)))))) + (aggressive-indent-mode +1)))))) (with-no-warnings (my/generate-calls From 61147a86ac14a05ed43a0042a238f71c7b3abac6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Oct 2020 23:52:13 -0700 Subject: [PATCH 152/303] Stop trying to use company-eclim --- modules/config-company.el | 1 - modules/config-python.el | 2 +- modules/config-tramp.el | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index 6233dc0e..6d1601c7 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -34,7 +34,6 @@ '(('arduino-mode-hook '(company-irony)) ('cmake-mode-hook '(company-cmake)) ('css-mode-hook '(company-css)) - ('java-mode-hook '(company-eclim)) ('java-mode-hook '(company-lsp)) ('nxml-mode-hook '(company-nxml)) ('html-mode-hook '(company-web-html)) diff --git a/modules/config-python.el b/modules/config-python.el index c904b5e3..32f87fe9 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -167,7 +167,7 @@ Return either a string or nil." :init (require 'lsp-python-ms) (add-hook 'python-mode-hook - (my/defun-as-value my/maybe-lsp (&rest _) + (my/defun-as-value my/python-mode-maybe-lsp (&rest _) (unless (file-remote-p buffer-file-name) (lsp-deferred)))) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index a0f1bab2..960e1fb0 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -203,7 +203,7 @@ (defun tramp-switch-method (method &optional file-name) (interactive (list - (completing-read "Choose algorithm: " + (completing-read "Choose method: " (mapcar #'car tramp-methods)))) (find-alternate-file (with-parsed-tramp-file-name (or file-name buffer-file-name) parsed From 460c59dc728be16a3f2cc34fb72a29cf8034292e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 15:37:33 -0700 Subject: [PATCH 153/303] Separate undo-tree from evil-mode --- modules/config-evil.el | 3 +++ modules/config-package.el | 1 + modules/config-undo.el | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/config-evil.el b/modules/config-evil.el index 6c7a8475..3470d8d3 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -27,6 +27,9 @@ :config (setq evil-auto-indent t evil-ex-complete-emacs-commands t + evil-undo-system 'undo-tree + evil-undo-function 'undo-tree-undo + evil-redo-function 'undo-tree-redo evil-magic 'very-magic evil-search-module 'evil-search evil-shift-width 2 diff --git a/modules/config-package.el b/modules/config-package.el index aa9ed52f..72076bc4 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -167,6 +167,7 @@ (idle-job-add-require 'yasnippet) (idle-job-add-require 'company) +(idle-job-add-require 'undo-tree) (idle-job-add-require 'multiple-cursors) (idle-job-add-require 'mc-hide-unmatched-lines-mode) diff --git a/modules/config-undo.el b/modules/config-undo.el index c2503bd9..7c9e9176 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -1,7 +1,15 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros)) -(with-eval-after-load 'undo-tree +(use-package undo-tree + :init + (my/onetime-setup undo-tree + :hook 'first-change-hook + :after-hook 'emacs-startup-hook + :condition (get-buffer-window) + (global-undo-tree-mode +1)) + + :config (eval-when-compile (require 'undo-tree) (require 'evil)) From 11fbe1230efdc6ff87fdcf8d944686087777d5f5 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 18:33:46 -0700 Subject: [PATCH 154/303] Update savehist patches for Emacs 27.1 --- modules/config-desktop.el | 60 +++++++++++++++------------------------ modules/config-python.el | 3 +- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index f08af6a8..0db442af 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -56,24 +56,19 @@ already exists in the home directory." (el-patch-defcustom savehist-file (el-patch-swap (locate-user-emacs-file "history" ".emacs-history") (locate-user-emacs-file "data/savehist")) + "File name where minibuffer history is saved to and loaded from. The minibuffer history is a series of Lisp expressions loaded automatically when Savehist mode is turned on. See `savehist-mode' -for more details. - -If you want your minibuffer history shared between Emacs and XEmacs, -customize this value and make sure that `savehist-coding-system' is -set to a coding system that exists in both emacsen." - :type 'file - :group 'savehist) +for more details." + :type 'file) (el-patch-defcustom savehist-autosave-interval (* (el-patch-swap 5 2) 60) "The interval between autosaves of minibuffer history. If set to nil, disables timer-based autosaving." :type '(choice (const :tag "Disabled" nil) - (integer :tag "Seconds")) - :group 'savehist) + (integer :tag "Seconds"))) (el-patch-defcustom savehist-additional-variables (el-patch-swap () @@ -93,9 +88,7 @@ non-nil. User options should be saved with the Customize interface. This list is useful for saving automatically updated variables that are not minibuffer histories, such as `compile-command' or `kill-ring'." - :type '(repeat variable) - :group 'savehist) - + :type '(repeat variable)) (el-patch-defvar savehist-timer nil) (el-patch-defvar savehist-loaded nil @@ -108,26 +101,19 @@ minibuffer history.") Normally invoked by calling `savehist-mode' to set the minor mode. Installs `savehist-autosave' in `kill-emacs-hook' and on a timer. To undo this, call `savehist-uninstall'." - (add-hook 'minibuffer-setup-hook 'savehist-minibuffer-hook) - (add-hook 'kill-emacs-hook 'savehist-autosave) + (add-hook 'minibuffer-setup-hook #'savehist-minibuffer-hook) + (add-hook 'kill-emacs-hook #'savehist-autosave) ;; Install an invocation of savehist-autosave on a timer. This ;; should not cause noticeable delays for users -- savehist-autosave ;; executes in under 5 ms on my system. (when (and savehist-autosave-interval (null savehist-timer)) (setq savehist-timer - (if (featurep 'xemacs) - (start-itimer - "savehist" 'savehist-autosave savehist-autosave-interval - savehist-autosave-interval) - (run-with-timer savehist-autosave-interval - savehist-autosave-interval 'savehist-autosave))))) + (run-with-timer savehist-autosave-interval + savehist-autosave-interval #'savehist-autosave)))) (el-patch-define-minor-mode savehist-mode "Toggle saving of minibuffer history (Savehist mode). -With a prefix argument ARG, enable Savehist mode if ARG is -positive, and disable it otherwise. If called from Lisp, -also enable the mode if ARG is omitted or nil. When Savehist mode is enabled, minibuffer history is saved to `savehist-file' periodically and when exiting Emacs. When @@ -158,21 +144,21 @@ histories, which is probably undesirable." (if (not savehist-mode) (savehist-uninstall) (when (and (not savehist-loaded) - (file-exists-p savehist-file)) + (file-exists-p savehist-file)) (condition-case errvar - (progn - ;; Don't set coding-system-for-read -- we rely on the - ;; coding cookie to convey that information. That way, if - ;; the user changes the value of savehist-coding-system, - ;; we can still correctly load the old file. - (load savehist-file nil (not (called-interactively-p 'interactive))) - (setq savehist-loaded t)) - (error - ;; Don't install the mode if reading failed. Doing so would - ;; effectively destroy the user's data at the next save. - (setq savehist-mode nil) - (savehist-uninstall) - (signal (car errvar) (cdr errvar))))) + (progn + ;; Don't set coding-system-for-read -- we rely on the + ;; coding cookie to convey that information. That way, if + ;; the user changes the value of savehist-coding-system, + ;; we can still correctly load the old file. + (load savehist-file nil (not (called-interactively-p 'interactive))) + (setq savehist-loaded t)) + (error + ;; Don't install the mode if reading failed. Doing so would + ;; effectively destroy the user's data at the next save. + (setq savehist-mode nil) + (savehist-uninstall) + (signal (car errvar) (cdr errvar))))) (savehist-install))) (savehist-mode +1) diff --git a/modules/config-python.el b/modules/config-python.el index 32f87fe9..0273fb08 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -43,7 +43,8 @@ Return either a string or nil." (substring-no-properties universal-path)))) (defvar my/python-virtualenv-cache nil) -(add-to-list 'savehist-additional-variables 'my/python-virtualenv-cache) +(with-eval-after-load 'savehist + (add-to-list 'savehist-additional-variables 'my/python-virtualenv-cache)) (defun my/python-find-virtualenv-cached (&optional dir) (let* ((dir (or dir default-directory)) (pyproject (locate-dominating-file dir "pyproject.toml"))) From 3f0e9b74fea9a0e539c83fdf23987c68a15e7782 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:39:10 -0700 Subject: [PATCH 155/303] Update read-passwd patch for Emacs 27.1 --- modules/config-intel.el | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 742ffd49..507f259e 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -12,7 +12,7 @@ If optional CONFIRM is non-nil, read the password twice to make sure. Optional DEFAULT is a default password to use instead of empty input. -This function echoes `.' for each character that the user types. +This function echoes `*' for each character that the user types. You could let-bind `read-hide-char' to another hiding character, though. Once the caller uses the password, it can erase the password @@ -32,24 +32,19 @@ by doing (clear-string STRING)." (sit-for 1)))) success) ((el-patch-swap let let*) - ((el-patch-add ol) - (hide-chars-fun - (lambda (beg end _len) - (clear-this-command-keys) - (setq beg (min end (max (minibuffer-prompt-end) - beg))) - (el-patch-add + (minibuf + (el-patch-add + (ol) + (hide-chars-fun + (lambda (&rest args) + (apply #'read-password--hide-password args) (move-overlay ol (point-max) (point-max)) (let ((len (- (point-max) (minibuffer-prompt-end))) (hash (md5 (minibuffer-contents-no-properties)))) (overlay-put ol 'after-string (if (and (> len 10) read-passwd-show-hash-mode) (format " [%d chars, #%s]" - len (substring hash 0 4)))))) - (dotimes (i (- end beg)) - (put-text-property (+ i beg) (+ 1 i beg) - 'display (string (or read-hide-char ?.)))))) - minibuf) + len (substring hash 0 4))))))))) (minibuffer-with-setup-hook (lambda () (setq minibuf (current-buffer)) @@ -61,17 +56,24 @@ by doing (clear-string STRING)." (setq-local inhibit-modification-hooks nil) ;bug#15501. (setq-local show-paren-mode nil) ;bug#16091. (el-patch-add (setq ol (make-overlay (point-max) (point-max) nil t t))) - (add-hook 'after-change-functions hide-chars-fun nil 'local)) + (add-hook 'post-command-hook + (el-patch-swap 'read-password--hide-password + hide-chars-fun) + nil t)) (unwind-protect (let ((enable-recursive-minibuffers t) - (read-hide-char (or read-hide-char ?.))) + (read-hide-char (or read-hide-char ?*))) (read-string prompt nil t default)) ; t = "no history" (when (buffer-live-p minibuf) (with-current-buffer minibuf ;; Not sure why but it seems that there might be cases where the ;; minibuffer is not always properly reset later on, so undo ;; whatever we've done here (bug#11392). - (remove-hook 'after-change-functions hide-chars-fun 'local) + (remove-hook (el-patch-swap 'after-change-functions + 'post-command-hook) + (el-patch-swap 'read-password--hide-password + hide-chars-fun) + 'local) (kill-local-variable 'post-self-insert-hook) ;; And of course, don't keep the sensitive data around. (erase-buffer)))))))) From 98da643360b80ea018d08cd34d2f38de3043c437 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:40:04 -0700 Subject: [PATCH 156/303] Update current-kill patch for Emacs 27.1 --- modules/config-paste.el | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index fe666d6d..13394c54 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -31,19 +31,23 @@ If optional arg DO-NOT-MOVE is non-nil, then don't actually move the yanking point; just return the Nth kill forward." (el-patch-add (require 'dash)) (let ((interprogram-paste (and (= n 0) - interprogram-paste-function - (funcall interprogram-paste-function)))) + interprogram-paste-function + (funcall interprogram-paste-function)))) (if interprogram-paste - (progn - ;; Disable the interprogram cut function when we add the new - ;; text to the kill ring, so Emacs doesn't try to own the - ;; selection, with identical text. - (let ((interprogram-cut-function nil)) - (if (listp interprogram-paste) - (mapc 'kill-new (nreverse interprogram-paste)) - (kill-new interprogram-paste))) + (progn + ;; Disable the interprogram cut function when we add the new + ;; text to the kill ring, so Emacs doesn't try to own the + ;; selection, with identical text. + ;; Also disable the interprogram paste function, so that + ;; `kill-new' doesn't call it repeatedly. + (let ((interprogram-cut-function nil) + (interprogram-paste-function nil)) + (if (listp interprogram-paste) + ;; Use `reverse' to avoid modifying external data. + (mapc #'kill-new (reverse interprogram-paste)) + (kill-new interprogram-paste))) (el-patch-add (setq kill-ring-yank-index 0)) - (car kill-ring)) + (car kill-ring)) (or kill-ring (error "Kill ring is empty")) (el-patch-add ;; Put the head of kill-ring back where we had @@ -66,18 +70,18 @@ move the yanking point; just return the Nth kill forward." (cons new (-remove-at kill-ring-yank-index kill-ring)))))) (let ((ARGth-kill-element - (el-patch-swap + (el-patch-swap (nthcdr (mod (- n (length kill-ring-yank-pointer)) (length kill-ring)) kill-ring) kill-ring))) - (unless do-not-move - (setq kill-ring-yank-pointer ARGth-kill-element) - (when (and yank-pop-change-selection - (> n 0) - interprogram-cut-function) - (funcall interprogram-cut-function (car ARGth-kill-element)))) - (car ARGth-kill-element))))) + (unless do-not-move + (setq kill-ring-yank-pointer ARGth-kill-element) + (when (and yank-pop-change-selection + (> n 0) + interprogram-cut-function) + (funcall interprogram-cut-function (car ARGth-kill-element)))) + (car ARGth-kill-element))))) (use-package xclip :config From 0657523218d0691a877b4fa1d99f4907bf8f37dd Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:40:33 -0700 Subject: [PATCH 157/303] Update adaptive-wrap patches for Emacs 27.1 --- modules/config-whitespace.el | 56 +++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index def589d0..c718f782 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -46,6 +46,41 @@ extra indent = 2 (make-variable-buffer-local 'adaptive-wrap-extra-indent) + (el-patch-defun adaptive-wrap--face-extends (face) + (if (fboundp 'face-extend-p) + (face-extend-p face nil t) + ;; Before Emacs 27, faces always extended beyond EOL. Check for a + ;; non-default background. + (face-background face nil t))) + + (el-patch-defun adaptive-wrap--prefix-face (fcp beg end) + (cond ((get-text-property 0 'face fcp)) + ;; If the last character is a newline and has a face that + ;; extends beyond EOL, assume that this face spans the whole + ;; line and apply it to the prefix to preserve the "block" + ;; visual effect. + ;; NB: the face might not actually span the whole line: see for + ;; example removed lines in diff-mode, where the first character + ;; has the diff-indicator-removed face, while the rest of the + ;; line has the diff-removed face. + ((= (char-before end) ?\n) + (let ((eol-face (get-text-property (1- end) 'face))) + (and eol-face (adaptive-wrap--face-extends eol-face) eol-face))))) + + (el-patch-defun adaptive-wrap--prefix (fcp) + (let ((fcp-len (string-width fcp))) + (cond + ((= 0 adaptive-wrap-extra-indent) + fcp) + ((< 0 adaptive-wrap-extra-indent) + (concat fcp (make-string adaptive-wrap-extra-indent ?\s))) + ((< 0 (+ adaptive-wrap-extra-indent fcp-len)) + (substring fcp + 0 + (+ adaptive-wrap-extra-indent fcp-len))) + (t + "")))) + (el-patch-defun adaptive-wrap-fill-context-prefix (beg end) "Like `fill-context-prefix', but with length adjusted by `adaptive-wrap-extra-indent'." (let* ((fcp @@ -60,22 +95,11 @@ extra indent = 2 ;; Note: fill-context-prefix may return nil; See: ;; http://article.gmane.org/gmane.emacs.devel/156285 "")) - (fcp-len (string-width fcp)) - (fill-char (if (< 0 fcp-len) - (string-to-char (substring fcp -1)) - ?\ ))) - (cond - ((= 0 adaptive-wrap-extra-indent) - fcp) - ((< 0 adaptive-wrap-extra-indent) - (concat fcp - (make-string adaptive-wrap-extra-indent fill-char))) - ((< 0 (+ adaptive-wrap-extra-indent fcp-len)) - (substring fcp - 0 - (+ adaptive-wrap-extra-indent fcp-len))) - (t - "")))) + (prefix (adaptive-wrap--prefix fcp)) + (face (adaptive-wrap--prefix-face fcp beg end))) + (if face + (propertize prefix 'face face) + prefix))) (el-patch-defun adaptive-wrap-prefix-function (beg end) "Indent the region between BEG and END with adaptive filling." From 979b944bac38fae25ee0844b2fca19610fd85486 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:40:56 -0700 Subject: [PATCH 158/303] Update split-window-sensibly patch for Emacs 27.1 --- modules/config-ui.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index 8b381f4a..45dd86a5 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -485,7 +485,7 @@ split." (unless (or (eq w window) (window-dedicated-p w)) (throw 'done nil))) - frame) + frame nil 'nomini) t))) (not (window-minibuffer-p window)) (let ((split-height-threshold 0)) From ae8d46fb0f4c50650380f302bb7280fce38d4955 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:49:38 -0700 Subject: [PATCH 159/303] Update smerge-mode patch for Emacs 27.1 --- modules/config-vcs.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index dc7641dd..201385fd 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -308,9 +308,7 @@ Point is moved to the end of the conflict." (el-patch-define-minor-mode smerge-mode "Minor mode to simplify editing output from the diff3 program. -With a prefix argument ARG, enable the mode if ARG is positive, -and disable it otherwise. If called from Lisp, enable the mode -if ARG is omitted or nil. + \\{smerge-mode-map}" :group 'smerge :lighter (el-patch-swap " SMerge" nil) (when (and (boundp 'font-lock-mode) font-lock-mode) @@ -332,7 +330,6 @@ if ARG is omitted or nil. (unless smerge-mode (smerge-remove-props (point-min) (point-max)))) - (add-hook 'find-file-hook #'smerge-mode) :config From 745b330bb40964fd4f508155855201db1823263b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Oct 2020 19:50:05 -0700 Subject: [PATCH 160/303] Don't error if config-desktop is loaded w/o evil --- modules/config-desktop.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 0db442af..43efcebf 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -524,9 +524,10 @@ Write data into the file specified by `recentf-save-file'." (idle-job-add-function #'atomic-chrome-start-server 'append)) :config - ;; This makes sense because the browser is in "insert" state, so - ;; this keeps things consistent. - (evil-set-initial-state 'atomic-chrome-edit-mode 'insert) + (with-eval-after-load 'evil + ;; This makes sense because the browser is in "insert" state, so + ;; this keeps things consistent. + (evil-set-initial-state 'atomic-chrome-edit-mode 'insert)) ;; At some point, this should go somewhere more general (defun my/get-active-window-id () From b55208d34356b31f3145bace13dac6b0269f9d87 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 16 Oct 2020 12:18:55 -0700 Subject: [PATCH 161/303] Disable aggressive-indent in c-mode --- modules/config-c.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/config-c.el b/modules/config-c.el index 03a35b3a..deeef5f5 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -77,8 +77,7 @@ (mode hook) `(add-hook ,hook (lambda () (when (eq major-mode ,mode) - (eldoc-mode +1) - (aggressive-indent-mode +1)))))) + (eldoc-mode +1)))))) (with-no-warnings (my/generate-calls From ad70b377b93ba44fdebdb13df9f6b8f6f85f3b04 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 16 Oct 2020 12:40:30 -0700 Subject: [PATCH 162/303] Add smarter lazy-loading of undo-tree --- modules/config-undo.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/config-undo.el b/modules/config-undo.el index 7c9e9176..8c072ed4 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -3,11 +3,14 @@ (use-package undo-tree :init - (my/onetime-setup undo-tree - :hook 'first-change-hook - :after-hook 'emacs-startup-hook - :condition (get-buffer-window) - (global-undo-tree-mode +1)) + (autoload 'undo-tree-undo "undo-tree") + (autoload 'undo-tree-redo "undo-tree") + + (defalias 'redo #'undo-tree-redo) + (defalias 'undo #'undo-tree-undo) + + (with-eval-after-load 'evil + (advice-add 'evil--check-undo-system :override #'ignore)) :config (eval-when-compile @@ -27,8 +30,7 @@ `((,(rx (zero-or-more anything)) . ,(expand-file-name (locate-user-emacs-file "data/undo-backups/"))))) - (defalias 'redo #'undo-tree-redo) - (defalias 'undo #'undo-tree-undo) + (global-undo-tree-mode +1) ;; keep undo-tree from overriding C-x r (define-key undo-tree-map (kbd "C-x r u") nil) @@ -50,7 +52,8 @@ (setq-local global-hl-line-mode nil) (visual-line-mode -1))) - (evil-set-initial-state 'undo-tree-visualizer-mode 'emacs) + (with-eval-after-load 'evil + (evil-set-initial-state 'undo-tree-visualizer-mode 'emacs)) (define-key undo-tree-visualizer-mode-map (kbd "C-g") #'undo-tree-visualizer-quit) From 4ec77c2739dad90248ca09383d313d9efb563a5a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 17 Oct 2020 17:31:36 -0700 Subject: [PATCH 163/303] Remove vestigial comment about undo-in-region being unstable --- modules/config-undo.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/config-undo.el b/modules/config-undo.el index 8c072ed4..d7927f80 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -21,10 +21,6 @@ (setq undo-tree-mode-lighter nil undo-tree-auto-save-history t - ;; Explanation from raxod502/radian: Disable undo-in-region. - ;; It sounds like an interesting feature, but unfortunately - ;; the implementation is very buggy and regularly causes you - ;; to lose your undo history. undo-tree-enable-undo-in-region t undo-tree-history-directory-alist `((,(rx (zero-or-more anything)) From 9df492b9792c6d3212cae287703a1816141ffb98 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 17 Oct 2020 13:04:35 -0700 Subject: [PATCH 164/303] Update README --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7c22ab94..82c64dd3 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,21 @@ My personal Emacs config! * [Company](https://github.com/company-mode/company-mode) (code autocomplete) * [Icicles](https://www.emacswiki.org/emacs/Icicles) (minibuffer completion) * [Ivy](https://github.com/abo-abo/swiper) (minibuffer completion) - * Isearch - * Extremely agressive file autoloading, and fast startup times (~1.0s). + * [Isearch](https://github.com/PythonNut/flx-isearch/) + * Extremely aggressive file lazy loading, and fast startup times (~0.3s). * Partly thanks to [`straight.el`](https://github.com/raxod502/straight.el)! + * Packages are incrementally loaded during idle time immediately after init. + By the time you open a file, most major packages will already have been loaded, but you won't notice the delay! * An emphasis on correct code and robustness without the need for explicit configuration. * Config should automatically determine system capabilities and adjust. Portability =========== -This config should be pretty portable, as long as your OS is UNIX-y. -I currently run it on various Arch Linux, Fedora, and Ubuntu builds, as well as Raspberry Pis, Android phones, and Cygwin installations. -Windows should work in theory?? +This config should be pretty portable, as long as your OS is UNIX-y. +I currently run it on various Arch Linux, Fedora, and Ubuntu builds, as well as Raspberry Pis, Android phones, and WSL. -One thing that it does _not_ support is older versions of Emacs. +One thing that it does _not_ support is older versions of Emacs. Right now, the minimum version is 25.1. Supported Languages @@ -41,13 +42,9 @@ Supported Languages I actively work in the following languages: + * Elisp (of course) * LaTeX - * Python/SAGEmath + * Python * C/C++ * JS(X)/HTML/CSS * Octave - * Elisp (duh) - -So expect those languages to be reasonably well supported. -Of course, this config supports other languages as well, but not as deeply. -Drop by my [major mode support table](https://github.com/PythonNut/emacs-config/wiki/Major-Mode-project) to see what major modes this config supports. From 17e1953671f663d84b48c177e251c9bfc76bbc46 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 29 Aug 2020 11:47:45 -0700 Subject: [PATCH 165/303] Make all config files byte-compile individually --- byte-recompile-config.el | 7 +++++++ modules/config-avy-easymotion.el | 9 +++++---- modules/config-c.el | 5 +++-- modules/config-core.el | 23 +++++++++++++++-------- modules/config-evil-modules.el | 4 +++- modules/config-evil-textobjects.el | 3 +++ modules/config-evil.el | 10 ++++++---- modules/config-intel.el | 4 +++- modules/config-modes.el | 5 +++-- modules/config-package.el | 6 ++++++ modules/config-paste.el | 3 ++- modules/config-tex.el | 3 +++ modules/config-undo.el | 6 ------ 13 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 byte-recompile-config.el diff --git a/byte-recompile-config.el b/byte-recompile-config.el new file mode 100644 index 00000000..38eb93e4 --- /dev/null +++ b/byte-recompile-config.el @@ -0,0 +1,7 @@ +(add-to-list 'load-path (locate-user-emacs-file "modules/")) +(setq load-prefer-newer t + gc-cons-threshold 402653184) +(require 'config-core) +(let ((my/inhibit-async-byte-recompile-config t)) + (require 'config-package)) +(byte-recompile-config) diff --git a/modules/config-avy-easymotion.el b/modules/config-avy-easymotion.el index f9eba53b..96e34210 100644 --- a/modules/config-avy-easymotion.el +++ b/modules/config-avy-easymotion.el @@ -57,6 +57,8 @@ :config (eval-when-compile (with-demoted-errors "Load error: %s" + (use-package evil) + (use-package key-chord) (require 'key-chord) (require 'evil))) (key-chord-define evil-insert-state-map "jk" #'avy-goto-char) @@ -98,10 +100,9 @@ (use-package evil-easymotion :init (eval-when-compile - (with-demoted-errors "Load error: %s" - (require 'evil) - (require 'el-patch) - (require 'evil-easymotion))) + (use-package evil) + (require 'el-patch) + (require 'evil-easymotion)) (el-patch-feature evil-easymotion) diff --git a/modules/config-c.el b/modules/config-c.el index deeef5f5..9fca0363 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -86,8 +86,9 @@ ('objc-mode 'objc-mode-hook) ('c-mode 'c-mode-hook))))) - (use-package smartparens - :config + (with-eval-after-load 'smartparens + (eval-when-compile + (use-package smartparens)) (sp-with-modes '(c++-mode objc-mode c-mode) (sp-local-pair "/*" "*/" :post-handlers diff --git a/modules/config-core.el b/modules/config-core.el index 46ae54ca..27fcc892 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -73,16 +73,23 @@ files with (apparently) up to date bytecodes." (and (integerp arg) (= arg 4)) arg)) (init-el-error - (progn - (when force - (delete-file (locate-user-emacs-file "init.elc"))) - (not (byte-compile-file (locate-user-emacs-file "init.el"))))) - (modules-error (string-match-p - (rx "failed") - (byte-recompile-directory + (let ((init-elc (locate-user-emacs-file "init.elc")) + (init-el (locate-user-emacs-file "init.el"))) + (when force (delete-file init-elc)) + (when (or (not (file-exists-p init-elc)) + (time-less-p (file-attribute-modification-time + (file-attributes init-elc)) + (file-attribute-modification-time + (file-attributes init-el)))) + (not (byte-compile-file (locate-user-emacs-file "init.el")))))) + (modules-result (byte-recompile-directory (locate-user-emacs-file "modules/") 0 - force)))) + force)) + (modules-error (when (string-match-p + (rx "failed") + modules-result) + modules-result))) (or init-el-error modules-error))) (defun emergency-fix-config () diff --git a/modules/config-evil-modules.el b/modules/config-evil-modules.el index 309d7cee..c790b59e 100644 --- a/modules/config-evil-modules.el +++ b/modules/config-evil-modules.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (use-package evil)) (require 'evil) diff --git a/modules/config-evil-textobjects.el b/modules/config-evil-textobjects.el index 68fd9615..81686e29 100644 --- a/modules/config-evil-textobjects.el +++ b/modules/config-evil-textobjects.el @@ -1,5 +1,8 @@ ;; -*- lexical-binding: t -*- (require 'cl-lib) +(eval-when-compile + (use-package evil) + (require 'evil)) ;;; === Evil motion section === (use-package hydra diff --git a/modules/config-evil.el b/modules/config-evil.el index 3470d8d3..a5801f4b 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -20,11 +20,13 @@ (when args (apply #'format args))))) (apply old-fun args))))) + (key-chord-mode +1)) (use-package evil :init (evil-mode +1) :config + (eval-when-compile (require 'evil)) (setq evil-auto-indent t evil-ex-complete-emacs-commands t evil-undo-system 'undo-tree @@ -227,10 +229,7 @@ (cycle-spacing (or count 1))) (global-set-key (kbd " ") #'evil-cycle-spacing) - (global-set-key (kbd " ") #'evil-cycle-spacing) - - (require 'config-evil-modules) - (require 'config-evil-textobjects)) + (global-set-key (kbd " ") #'evil-cycle-spacing)) (defmacro el-patch-evil-define-command (&rest args) "Patch an evil command. The ARGS are the same as for `evil-define-command'." @@ -256,4 +255,7 @@ (indent defun)) `(el-patch--definition ,(cons #'evil-define-operator args))) +(require 'config-evil-modules) +(require 'config-evil-textobjects) + (provide 'config-evil) diff --git a/modules/config-intel.el b/modules/config-intel.el index 507f259e..55c84715 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -117,7 +117,9 @@ by doing (clear-string STRING)." flycheck-indication-mode nil) (defun my/display-error-messages-condensed (errors) - (require 'dash) + (eval-when-compile + (use-package dash) + (require 'dash)) (-when-let (messages (-keep #'flycheck-error-message errors)) (when (flycheck-may-use-echo-area-p) (display-message-or-buffer (mapconcat #'identity messages "\n") diff --git a/modules/config-modes.el b/modules/config-modes.el index ba5b6619..3fdf2eb6 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -53,8 +53,9 @@ (define-key emacs-lisp-mode-map (kbd "M-,") #'evil-jump-backward) (with-eval-after-load 'evil - (with-demoted-errors "Load error: %s" - (require 'evil)) + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'evil))) (evil-define-key 'normal emacs-lisp-mode-map "gd" #'emacs-lisp-goto-definition))) diff --git a/modules/config-package.el b/modules/config-package.el index 72076bc4..3e03ba68 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -301,6 +301,12 @@ ;; macro is being macro-expanded by elisp completion (see ;; `lisp--local-variables'), but still do install packages when ;; byte-compiling to avoid requiring `package' at runtime. + (el-patch-add + (when (and (bound-and-true-p byte-compile-current-file) + (not (plist-get state :defer-install))) + ;; Eval when byte-compiling, + (funcall use-package-ensure-function + name ensure state :byte-compile))) (cond ((plist-get state :defer-install) (push diff --git a/modules/config-paste.el b/modules/config-paste.el index 13394c54..5c84b093 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -5,7 +5,8 @@ (with-demoted-errors "Load error: %s" (require 'cua-base) (require 'el-patch) - (require 'config-evil))) + (use-package evil) + (require 'evil))) ;; Bring most recently yank-popped entry to the front of the kill-ring diff --git a/modules/config-tex.el b/modules/config-tex.el index 5edbbc41..b8b71f68 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -145,6 +145,9 @@ (add-to-list 'texmathp-tex-commands-default '("tableau" env-on)) (texmathp-compile)) + (eval-when-compile + (use-package smartparens)) + (require 'smartparens-latex) (sp-with-modes '(tex-mode plain-tex-mode latex-mode LaTeX-mode) (sp-local-pair "\\[" "\\]" diff --git a/modules/config-undo.el b/modules/config-undo.el index d7927f80..5c31d9d0 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -13,12 +13,6 @@ (advice-add 'evil--check-undo-system :override #'ignore)) :config - (eval-when-compile - (require 'undo-tree) - (require 'evil)) - - (evil-set-initial-state 'undo-tree-visualizer-mode 'motion) - (setq undo-tree-mode-lighter nil undo-tree-auto-save-history t undo-tree-enable-undo-in-region t From fd0db63e68f731e79c0fb8c777b4f3c6a9b43e03 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 17 Oct 2020 18:52:27 -0700 Subject: [PATCH 166/303] Byte compile config modules just in time --- init.el | 71 +++++++++++++++++++++++++++++++--------- modules/config-core.el | 4 ++- modules/config-evil.el | 4 +-- modules/config-intel.el | 2 +- modules/config-macros.el | 5 +++ modules/config-modes.el | 6 ++-- modules/config-safety.el | 3 +- modules/config-ui.el | 6 ++-- 8 files changed, 75 insertions(+), 26 deletions(-) diff --git a/init.el b/init.el index ba0e9d12..6ff78c68 100644 --- a/init.el +++ b/init.el @@ -57,33 +57,74 @@ (load custom-file) (error (with-temp-file custom-file))) - (require 'config-core) + (defun my/require-config-module-maybe-byte-compile (feature) + (let* ((gc-cons-threshold 800000) + (modules-dir (locate-user-emacs-file "modules/")) + (basename (symbol-name feature)) + (source (expand-file-name (concat basename ".el") modules-dir)) + (dest (expand-file-name (concat basename ".elc") modules-dir))) + (when (or (not (file-exists-p dest)) + (file-newer-than-file-p source dest)) + (message "Byte-compiling %s..." basename) + (if (if (and nil (require 'async nil t)) + (async-get + (async-start + `(lambda () + (add-to-list 'load-path + (locate-user-emacs-file "modules/")) + (setq load-prefer-newer t) + (require 'config-core) + (require 'config-package) + (byte-compile-file ,source)))) + (require feature) + (byte-compile-file source)) + (message "Byte-compiling %s...done" basename) + (message "Byte-compiling %s...failed" basename)))) + (require feature)) + + (defun my/maybe-byte-compile-init-el () + (let ((init-elc (concat (file-name-sans-extension user-init-file) + ".elc"))) + (when (file-newer-than-file-p user-init-file init-elc) + (byte-compile-file user-init-file) + (when (and (fboundp 'restart-emacs) + (y-or-n-p (format "%s was newer than %s. Restart?" + user-init-file + init-elc)))) + (restart-emacs)))) + + (add-hook 'after-init-hook #'my/maybe-byte-compile-init-el) + + (eval-when-compile + (require 'config-macros)) + + (my/require-config-module 'config-core) (message "[= ] package") - (require 'config-package) + (my/require-config-module 'config-package) (message "[== ] desktop") - (require 'config-desktop) + (my/require-config-module 'config-desktop) (message "[=== ] safety") - (require 'config-safety) + (my/require-config-module 'config-safety) (message "[==== ] evil") - (require 'config-evil) + (my/require-config-module 'config-evil) (message "[===== ] ui") - (require 'config-ui) + (my/require-config-module 'config-ui) (message "[====== ] whitespace") - (require 'config-whitespace) + (my/require-config-module 'config-whitespace) (message "[======= ] paste") - (require 'config-paste) + (my/require-config-module 'config-paste) (message "[======== ] company") - (require 'config-company) + (my/require-config-module 'config-company) (message "[========= ] vcs") - (require 'config-vcs) + (my/require-config-module 'config-vcs) (message "[========== ] ivy") - (require 'config-ivy) + (my/require-config-module 'config-ivy) (message "[=========== ] helm") - (require 'config-helm) + (my/require-config-module 'config-helm) (message "[============= ] intel") - (require 'config-intel) + (my/require-config-module 'config-intel) (message "[============== ] modes") - (require 'config-modes) + (my/require-config-module 'config-modes) (message "[===============] solarized") - (require 'config-solarized) + (my/require-config-module 'config-solarized) (message "[===============] done"))) diff --git a/modules/config-core.el b/modules/config-core.el index 27fcc892..20dda17e 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'tramp)) (setq ad-redefinition-action 'accept cursor-type 'box diff --git a/modules/config-evil.el b/modules/config-evil.el index a5801f4b..933fb74b 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -255,7 +255,7 @@ (indent defun)) `(el-patch--definition ,(cons #'evil-define-operator args))) -(require 'config-evil-modules) -(require 'config-evil-textobjects) +(my/require-config-module 'config-evil-modules) +(my/require-config-module 'config-evil-textobjects) (provide 'config-evil) diff --git a/modules/config-intel.el b/modules/config-intel.el index 55c84715..56f1b182 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -1,7 +1,7 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros)) (require 'cl-lib) -(require 'config-tramp) +(my/require-config-module 'config-tramp) (define-minor-mode read-passwd-show-hash-mode "Show the hashes of passwords read by read-passwd" diff --git a/modules/config-macros.el b/modules/config-macros.el index cd7dc5c7..2d78dc0d 100644 --- a/modules/config-macros.el +++ b/modules/config-macros.el @@ -1,6 +1,11 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'cl-lib)) +(defmacro my/require-config-module (feature) + `(if (fboundp 'my/require-config-module-maybe-byte-compile) + (my/require-config-module-maybe-byte-compile ,feature) + (require ,feature))) + (defmacro my/defun-as-value (name arglist &optional docstring &rest body) (declare (doc-string 3) (indent 2)) `(progn diff --git a/modules/config-modes.el b/modules/config-modes.el index 3fdf2eb6..21d30491 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1530,8 +1530,8 @@ Returns the symbol." (use-package company-lsp :commands company-lsp) -(require 'config-tex) -(require 'config-c) -(require 'config-python) +(my/require-config-module 'config-tex) +(my/require-config-module 'config-c) +(my/require-config-module 'config-python) (provide 'config-modes) diff --git a/modules/config-safety.el b/modules/config-safety.el index b1e007bf..ac787358 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -139,7 +139,8 @@ when `auto-save-mode' is invoked manually.") :defer-install t :commands (backup-walker-start) :config - (evil-set-initial-state 'backup-walker-mode 'motion)) + (with-eval-after-load 'evil + (evil-set-initial-state 'backup-walker-mode 'motion))) (use-package real-auto-save :defer-install t diff --git a/modules/config-ui.el b/modules/config-ui.el index 45dd86a5..0e830488 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -3,10 +3,10 @@ (require 'cl-lib) -(require 'config-avy-easymotion) -(require 'config-undo) +(my/require-config-module 'config-avy-easymotion) +(my/require-config-module 'config-undo) -(require 'config-smartparens) +(my/require-config-module 'config-smartparens) (setq mouse-wheel-scroll-amount '(3 ((shift) . 1)) mouse-wheel-progressive-speed nil From cf66c213edce5563231f5e159269e9514e10ffa4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 17 Oct 2020 18:53:15 -0700 Subject: [PATCH 167/303] Update minibuffer-dept-indicate-mode patch for Emacs 27.1 --- modules/config-ivy.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index 10eb7996..6ed02086 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -21,9 +21,6 @@ (el-patch-feature mb-depth) (el-patch-define-minor-mode minibuffer-depth-indicate-mode "Toggle Minibuffer Depth Indication mode. -With a prefix argument ARG, enable Minibuffer Depth Indication -mode if ARG is positive, and disable it otherwise. If called -from Lisp, enable the mode if ARG is omitted or nil. Minibuffer Depth Indication mode is a global minor mode. When enabled, any recursive use of the minibuffer will show the @@ -36,6 +33,7 @@ recursion depth in the minibuffer prompt. This is only useful if (add-hook 'minibuffer-setup-hook 'minibuffer-depth-setup) ;; Disable the mode (remove-hook 'minibuffer-setup-hook 'minibuffer-depth-setup))) + (minibuffer-depth-indicate-mode +1)) ;; hl-line-mode breaks minibuffer in TTY From 6d69070569fa13eb289c656acb16bd5d3eaec8b2 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 24 Oct 2020 17:38:06 -0700 Subject: [PATCH 168/303] Update rsyncx tramp method for Emacs 27.1 --- modules/config-tramp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 960e1fb0..c40a4998 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -29,7 +29,7 @@ `("rsyncx" (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") - ("-t" "-t") ("%h") ("/bin/sh"))) + ("-t" "-t") ("%h") ("%l"))) (tramp-async-args (("-q"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) From 4ecc3bb5527f3847a6ad8820f07ce92eb037f37d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 25 Nov 2020 16:43:12 -0800 Subject: [PATCH 169/303] =?UTF-8?q?Remove=20pylance=20configuration=20?= =?UTF-8?q?=F0=9F=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/config-python.el | 46 ---------------------------------------- 1 file changed, 46 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 0273fb08..bd29cd77 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -117,52 +117,6 @@ Return either a string or nil." (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) - (require 'lsp) - (lsp-register-custom-settings - `(("python.analysis.typeCheckingMode" "basic") - ("python.analysis.diagnosticMode" "openFilesOnly") - ("python.analysis.stubPath" "./typings") - ("python.analysis.autoSearchPaths" t t) - ("python.analysis.extraPaths" nil) - ("python.analysis.diagnosticSeverityOverrides" nil) - ("python.analysis.useLibraryCodeForTypes" t t) - ("python.analysis.autoImportCompletions" t t) - ("python.analysis.completeFunctionParens" nil t) - ("python.pythonPath" (lambda () - (when-let ((venv (my/python-find-virtualenv-cached)) - (python-path (expand-file-name - "bin/python" - venv)) - (is-executable (file-executable-p python-path))) - (my/tramp-localname python-path)))))) - - (lsp-register-client - (make-lsp-client - :new-connection (lsp-stdio-connection - (executable-find "pylance-language-server")) - :major-modes '(python-mode) - :multi-root t - :server-id 'pylance - :priority 3 - :initialized-fn - (lambda (workspace) - (with-lsp-workspace workspace - (lsp--set-configuration (make-hash-table :test 'equal)))))) - - (lsp-register-client - (make-lsp-client - :new-connection (lsp-tramp-connection - (executable-find "pylance-language-server" t)) - :major-modes '(python-mode) - :multi-root t - :remote? t - :server-id 'pylance-remote - :priority -1 - :initialized-fn - (lambda (workspace) - (with-lsp-workspace workspace - (lsp--set-configuration (make-hash-table :test 'equal)))))) - ;; Use the Microsoft python ls if we can (use-package lsp-python-ms :init From f28a518649182f4c5e8ae44153bfa2461e190a0f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 25 Nov 2020 16:45:53 -0800 Subject: [PATCH 170/303] Remove semantic configuration for python --- modules/config-python.el | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index bd29cd77..5e5627b9 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -109,13 +109,7 @@ Return either a string or nil." :config (add-hook 'python-mode-hook - (lambda () - ;; conflicts with `eldoc-mode' - (when (bound-and-true-p semantic-idle-summary-mode) - (semantic-idle-summary-mode -1)) - (setq mode-name "Py"))) - - (define-key python-mode-map (kbd "M-RET") #'srefactor-refactor-at-point) + (lambda () (setq mode-name "Py"))) ;; Use the Microsoft python ls if we can (use-package lsp-python-ms @@ -358,12 +352,6 @@ directory" (add-hook 'sage-shell-mode-hook #'eldoc-mode) (add-hook 'sage-mode-hook #'eldoc-mode) - (add-hook 'sage-shell-mode-hook - (lambda () (semantic-idle-summary-mode -1))) - - (add-hook 'sage-mode-hook - (lambda () (semantic-idle-summary-mode -1))) - (add-hook 'sage-shell-after-prompt-hook #'sage-shell-view) (advice-add From 7df93078426b4997b57be6944224a5f975f2e50e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 16 Dec 2020 17:49:58 -0800 Subject: [PATCH 171/303] Steal some performance tweaks from doom --- modules/config-core.el | 5 ++++- modules/config-intel.el | 1 - modules/config-ui.el | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/config-core.el b/modules/config-core.el index 20dda17e..09bb4b73 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -4,6 +4,7 @@ (require 'tramp)) (setq ad-redefinition-action 'accept + bidi-inhibit-bpa t cursor-type 'box create-lockfiles nil custom-safe-themes @@ -50,7 +51,9 @@ x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) x-stretch-cursor t) -(setq-default buffer-file-coding-system 'utf-8 +(setq-default bidi-display-reordering 'left-to-right + bidi-paragraph-direction 'left-to-right + buffer-file-coding-system 'utf-8 indent-tabs-mode nil indicate-buffer-boundaries '((bottom . left))) diff --git a/modules/config-intel.el b/modules/config-intel.el index 56f1b182..c04cf7db 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -463,7 +463,6 @@ is binary, activate `hexl-mode'." (add-hook 'vlf-mode-hook (my/defun-as-value my/vlf-hook () - (setq bidi-display-reordering nil) (flyspell-mode -1) (flycheck-mode -1) (ws-butler-mode -1) diff --git a/modules/config-ui.el b/modules/config-ui.el index 0e830488..ba6014b4 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -13,7 +13,10 @@ mouse-wheel-follow-mouse t scroll-step 1 auto-window-vscroll nil - scroll-conservatively 1000) + scroll-conservatively 1000 + fast-but-imprecise-scrolling t + frame-inhibit-implied-resize t + inhibit-compacting-font-caches t) (defun isearch-exit-chord-worker () "Exit out of isearch after a chord" From 4e78f5094d9a4aac41e65e352e732a8867c1eff9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 26 Dec 2020 12:44:11 -0800 Subject: [PATCH 172/303] Increase read-process-output-max to 1MiB --- modules/config-core.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-core.el b/modules/config-core.el index 09bb4b73..f15e5bd9 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -37,6 +37,7 @@ mouse-autoselect-window 0.3 mouse-drag-copy-region nil my/flag-debug-init (eq debug-on-error 'startup) + read-process-output-max (eval-when-compile (* 1024 1024)) right-margin-width 0 ring-bell-function 'ignore save-interprogram-paste-before-kill t From 07b612016617e3f1721343596d3356cd10533420 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 17 Jan 2021 21:09:32 -0800 Subject: [PATCH 173/303] Fix magic-latex-buffer performance patch --- modules/config-tex.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index b8b71f68..422a3639 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -231,15 +231,13 @@ matching string." (not (and point-safe (< (point) ml/jit-point) (< ml/jit-point (match-end 0)))) - (looking-back (el-patch-swap - "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" - (rx (or (not-char "\\") bol) - (zero-or-more "\\\\"))) - (el-patch-add (line-beginning-position))) + (looking-back "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" + (el-patch-swap + (point-min) + (line-beginning-position))) (not (ml/skip-comments-and-verbs backward))))) (ml/search-regexp regex bound backward point-safe))))) - (add-hook 'TeX-mode-hook #'lsp-deferred) (add-hook From c1c23ef5aae184ae50922dc96ea60bad3809e37e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 17 Jan 2021 21:10:03 -0800 Subject: [PATCH 174/303] Remove call to nonexistent #'my/evil-LaTeX-setup --- modules/config-tex.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 422a3639..e49b1608 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -258,7 +258,6 @@ matching string." :commands (evil-tex-mode)) (add-hook 'LaTeX-mode-hook #'evil-tex-mode) - (add-hook 'LaTeX-mode-hook #'my/evil-LaTeX-setup) (evil-set-initial-state 'TeX-error-overview-mode 'insert)) (add-to-list 'sp-sexp-suffix (list 'latex-mode 'regexp "")) From 65263cc9c1fa42d0a6c994bbb79f1de3e1d6aede Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 17 Jan 2021 21:10:54 -0800 Subject: [PATCH 175/303] Remove obsolete customization of TeX-output-view-style --- modules/config-tex.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index e49b1608..7f9f400b 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -103,9 +103,6 @@ (when (executable-find "zathura") (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Zathura")) - (when (executable-find "evince") - (add-to-list 'TeX-output-view-style '("^pdf$" "." "evince --page-index=%(outpage) %o"))) - (when (and (eq system-type 'darwin) (file-directory-p "/Applications/Skim.app")) (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Skim") From 91f6f66fae151cd750f1c46e6df124f2335ce776 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 18 Jan 2021 22:59:52 -0800 Subject: [PATCH 176/303] LaTeX: disable ; (semicolon) binding in algorithm environment --- modules/config-tex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 7f9f400b..6de029bd 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -334,7 +334,8 @@ matching string." "circuitikz" "lstlisting" "minted" - "verbatim") + "verbatim" + "algorithm") eol) (LaTeX-current-environment)))) From 7ba0b75ad4d45425d747a1a41245882b120a7862 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Feb 2021 21:55:50 -0800 Subject: [PATCH 177/303] =?UTF-8?q?advice-add=20=E2=86=92=20define-advice,?= =?UTF-8?q?=20closes=20#135?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/config-avy-easymotion.el | 29 +++--- modules/config-c.el | 9 +- modules/config-core.el | 13 +-- modules/config-desktop.el | 87 ++++++++--------- modules/config-evil-modules.el | 15 ++- modules/config-evil.el | 38 +++----- modules/config-helm.el | 30 +++--- modules/config-intel.el | 118 +++++++++++------------ modules/config-ivy.el | 13 ++- modules/config-macros.el | 4 +- modules/config-modes.el | 127 ++++++++---------------- modules/config-package.el | 9 +- modules/config-paste.el | 32 +++---- modules/config-python.el | 34 ++++--- modules/config-safety.el | 160 +++++++++++++++---------------- modules/config-smartparens.el | 7 +- modules/config-solarized.el | 15 +-- modules/config-tex.el | 62 ++++++------ modules/config-tramp.el | 29 +++--- modules/config-ui.el | 22 ++--- modules/config-undo.el | 75 +++++++-------- modules/config-vcs.el | 25 +++-- 22 files changed, 423 insertions(+), 530 deletions(-) diff --git a/modules/config-avy-easymotion.el b/modules/config-avy-easymotion.el index 96e34210..87fb56b0 100644 --- a/modules/config-avy-easymotion.el +++ b/modules/config-avy-easymotion.el @@ -3,21 +3,20 @@ (use-package avy :init - (advice-add - 'self-insert-command :around - (my/defun-as-value nadvice/self-insert-command (old-fun &optional arg) - (interactive "P") - (cond - ;; `C-u a` jumps to `a`. - ((consp arg) - (avy-goto-char last-command-event)) - - ;; `C-- a` jumps to `a` at the beginning of a (sub)word - ((eq '- arg) - (avy-goto-subword-1 last-command-event)) - - ((or (numberp arg) (not arg)) - (funcall old-fun (or arg 1)))))) + (define-advice self-insert-command + (:around (old-fun &optional arg) letters-do-avy-jump) + (interactive "P") + (cond + ;; `C-u a` jumps to `a`. + ((consp arg) + (avy-goto-char last-command-event)) + + ;; `C-- a` jumps to `a` at the beginning of a (sub)word + ((eq '- arg) + (avy-goto-subword-1 last-command-event)) + + ((or (numberp arg) (not arg)) + (funcall old-fun (or arg 1))))) (global-set-key (kbd " ") #'evil-avy-goto-line) :config diff --git a/modules/config-c.el b/modules/config-c.el index 9fca0363..a6804e52 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -26,17 +26,16 @@ :config (setq c-default-style "k&r") - (advice-add - 'c-indent-new-comment-line :after - (my/defun-as-value nadvice/c-indent-new-comment-line (&rest _args) - (when (and + (define-advice c-indent-new-comment-line + (:after (&rest _args) smart-extend-comments) + (when (and (looking-at (rx (zero-or-more (not-char ?\n)) "*/")) (not (looking-at (rx (zero-or-more (not-char ?\n)) "/*")))) (save-excursion (re-search-forward (rx "*/") (line-end-position)) (forward-char -2) (newline) - (indent-according-to-mode))))) + (indent-according-to-mode)))) (use-package clang-format :defer-install t diff --git a/modules/config-core.el b/modules/config-core.el index f15e5bd9..c76827aa 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -244,12 +244,10 @@ response as a no." (/= (point) (point-min))))))) -(defun nadvice/read-passwd/isolate-kill-ring (old-fun &rest args) +(define-advice read-passwd (:around (old-fun &rest args) isolate-kill-ring) (let ((kill-ring kill-ring)) (apply old-fun args))) -(advice-add 'read-passwd :around #'nadvice/read-passwd/isolate-kill-ring) - (defun my/detect-shell (&optional dir) (require 'tramp) (let* ((dir (or dir default-directory)) @@ -281,11 +279,10 @@ response as a no." full-shells) (cl-some #'executable-find bare-shells))))) -(advice-add - 'shell-command-to-string :around - (my/defun-as-value nadvice/shell-command-to-string (old-fun &rest args) - (let ((shell-file-name (my/detect-shell))) - (apply old-fun args)))) +(define-advice shell-command-to-string + (:around (old-fun &rest args) auto-detect-shell) + (let ((shell-file-name (my/detect-shell))) + (apply old-fun args))) (defun my/process-file-to-string (&rest args) (let* ((return-code 0) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 43efcebf..431110eb 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -181,24 +181,23 @@ histories, which is probably undesirable." - (advice-add - 'savehist-save :around - (my/defun-as-value nadvice/savehist-save/unpropertize (old-fun &rest args) - (let ((vars (append savehist-minibuffer-history-variables - savehist-additional-variables))) - (cl-progv vars - (mapcar (lambda (sym) - (if (boundp sym) - (let ((value (symbol-value sym))) - (if (and value - (listp value) - (stringp (car value))) - (mapcar #'substring-no-properties - value) - value)) - nil)) - vars) - (apply old-fun args)))))) + (define-advice savehist-save + (:around (old-fun &rest args) remove-text-properties) + (let ((vars (append savehist-minibuffer-history-variables + savehist-additional-variables))) + (cl-progv vars + (mapcar (lambda (sym) + (if (boundp sym) + (let ((value (symbol-value sym))) + (if (and value + (listp value) + (stringp (car value))) + (mapcar #'substring-no-properties + value) + value)) + nil)) + vars) + (apply old-fun args))))) (use-package saveplace :ensure nil @@ -362,7 +361,8 @@ Write data into the file specified by `recentf-save-file'." (warn "recentf mode: %s" (error-message-string error))))) (let ((recentf-autosave-timer nil)) - (defun nadvice/recentf-autosave (&rest _args) + (define-advice recentf-track-opened-file + (:after (&rest _args) autosave) (when (timerp recentf-autosave-timer) (cancel-timer recentf-autosave-timer)) (setq recentf-autosave-timer @@ -372,14 +372,10 @@ Write data into the file specified by `recentf-save-file'." (let ((inhibit-message t)) (recentf-save-list))))))) - (advice-add 'recentf-track-opened-file :after - #'nadvice/recentf-autosave) - - (defun nadvice/recentf-quiet (old-fun &rest args) + (define-advice recentf-cleanup + (:around (old-fun &rest args) inhibit-message) (let ((inhibit-message t)) - (apply old-fun args))) - - (advice-add 'recentf-cleanup :around #'nadvice/recentf-quiet)) + (apply old-fun args)))) (use-package desktop :ensure nil @@ -429,20 +425,18 @@ Write data into the file specified by `recentf-save-file'." desktop-base-lock-name "emacs-desktop.lock") ;; don't let a dead emacs own the lockfile - (advice-add - 'desktop-owner :filter-return - (my/defun-as-value nadvice/desktop-owner (pid) - (when pid - (let* ((attributes (process-attributes pid)) - (cmd (cdr (assoc 'comm attributes)))) - (if (and cmd (string-prefix-p "emacs" cmd)) - pid - nil))))) - (advice-add - 'desktop-claim-lock :override - (my/defun-as-value nadvice/desktop-claim-lock (&optional dirname) - (write-region (number-to-string (emacs-pid)) nil - (desktop-full-lock-name dirname) nil 1)))) + (define-advice desktop-owner + (:filter-return (pid) check-alive) + (when pid + (let* ((attributes (process-attributes pid)) + (cmd (cdr (assoc 'comm attributes)))) + (when (and cmd (string-prefix-p "emacs" cmd)) + pid)))) + + (define-advice desktop-claim-lock + (:override (&optional dirname) inhibit-message) + (write-region (number-to-string (emacs-pid)) nil + (desktop-full-lock-name dirname) nil 1))) (use-package server :ensure nil @@ -499,7 +493,8 @@ Write data into the file specified by `recentf-save-file'." (idle-job-add-function #'server-start 'append)) :config - (defun nadvice/server-mode (old-fun &rest args) + (define-advice server-start + (:around (old-fun &rest args) auto-server-name) (catch 'done (let ((count 1)) (while t @@ -508,9 +503,7 @@ Write data into the file specified by `recentf-save-file'." (setq server-name (concat "server" (number-to-string count))) (cl-incf count)) (apply old-fun args) - (throw 'done server-name)))))) - - (advice-add 'server-start :around #'nadvice/server-mode)) + (throw 'done server-name))))))) (use-package atomic-chrome :commands (atomic-chrome-start-server @@ -578,9 +571,9 @@ Write data into the file specified by `recentf-save-file'." (add-hook 'atomic-chrome-edit-mode-hook #'my/activate-emacs) (defvar my/atomic-chrome-browser-wid nil) - (advice-add 'atomic-chrome-show-edit-buffer :before - (my/defun-as-value my/atomic-chrome-stash-browser-wid (&rest _) - (setq my/atomic-chrome-browser-wid (my/get-active-window-id)))) + (define-advice atomic-chrome-show-edit-buffer + (:before (&rest _) stash-browser-wid ) + (setq my/atomic-chrome-browser-wid (my/get-active-window-id))) (add-hook 'atomic-chrome-edit-done-hook diff --git a/modules/config-evil-modules.el b/modules/config-evil-modules.el index c790b59e..1e261067 100644 --- a/modules/config-evil-modules.el +++ b/modules/config-evil-modules.el @@ -146,14 +146,13 @@ (set-face-attribute 'evil-quickscope-second-face nil :inherit nil)) - (advice-add - 'evil-quickscope-update-overlays-bidirectional :override - (my/defun-as-value nadvice/evil-quickscope-update-overlays-bidirectional () - "Update overlays in both directions from point." - (evil-quickscope-remove-overlays) - (when (memq evil-state '(normal motion)) - (evil-quickscope-apply-overlays-forward) - (evil-quickscope-apply-overlays-backward))))) + (define-advice evil-quickscope-update-overlays-bidirectional + (:override () only-normal-state) + "Update overlays in both directions from point." + (evil-quickscope-remove-overlays) + (when (memq evil-state '(normal motion)) + (evil-quickscope-apply-overlays-forward) + (evil-quickscope-apply-overlays-backward)))) (use-package evil-lion :commands (evil-lion-left evil-lion-right) diff --git a/modules/config-evil.el b/modules/config-evil.el index 933fb74b..2b05135a 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -8,19 +8,6 @@ (key-chord-mode -1) (key-chord-mode +1)) - (require 'key-chord) - - (advice-add - 'key-chord-mode :around - (my/defun-as-value nadvice/key-chord-mode (old-fun &rest args) - (if (called-interactively-p 'any) - (apply old-fun args) - (cl-letf* (((symbol-function #'message) - (lambda (&rest args) - (when args - (apply #'format args))))) - (apply old-fun args))))) - (key-chord-mode +1)) (use-package evil @@ -96,14 +83,16 @@ (define-key evil-visual-state-map (kbd "v") #'evil-visual-char-or-expand-region) ;; indent pasted regions in evil - (defun nadvice/evil-paste-indent (old-fun &rest args) - (indent-region (point) (+ (point) (length (apply old-fun args))))) + (defun evil-paste@auto-indent (str) + (indent-region (point) (+ (point) (length str)))) - (advice-add 'evil-paste-before :around #'nadvice/evil-paste-indent) - (advice-add 'evil-paste-after :around #'nadvice/evil-paste-indent) + (advice-add 'evil-paste-before :filter-return #'evil-paste@auto-indent) + (advice-add 'evil-paste-after :filter-return #'evil-paste@auto-indent) - (let ((my/evil-mode-line-face-cookies)) - (defun my/evil-set-mode-line-face (&rest _args) + ;; Change modeline color by Evil state + (let ((quark/evil-mode-line-face-cookies)) + (define-advice evil-generate-mode-line-tag + (:after (&rest _args) set-modeline-faces) (cl-destructuring-bind (bg-color fg-color) (if (< (display-color-cells) 256) (pcase evil-state @@ -120,19 +109,14 @@ (`visual '("#268bd2" "#eee8d5")) (`replace '("#dc322f" "#eee8d5")) (_ '("grey70" "black")))) - (when my/evil-mode-line-face-cookies - (face-remap-remove-relative my/evil-mode-line-face-cookies)) - (setq my/evil-mode-line-face-cookies + (when quark/evil-mode-line-face-cookies + (face-remap-remove-relative quark/evil-mode-line-face-cookies)) + (setq quark/evil-mode-line-face-cookies (face-remap-add-relative 'mode-line `((:foreground ,fg-color :background ,bg-color) mode-line)))))) - ;; Change modeline color by Evil state - (advice-add 'evil-generate-mode-line-tag - :after - #'my/evil-set-mode-line-face) - ;; open line and stay in normal mode (evil-define-command evil-open-below-normal (arg) (interactive "p") diff --git a/modules/config-helm.el b/modules/config-helm.el index 3e2aff4b..79bd52cb 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -165,14 +165,13 @@ (rx ".zwc" line-end) (rx "/.#")))) - (advice-add - 'helm-ff-filter-candidate-one-by-one :around - (my/defun-as-value nadvice/helm-ff-filter-candidate-one-by-one (old-fun file &rest args) - (when (or (not (string-match-p (rx (or "." "..") line-end) file)) - (string-match-p (rx ".") - (helm-basename (or (bound-and-true-p helm-input) - "")))) - (funcall old-fun file args))))) + (define-advice helm-ff-filter-candidate-one-by-one + (:around (old-fun file &rest args) skip-dots) + (when (or (not (string-match-p (rx (or "." "..") line-end) file)) + (string-match-p (rx ".") + (helm-basename (or (bound-and-true-p helm-input) + "")))) + (funcall old-fun file args)))) (use-package helm-buffers :ensure nil @@ -480,14 +479,13 @@ (use-package evil :config - (advice-add - 'evil-paste-pop :around - (my/defun-as-value nadvice/evil-paste-pop (old-fun &rest args) - (if (memq last-command '(evil-paste-after - evil-paste-before - evil-visual-paste)) - (apply old-fun args) - (call-interactively #'my/helm-interfile-omni)))) + (define-advice evil-paste-pop + (:around (old-fun &rest args) maybe-helm-omni) + (if (memq last-command '(evil-paste-after + evil-paste-before + evil-visual-paste)) + (apply old-fun args) + (call-interactively #'my/helm-interfile-omni))) (define-key evil-insert-state-map (kbd "C-p") #'my/helm-interfile-omni) (define-key evil-motion-state-map (kbd "C-p") #'my/helm-interfile-omni)) diff --git a/modules/config-intel.el b/modules/config-intel.el index c04cf7db..99040940 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -82,11 +82,10 @@ by doing (clear-string STRING)." :ensure nil :init (with-eval-after-load 'semantic/db-file - (advice-add - 'semanticdb-file-directory-exists-p :around - (my/defun-as-value nadvice/semanticdb-file-directory-exists-p (old-fun &rest args) - (cl-letf* (((symbol-function #'y-or-n-p) (lambda (prompt) t))) - (apply old-fun args))))) + (define-advice semanticdb-file-directory-exists-p + (:around (old-fun &rest args) always-y) + (cl-letf* (((symbol-function #'y-or-n-p) (lambda (prompt) t))) + (apply old-fun args)))) :config (setq semanticdb-default-save-directory @@ -94,12 +93,11 @@ by doing (clear-string STRING)." srecode-map-save-file (locate-user-emacs-file "data/srecode-map.el")) - (advice-add - 'semantic-idle-summary-idle-function :around - (my/defun-as-value nadvice/semantic-idle-summary-idle-function (old-fun &rest args) - (unless (and (bound-and-true-p flycheck-mode) - (flycheck-overlays-at (point))) - (apply old-fun args))))) + (define-advice semantic-idle-summary-idle-function + (:around (old-fun &rest args) avoid-flycheck) + (unless (and (bound-and-true-p flycheck-mode) + (flycheck-overlays-at (point))) + (apply old-fun args)))) (use-package abbrev :ensure nil @@ -145,10 +143,9 @@ by doing (clear-string STRING)." ;; please don't give me emacs-lisp stylistic advice (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)) - (advice-add - 'flycheck-mode-line-status-text :override - (my/defun-as-value nadvice/flycheck-mode-line-status-text (&optional status) - (let ((text (pcase (or status flycheck-last-status-change) + (define-advice flycheck-mode-line-status-text + (:override (&optional status) mode-line-symbol) + (let ((text (pcase (or status flycheck-last-status-change) (`not-checked "") (`no-checker "-") (`running "*") @@ -163,7 +160,7 @@ by doing (clear-string STRING)." "")) (`interrupted "-") (`suspicious "?")))) - (concat (if (display-graphic-p) " ✓" " Γ") text)))) + (concat (if (display-graphic-p) " ✓" " Γ") text))) (defun flycheck-goto-nearest-error () (interactive) @@ -191,14 +188,13 @@ by doing (clear-string STRING)." (setq eldoc-idle-delay 0.2) - (advice-add - 'eldoc-display-message-no-interference-p :around - (my/defun-as-value nadvice/eldoc-display-message-no-interference-p (old-fun &rest args) - (and (apply old-fun args) - (not (and (bound-and-true-p sp-show-pair-overlays) - (not (minibufferp)))) - (not (and (bound-and-true-p flycheck-mode) - (flycheck-overlay-errors-at (point)))))))) + (define-advice eldoc-display-message-no-interference-p + (:around (old-fun &rest args) avoid-smartparens-and-flycheck) + (and (apply old-fun args) + (not (and (bound-and-true-p sp-show-pair-overlays) + (not (minibufferp)))) + (not (and (bound-and-true-p flycheck-mode) + (flycheck-overlay-errors-at (point))))))) ;;; ======================================= ;;; Flyspell - inline real time spell check @@ -214,11 +210,10 @@ by doing (clear-string STRING)." ((executable-find "hunspell") (setq ispell-program-name "hunspell"))) - (advice-add - 'ispell-init-process :around - (my/defun-as-value nadvice/ispell-init-process (old-fun &rest args) - (let ((inhibit-message t)) - (apply old-fun args))))) + (define-advice ispell-init-process + (:around (old-fun &rest args) inhibit-message) + (let ((inhibit-message t)) + (apply old-fun args)))) (use-package flyspell-lazy :init @@ -431,33 +426,32 @@ is binary, activate `hexl-mode'." :defer-install t :commands (vlf) :init - (advice-add - 'abort-if-file-too-large :around - (my/defun-as-value nadvice/abort-if-file-too-large (_old-fun &rest args) - (cl-destructuring-bind (size op-type filename &rest _offer-raw) args - (when (and size - (not (zerop size)) - large-file-warning-threshold - (< large-file-warning-threshold size)) - (let ((char nil)) - (while (not (memq (setq char - (read-event - (propertize - (format - "File %s is large (%s): \ + (define-advice abort-if-file-too-large + (:around (_old-fun &rest args) lazy-load-vlf) + (cl-destructuring-bind (size op-type filename &rest _offer-raw) args + (when (and size + (not (zerop size)) + large-file-warning-threshold + (< large-file-warning-threshold size)) + (let ((char nil)) + (while (not (memq (setq char + (read-event + (propertize + (format + "File %s is large (%s): \ %s normally (o), %s with vlf (v) or abort (a)" - (if filename - (file-name-nondirectory filename) - "") - (file-size-human-readable size) - op-type op-type) - 'face 'minibuffer-prompt))) - '(?o ?O ?v ?V ?a ?A)))) - (cond ((memq char '(?v ?V)) - (vlf filename) - (error "")) - ((memq char '(?a ?A)) - (error "Aborted")))))))) + (if filename + (file-name-nondirectory filename) + "") + (file-size-human-readable size) + op-type op-type) + 'face 'minibuffer-prompt))) + '(?o ?O ?v ?V ?a ?A)))) + (cond ((memq char '(?v ?V)) + (vlf filename) + (error "")) + ((memq char '(?a ?A)) + (error "Aborted"))))))) :config (add-hook @@ -483,14 +477,12 @@ is binary, activate `hexl-mode'." :config (setq fasd-enable-initial-prompt nil) - (advice-add - 'fasd-find-file :around - (my/defun-as-value nadvice/fasd-find-file (old-fun &rest args) - (require 'helm-mode) - ;; overriding the completion system in emacs-fasd is surprisingly tricky - (cl-letf (((symbol-function #'completing-read) - #'helm--completing-read-default)) - (apply old-fun args))))) + (define-advice fasd-find-file (:around (old-fun &rest args) use-helm) + (require 'helm-mode) + ;; overriding the completion system in emacs-fasd is surprisingly tricky + (cl-letf (((symbol-function #'completing-read) + #'helm--completing-read-default)) + (apply old-fun args)))) ;;; ================================================= ;;; dumb-jump an unintelligent goto-definition system diff --git a/modules/config-ivy.el b/modules/config-ivy.el index 6ed02086..fc427471 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -252,22 +252,21 @@ Minibuffer bindings: (setq smex-save-file (locate-user-emacs-file ".smex-items"))) ;; let M-' intelligently resume whatever completion we were working on -(let ((my/last-used-completion-system)) +(let ((quark/last-used-completion-system)) (with-eval-after-load 'ivy - (advice-add - 'ivy--minibuffer-setup :after - (my/defun-as-value nadvice/ivy--minibuffer-setup (&rest _args) - (setq my/last-used-completion-system 'ivy)))) + (define-advice ivy--minibuffer-setup + (:after (&rest _args) save-completion-system) + (setq quark/last-used-completion-system 'ivy))) (with-eval-after-load 'helm (add-hook 'helm-minibuffer-set-up-hook (my/defun-as-value my/helm-last-used-hook () - (setq my/last-used-completion-system 'helm)))) + (setq quark/last-used-completion-system 'helm)))) (defun minibuffer-completion-resume () (interactive) - (pcase my/last-used-completion-system + (pcase quark/last-used-completion-system (`helm (call-interactively #'helm-resume)) (`ivy (call-interactively #'ivy-resume)) (_ (message "You haven't used a completion system yet."))))) diff --git a/modules/config-macros.el b/modules/config-macros.el index 2d78dc0d..b075cf19 100644 --- a/modules/config-macros.el +++ b/modules/config-macros.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'cl-lib)) +(eval-when-compile + (require 'cl-lib) + (require 'nadvice)) (defmacro my/require-config-module (feature) `(if (fboundp 'my/require-config-module-maybe-byte-compile) diff --git a/modules/config-modes.el b/modules/config-modes.el index 21d30491..e75e1718 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -531,10 +531,9 @@ Returns the symbol." :ensure nil :config ;; after deleting a tag, indent properly - (defun nadvice/sgml-delete-tag (&rest _args) - (indent-region (point-min) (point-max))) - - (advice-add 'sgml-delete-tag :after #'nadvice/sgml-delete-tag)) + (define-advice sgml-delete-tag (:after (&rest _args) auto-indent) + ;; TODO: This is super slow right? + (indent-region (point-min) (point-max)))) (use-package css-mode :ensure nil @@ -765,7 +764,8 @@ Returns the symbol." :config (setq comint-prompt-read-only t) - (defun nadvice/comint-previous-matching-input-from-input (old-fun &rest args) + (define-advice comint-previous-matching-input-from-input + (:around (old-fun &rest args) maybe-previous-line) (condition-case err (apply old-fun args) (user-error @@ -777,10 +777,6 @@ Returns the symbol." (previous-line n)))) (signal (car err) (cdr err)))))) - (advice-add 'comint-previous-matching-input-from-input - :around - #'nadvice/comint-previous-matching-input-from-input) - (define-key comint-mode-map (kbd "") #'comint-previous-matching-input-from-input) (define-key comint-mode-map (kbd "") @@ -864,11 +860,15 @@ Returns the symbol." (use-package term :ensure nil + :init + (el-patch-feature term) + :config (require 'with-editor) (add-hook 'term-exec-hook 'with-editor-export-editor) - (defun nadvice/term-sentinel (old-fun &rest args) + (define-advice term-sentinel + (:around (old-fun &rest args) maybe-cleanup-buffer) (cl-destructuring-bind (proc _msg) args (if (memq (process-status proc) '(signal exit)) (let ((buffer (process-buffer proc))) @@ -877,41 +877,50 @@ Returns the symbol." (winner-undo) (message "")) (apply old-fun args)))) - (advice-add 'term-sentinel :around #'nadvice/term-sentinel) (define-key term-raw-map (kbd "") #'term-kill-subjob) (define-key term-raw-map (kbd " ") #'term-paste) - (defun nadvice/term-exec-1 (name buffer command switches) - (let* ((environment + (el-patch-defun term-exec-1 (name buffer command switches) + ;; We need to do an extra (fork-less) exec to run stty. + ;; (This would not be needed if we had suitable Emacs primitives.) + ;; The 'if ...; then shift; fi' hack is because Bourne shell + ;; loses one arg when called with -c, and newer shells (bash, ksh) don't. + ;; Thus we add an extra dummy argument "..", and then remove it. + (let ((process-environment + (nconc (list (format "TERM=%s" term-term-name) (format "TERMINFO=%s" data-directory) (format term-termcap-format "TERMCAP=" term-term-name term-height term-width) - (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) (format "LINES=%d" term-height) - (format "COLUMNS=%d" term-width))) - (process-environment - (append environment - process-environment)) - (tramp-remote-process-environment - (append environment - tramp-remote-process-environment)) - (process-connection-type t) - (coding-system-for-read 'binary)) - (apply 'start-file-process name buffer + (format "COLUMNS=%d" term-width)) + process-environment)) + (process-connection-type t) + ;; We should suppress conversion of end-of-line format. + (inhibit-eol-conversion t) + ;; The process's output contains not just chars but also binary + ;; escape codes, so we need to see the raw output. We will have to + ;; do the decoding by hand on the parts that are made of chars. + (coding-system-for-read 'binary)) + (when (term--bash-needs-EMACSp) + (push (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + process-environment)) + (apply (el-patch-swap #'start-process + #'start-file-process) + name buffer "/bin/sh" "-c" (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\ - if [ $1 = .. ]; then shift; fi; exec \"$@\"" +if [ $1 = .. ]; then shift; fi; exec \"$@\"" term-height term-width) ".." command switches))) - (advice-add 'term-exec-1 :override #'nadvice/term-exec-1) - - (defun nadvice/ansi-term (&optional args) + (define-advice ansi-term + (:filter-args (&optional args) use-default-shell) (interactive "P") (cl-destructuring-bind (&optional program new-buffer-name) args (let ((default-shell (my/detect-shell))) @@ -921,9 +930,7 @@ Returns the symbol." (list (read-from-minibuffer "Run program: " default-shell) new-buffer-name) - (list default-shell new-buffer-name)))))) - - (advice-add 'ansi-term :filter-args #'nadvice/ansi-term)) + (list default-shell new-buffer-name))))))) (use-package slurm-script-mode :recipe (slurm-script-mode @@ -1237,15 +1244,13 @@ Returns the symbol." (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) ;; Load languages when needed - (defun nadvice/org-babel-execute-src-block (old-fun &rest args) + (define-advice org-babel-execute-src-block + (:around (old-fun &rest args) lazy-load-languages) (let ((language (org-element-property :language (org-element-at-point)))) (unless (cdr (assoc (intern language) org-babel-load-languages)) (add-to-list 'org-babel-load-languages (cons (intern language) t)) (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)) - (apply old-fun args))) - - (advice-add 'org-babel-execute-src-block :around - #'nadvice/org-babel-execute-src-block)) + (apply old-fun args)))) (use-package org :config @@ -1256,55 +1261,7 @@ Returns the symbol." (defvar ob-language-file-alist (list '(ob-sage . ob-sagemath)) - "An alist that resolves discrepancies between language names and file names in org-babel") - - (defvar ob-deferred-install-languages (list 'ob-axiom - 'ob-browser - 'ob-coffee - 'ob-cypher - 'ob-diagrams - 'ob-elixir - 'ob-go - 'ob-http - 'ob-hy - 'ob-ipython - 'ob-kotlin - 'ob-lfe - 'ob-lua - 'ob-mongo - 'ob-ml-marklogic - 'ob-php - 'ob-prolog - 'ob-redis - 'ob-restclient - 'ob-sagemath - 'ob-scala - 'ob-sly - 'ob-sml - 'ob-swift - 'ob-translate - 'ob-typescript) - "A list of org-babel backends that can be installed with package.el") - - (defun nadvice/org-babel-do-load-languages (old-fun &rest args) - (cl-letf* ((old-require (symbol-function #'require)) - ((symbol-function #'require) - (lambda (symbol &rest iargs) - (let ((symbol - (cdr (or (assoc symbol ob-language-file-alist) - (cons symbol symbol))))) - (when (and (not (funcall old-require - symbol - (car-safe iargs) - t)) - (member symbol - ob-deferred-install-languages)) - (package-install symbol) - (apply old-require symbol iargs)))))) - (apply old-fun args))) - - (advice-add 'org-babel-do-load-languages :around - #'nadvice/org-babel-do-load-languages)) + "An alist that resolves discrepancies between language names and file names in org-babel")) ;; ============================================================================= ;; R =========================================================================== diff --git a/modules/config-package.el b/modules/config-package.el index 3e03ba68..8b368f7b 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -281,11 +281,10 @@ (setq use-package-always-ensure t use-package-always-defer t) - (advice-add - 'straight-use-package-ensure-function :around - (my/defun-as-value nadvice/straight-use-package-ensure-function (old-fun &rest args) - (cl-letf* (((symbol-function #'y-or-n-p) (lambda (_prompt) t))) - (apply old-fun args)))) + (define-advice straight-use-package-ensure-function + (:around (old-fun &rest args) y-or-n-p-always-t) + (cl-letf* (((symbol-function #'y-or-n-p) (lambda (_prompt) t))) + (apply old-fun args))) (el-patch-defun use-package-handler/:ensure (name keyword ensure rest state) (let* ((body (use-package-process-keywords name rest diff --git a/modules/config-paste.el b/modules/config-paste.el index 5c84b093..02dfcac9 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -86,20 +86,18 @@ move the yanking point; just return the Nth kill forward." (use-package xclip :config - (advice-add - 'xclip-set-selection :around - (my/defun-as-value nadvice/xclip-set-selection (old-fun &rest args) - (let ((default-directory "/")) - (apply old-fun args)))) - - (advice-add - 'xclip-selection-value :around - (my/defun-as-value nadvice/xclip-selection-value (old-fun &rest args) - (let ((default-directory "/")) - (unless (string-match-p - (rx bol "Error: Can't open display: ") - (cdr (my/process-file-to-string "xclip" nil t nil "-o"))) - (apply old-fun args)))))) + (define-advice xclip-set-selection + (:around (old-fun &rest args) use-local-xclip) + (let ((default-directory "/")) + (apply old-fun args))) + + (define-advice xclip-selection-value + (:around (old-fun &rest args) use-local-xclip) + (let ((default-directory "/")) + (unless (string-match-p + (rx bol "Error: Can't open display: ") + (cdr (my/process-file-to-string "xclip" nil t nil "-o"))) + (apply old-fun args))))) (use-package bracketed-paste :config @@ -243,14 +241,14 @@ move the yanking point; just return the Nth kill forward." (require 'evil))) ;; make evil respect whole-line-or-region - (defun nadvice/evil-paste-line (&rest _args) + (defun evil-paste@respect-whole-line-or-region (&rest _args) (when (with-demoted-errors "Failed to check text properties for paste. %s" (get-text-property 0 'whole-line-or-region (car kill-ring))) (setf (car kill-ring) (propertize (car kill-ring) 'yank-handler (list 'evil-yank-line-handler))))) - (advice-add 'evil-paste-before :before #'nadvice/evil-paste-line) - (advice-add 'evil-paste-after :before #'nadvice/evil-paste-line) + (advice-add 'evil-paste-before :before #'evil-paste@respect-whole-line-or-region) + (advice-add 'evil-paste-after :before #'evil-paste@respect-whole-line-or-region) (define-key evil-emacs-state-map (kbd "C-y") nil) (define-key evil-insert-state-map (kbd "C-y") nil)) diff --git a/modules/config-python.el b/modules/config-python.el index 5e5627b9..4eb77b84 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -68,7 +68,8 @@ Return either a string or nil." (require 'tramp))) (defvar my/pythonic-remote-host-cache nil) - (defun nadvice/pythonic-remote-host () + (define-advice pythonic-remote-host + (:override () smart-ssh-hosts) "Get host of the connection to the remote python interpreter." (unless my/pythonic-remote-host-cache (setq my/pythonic-remote-host-cache (make-hash-table :test #'equal))) @@ -88,19 +89,17 @@ Return either a string or nil." (search-forward "\nhostname ") (buffer-substring-no-properties (point) (line-end-position))) my/pythonic-remote-host-cache)) - hostname)))) - (advice-add 'pythonic-remote-host :override #'nadvice/pythonic-remote-host)) + hostname))))) (use-package pyvenv :config - (defun nadvice/pyvenv-activate (&optional arg) + (define-advice pyvenv-activate + (:filter-args (&optional arg) auto-find-venv) (interactive "P") (let ((default-venv (my/python-find-virtualenv-cached))) (if (or (not default-venv) (consp (car arg))) (list (read-directory-name "Activate venv: ")) - (list default-venv)))) - - (advice-add 'pyvenv-activate :filter-args #'nadvice/pyvenv-activate)) + (list default-venv))))) (use-package python :ensure nil @@ -354,17 +353,16 @@ directory" (add-hook 'sage-shell-after-prompt-hook #'sage-shell-view) - (advice-add - 'run-sage :around - (my/defun-as-value nadvice/run-sage (old-fun &optional arg) - (interactive "P") - (if (called-interactively-p 'any) - (cond - ((consp arg) - (call-interactively old-fun)) - (t - (funcall old-fun "sage")))) - (funcall old-fun arg)))) + (define-advice run-sage + (:around (old-fun &optional arg) default-sage) + (interactive "P") + (if (called-interactively-p 'any) + (cond + ((consp arg) + (call-interactively old-fun)) + (t + (funcall old-fun "sage")))) + (funcall old-fun arg))) (use-package hy-mode :defer-install t diff --git a/modules/config-safety.el b/modules/config-safety.el index ac787358..c2367150 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -14,70 +14,68 @@ when `auto-save-mode' is invoked manually.") ,(expand-file-name (locate-user-emacs-file "data/autosave/")) t))) ;; Use a unified directory for buffers that don't visit files -(advice-add - 'auto-save-mode :around - (my/defun-as-value nadvice/auto-save-mode (old-fun &rest args) - "Use a standard location for auto-save files for non-file buffers" - (if buffer-file-name - (apply old-fun args) - (let ((default-directory my/unnamed-autosave-location)) - (unless (file-directory-p default-directory) - (mkdir default-directory)) - (apply old-fun args))))) - - -(advice-add - 'recover-this-file :around - (my/defun-as-value nadvice/recover-this-file (old-fun &rest args) - "Restore BUFFER (or current buffer if omitted) from the autosave archive." +(define-advice auto-save-mode + (:around (old-fun &rest args) auto-save-non-file-buffers) + "Use a standard location for auto-save files for non-file buffers" + (if buffer-file-name + (apply old-fun args) + (let ((default-directory my/unnamed-autosave-location)) + (unless (file-directory-p default-directory) + (mkdir default-directory)) + (apply old-fun args)))) + +(define-advice recover-this-file + (:around (old-fun &rest args) restore-buffers) + "Restore BUFFER (or current buffer if omitted) from the autosave archive." (interactive) - (if buffer-file-name - (apply old-fun args) - (let* ((base-file-name - (cl-letf* ((default-directory my/unnamed-autosave-location) - ((symbol-function #'make-temp-file) (lambda (arg &rest _args) arg))) - (make-auto-save-file-name))) - (file-name-list - (cl-sort (mapcar - (lambda (file) - (cons file - (nth 5 (file-attributes file)))) - (file-expand-wildcards (concat base-file-name "*"))) - #'> - :key (lambda (file) - (float-time (cdr file))))) - (file (if (and (boundp 'my/last-restored-buffer) - (ignore-errors - (string= (car my/last-restored-buffer) - (buffer-name)))) - (catch 'found-autosave - (dolist (file file-name-list) - (cl-destructuring-bind - (_file-name . modification-time) file - (when (< (float-time modification-time) - (cdr my/last-restored-buffer)) - (setcdr my/last-restored-buffer - (float-time modification-time)) - (throw 'found-autosave file)))) - (setq my/last-restored-buffer nil) - (user-error "No older autosave... Wrapping around.")) - (defvar my/last-restored-buffer) - (setq my/last-restored-buffer - (cons (buffer-name) - (float-time (cdar file-name-list)))) - (car file-name-list)))) - (cl-destructuring-bind (file-name . modification-time) file - (widen) - (erase-buffer) - (goto-char (point-min)) - (insert-file-contents file-name) - (message "File: %s (%s)" - (replace-regexp-in-string (regexp-quote base-file-name) - "" - file-name) - (format-time-string "%r %D" modification-time))))))) - -(defun my/save-buffer-maybe () + (if buffer-file-name + (apply old-fun args) + (let* ((base-file-name + (cl-letf* ((default-directory my/unnamed-autosave-location) + ((symbol-function #'make-temp-file) (lambda (arg &rest _args) arg))) + (make-auto-save-file-name))) + (file-name-list + (cl-sort (mapcar + (lambda (file) + (cons file + (nth 5 (file-attributes file)))) + (file-expand-wildcards (concat base-file-name "*"))) + #'> + :key (lambda (file) + (float-time (cdr file))))) + (file (if (and (boundp 'my/last-restored-buffer) + (ignore-errors + (string= (car my/last-restored-buffer) + (buffer-name)))) + (catch 'found-autosave + (dolist (file file-name-list) + (cl-destructuring-bind + (_file-name . modification-time) file + (when (< (float-time modification-time) + (cdr my/last-restored-buffer)) + (setcdr my/last-restored-buffer + (float-time modification-time)) + (throw 'found-autosave file)))) + (setq my/last-restored-buffer nil) + (user-error "No older autosave... Wrapping around.")) + (defvar my/last-restored-buffer) + (setq my/last-restored-buffer + (cons (buffer-name) + (float-time (cdar file-name-list)))) + (car file-name-list)))) + (cl-destructuring-bind (file-name . modification-time) file + (widen) + (erase-buffer) + (goto-char (point-min)) + (insert-file-contents file-name) + (message "File: %s (%s)" + (replace-regexp-in-string (regexp-quote base-file-name) + "" + file-name) + (format-time-string "%r %D" modification-time)))))) + + +(defun quark/save-buffer-maybe () (when (and buffer-file-name (buffer-modified-p) (with-demoted-errors "%s" @@ -88,10 +86,8 @@ when `auto-save-mode' is invoked manually.") ;; automatically save buffers associated with files on buffer switch ;; and on windows switch -(advice-add - 'switch-to-buffer :before - (my/defun-as-value nadvice/save-buffer-maybe (&rest _args) - (my/save-buffer-maybe))) +(define-advice switch-to-buffer (:before (&rest _args) auto-save) + (quark/save-buffer-maybe)) ;; save backups too (setq version-control t ;; Use version numbers for backups @@ -109,13 +105,13 @@ when `auto-save-mode' is invoked manually.") (add-hook 'before-save-hook - (my/defun-as-value my/force-backup-of-buffer () + (my/defun-as-value quark/force-backup-of-buffer () (setq buffer-backed-up nil))) ;; save buffers on blur (add-hook 'focus-out-hook - (my/defun-as-value my/save-buffers-on-focus-out () + (my/defun-as-value quark/save-buffers-on-focus-out () (let ((inhibit-message t)) (save-some-buffers t)))) @@ -148,19 +144,17 @@ when `auto-save-mode' is invoked manually.") :config (setq real-auto-save-interval 0.3) - (advice-add - 'real-auto-save-start-timer :override - (my/defun-as-value nadvice/real-auto-save-start-timer () - "Start real-auto-save-timer." - (setq real-auto-save-timer - (run-with-idle-timer real-auto-save-interval - t - 'real-auto-save-buffers)))) - - (advice-add - 'real-auto-save-buffers :around - (my/defun-as-value nadvice/real-auto-save-buffers (old-fun &rest args) - (cl-letf* (((symbol-function #'real-auto-save-restart-timer) #'ignore)) - (apply old-fun args))))) + (define-advice real-auto-save-start-timer + (:override () use-idle-timer) + "Start real-auto-save-timer." + (setq real-auto-save-timer + (run-with-idle-timer real-auto-save-interval + t + 'real-auto-save-buffers))) + + (define-advice real-auto-save-buffers + (:around (old-fun &rest args) skip-timer-restart) + (cl-letf* (((symbol-function #'real-auto-save-restart-timer) #'ignore)) + (apply old-fun args)))) (provide 'config-safety) diff --git a/modules/config-smartparens.el b/modules/config-smartparens.el index 04361d89..ef0631cf 100644 --- a/modules/config-smartparens.el +++ b/modules/config-smartparens.el @@ -395,7 +395,8 @@ has been created." (show-paren-mode +1))) :config - (defun nadvice/show-paren-mode (old-fun &rest args) + (define-advice show-paren-mode + (:around (old-fun &rest args) use-idle-timer) ;; http://emacs.stackexchange.com/questions/12532/buffer-local-idle-timer (cl-letf* ((old-run-with-idle-timer (symbol-function #'run-with-idle-timer)) ((symbol-function #'run-with-idle-timer) @@ -412,8 +413,6 @@ has been created." (cancel-timer ,timer))))) (fset fns fn) timer))))) - (apply old-fun args))) - - (advice-add 'show-paren-mode :around #'nadvice/show-paren-mode)) + (apply old-fun args)))) (provide 'config-smartparens) diff --git a/modules/config-solarized.el b/modules/config-solarized.el index 2d700e45..5f067062 100644 --- a/modules/config-solarized.el +++ b/modules/config-solarized.el @@ -2,13 +2,14 @@ (eval-when-compile (require 'config-macros)) (use-package solarized-theme) -(advice-add - 'load-theme :around - (my/defun-as-value nadvice/load-theme (old-fun &rest args) - ;; TODO: This is probably a horrible hack - (mapc #'disable-theme custom-enabled-themes) - (apply old-fun args) - (run-hooks 'load-theme-hook))) +(define-advice load-theme + (:before (&rest _args) unload-themes) + ;; TODO: This is probably a horrible hack + (mapc #'disable-theme custom-enabled-themes)) + +(define-advice load-theme + (:after (&rest _args) run-hook) + (run-hooks 'load-theme-hook)) (add-hook 'load-theme-hook diff --git a/modules/config-tex.el b/modules/config-tex.el index 6de029bd..1dab1307 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -111,13 +111,12 @@ ;; in the PATH, however for some reason on macOS the required ;; directories are only added to exec-path and not PATH, so we ;; correct this here. - (advice-add - 'TeX-run-command :around - (my/defun-as-value my/TeX-run-command/add-exec-path (old-fun &rest args) - (let ((process-environment process-environment)) + (define-advice TeX-run-command + (:around (old-fun &rest args) add-exec-path) + (let ((process-environment process-environment)) (setenv "PATH" (concat "$PATH" (string-join exec-path path-separator)) t) - (apply old-fun args))))) + (apply old-fun args)))) (defun my/LaTeX-format-name () (save-excursion @@ -274,34 +273,31 @@ matching string." :config (setq auctex-latexmk-inherit-TeX-PDF-mode t)) - (advice-add - 'TeX-command-master :around - (my/defun-as-value nadvice/TeX-command-master (old-fun arg) - (interactive "P") - (if (called-interactively-p 'any) - (if (consp arg) - (call-interactively old-fun) - (cl-letf* (((symbol-function #'TeX-command-query) - (lambda (name) - (TeX-command-default name) - (car-safe (TeX-assoc "LatexMk" TeX-command-list))))) - (call-interactively old-fun))) - (apply old-fun args)))) - - (advice-add - 'TeX-source-correlate-sync-source :after - (my/defun-as-value nadvice/TeX-source-correlate-sync-source (&rest args) - (recenter) - (require 'pulse) - (pulse-momentary-highlight-one-line (point)))) - - (advice-add - 'LaTeX-math-insert :around - (my/defun-as-value nadvice/LaTeX-math-insert (old-fun string dollar) - (let ((TeX-insert-braces nil)) - (if (texmathp) - (funcall old-fun string dollar) - (funcall old-fun string (not dollar)))))) + (define-advice TeX-command-master + (:around (old-fun arg) default-latexmk) + (interactive "P") + (if (called-interactively-p 'any) + (if (consp arg) + (call-interactively old-fun) + (cl-letf* (((symbol-function #'TeX-command-query) + (lambda (name) + (TeX-command-default name) + (car-safe (TeX-assoc "LatexMk" TeX-command-list))))) + (call-interactively old-fun))) + (apply old-fun args))) + + (define-advice TeX-source-correlate-sync-source + (:after (&rest args) do-pulse) + (recenter) + (require 'pulse) + (pulse-momentary-highlight-one-line (point))) + + (define-advice LaTeX-math-insert + (:around (old-fun string dollar) auto-dollar) + (let ((TeX-insert-braces nil)) + (if (texmathp) + (funcall old-fun string dollar) + (funcall old-fun string (not dollar))))) (add-hook 'TeX-after-insert-macro-hook diff --git a/modules/config-tramp.el b/modules/config-tramp.el index c40a4998..b6581a24 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -46,10 +46,10 @@ (tramp-copy-keep-tmpfile t) (tramp-copy-recursive t))) - (advice-add 'tramp-read-passwd :around - (my/defun-as-value my/tramp-disable-auth-sources (old-fun &rest args) - (let ((auth-sources)) - (apply old-fun args)))) + (define-advice tramp-read-passwd + (:around (old-fun &rest args) disable-auth-sources ) + (let ((auth-sources)) + (apply old-fun args))) (setq tramp-backup-directory-alist `((,(rx (zero-or-more anything)) . ,my/tramp-backup-directory)))) @@ -68,17 +68,16 @@ "quark-emacs-nonexistent-host"))))) (string-match-p (rx bol "controlmaster auto" eol) config))))) - (advice-add - 'tramp-do-copy-or-rename-file-directly :filter-args - (my/defun-as-value nadvice/tramp-no-preserve-uid-gid-msdos (args) - (cl-destructuring-bind - (op filename newname ok-if-already-exists keep-date preserve-uid-gid) - args - (list op filename newname ok-if-already-exists keep-date - (unless (my/msdos-fs (if (tramp-tramp-file-p newname) - (file-remote-p newname 'localname) - newname)) - preserve-uid-gid)))))) + (define-advice tramp-do-copy-or-rename-file-directly + (:filter-args (args) no-preserve-uid-gid-msdos ) + (cl-destructuring-bind + (op filename newname ok-if-already-exists keep-date preserve-uid-gid) + args + (list op filename newname ok-if-already-exists keep-date + (unless (my/msdos-fs (if (tramp-tramp-file-p newname) + (file-remote-p newname 'localname) + newname)) + preserve-uid-gid))))) ;; ================================= ;; automatically request root access diff --git a/modules/config-ui.el b/modules/config-ui.el index ba6014b4..3c033bc6 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -274,10 +274,9 @@ (defvar my/iflipb-first nil) - (advice-add - 'iflipb-first-iflipb-buffer-switch-command :override - (my/defun-as-value nadvice/iflipb-first-iflipb-buffer-switch-command (&rest _args) - my/iflipb-first))) + (define-advice iflipb-first-iflipb-buffer-switch-command + (:override (&rest _args) return-my/iflipb-first) + my/iflipb-first)) ;; also allow undo/redo on window configs (add-hook 'window-configuration-change-hook #'winner-mode) @@ -330,14 +329,13 @@ :inverse-video nil :foreground nil) - (advice-add - 'whitespace-trailing-regexp :override - (my/defun-as-value nadvice/whitespace-trailing-regexp (limit) - "Match all trailing spaces. This overloads the definition in whitespace.el." - (let ((status t)) - (while (unless (re-search-forward whitespace-trailing-regexp limit t) - (setq status nil))) ;; end of buffer - status)))) + (define-advice whitespace-trailing-regexp + (:override (limit) match-all) + "Match all trailing spaces. This overloads the definition in whitespace.el." + (let ((status t)) + (while (unless (re-search-forward whitespace-trailing-regexp limit t) + (setq status nil))) ;; end of buffer + status))) ;; ============ ;; Line numbers diff --git a/modules/config-undo.el b/modules/config-undo.el index 5c31d9d0..2f65e802 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -63,46 +63,41 @@ ;; compress undo with xz (cond ((executable-find "zstd") - (advice-add - 'undo-tree-make-history-save-file-name :filter-return - (my/defun-as-value nadvice/undo-tree/zstd-compress (ret) - (concat ret ".zst")))) + (define-advice undo-tree-make-history-save-file-name + (:filter-return (ret) zstd-compress) + (concat ret ".zst"))) ((executable-find "gzip") - (advice-add - 'undo-tree-make-history-save-file-name :filter-return - (my/defun-as-value nadvice/undo-tree/gzip-compress (ret) - (concat ret ".gz"))))) - - (advice-add - 'undo-list-transfer-to-tree :around - (my/defun-as-value nadvice/undo-tree-ignore-text-properties (old-fun &rest args) - (dolist (item buffer-undo-list) - (and (consp item) - (stringp (car item)) - (setcar item (substring-no-properties (car item))))) - (apply old-fun args))) - - (advice-add - 'undo-tree-load-history :around - (my/defun-as-value nadvice/undo-tree-load-history/quiet (old-fun &rest args) - (let ((inhibit-message t) - (jka-compr-verbose)) - (apply old-fun args)))) - - (advice-add - 'undo-tree-save-history :around - (my/defun-as-value nadvice/undo-tree-save-history/quiet (old-fun &rest args) - (cl-letf* ((jka-compr-verbose nil) - (old-write-region (symbol-function #'write-region)) - ((symbol-function #'write-region) - (lambda (start end filename &optional append _visit &rest args) - (apply old-write-region - start - end - filename - append - 0 - args)))) - (apply old-fun args))))) + (define-advice undo-tree-make-history-save-file-name + (:filter-return (ret) gzip-compress) + (concat ret ".gz")))) + + (define-advice undo-list-transfer-to-tree + (:around (old-fun &rest args) ignore-text-properties) + (dolist (item buffer-undo-list) + (and (consp item) + (stringp (car item)) + (setcar item (substring-no-properties (car item))))) + (apply old-fun args)) + + (define-advice undo-tree-load-history + (:around (old-fun &rest args) inhibit-message) + (let ((inhibit-message t) + (jka-compr-verbose)) + (apply old-fun args))) + + (define-advice undo-tree-save-history + (:around (old-fun &rest args) inhibit-message) + (cl-letf* ((jka-compr-verbose) + (old-write-region (symbol-function #'write-region)) + ((symbol-function #'write-region) + (lambda (start end filename &optional append _visit &rest args) + (apply old-write-region + start + end + filename + append + 0 + args)))) + (apply old-fun args)))) (provide 'config-undo) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 201385fd..1c0cf95e 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -127,10 +127,9 @@ (add-hook 'with-editor-mode-hook #'evil-insert-state) (add-hook 'with-editor-mode-hook #'jit-lock-fontify-now) - (advice-add - 'magit-revert-buffers :after - (my/defun-as-value nadvice/magit-revert-buffers (&rest _args) - (run-with-timer 1 nil #'message ""))) + (define-advice magit-revert-buffers + (:after (&rest _args) clear-echo-area) + (run-with-timer 1 nil #'message "")) ;; If there is only one stash, operate on it immediately (el-patch-defun magit-read-stash (prompt) @@ -551,11 +550,10 @@ Otherwise behave as if called interactively. (projectile-mode +1) :config - (advice-add - 'projectile-cleanup-known-projects :around - (my/defun-as-value nadvice/projectile-cleanup-known-projects/silence (orig-func &rest args) - (let ((inhibit-message t)) - (apply orig-func args)))) + (define-advice projectile-cleanup-known-projects + (:around (orig-func &rest args) inhibit-message) + (let ((inhibit-message t)) + (apply orig-func args))) (setq projectile-known-projects-file (locate-user-emacs-file "data/.projectile-bookmarks.eld") @@ -596,11 +594,10 @@ Otherwise behave as if called interactively. (add-hook 'ediff-quit-hook restore-window-configuration 'append) (add-hook 'ediff-suspend-hook restore-window-configuration 'append)) - (advice-add - 'ediff-setup-keymap :after - (my/defun-as-value nadvice/ediff-setup-keymap (&rest _args) - (define-key ediff-mode-map "j" #'ediff-next-difference) - (define-key ediff-mode-map "k" #'ediff-previous-difference))) + (define-advice ediff-setup-keymap + (:after (&rest _args) vi-keys) + (define-key ediff-mode-map "j" #'ediff-next-difference) + (define-key ediff-mode-map "k" #'ediff-previous-difference)) ;; don't start another frame (setq ediff-window-setup-function #'ediff-setup-windows-plain)) From 9ca7ea08d3623ad1903d4ff57dd2cf44fa354af7 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Feb 2021 21:56:50 -0800 Subject: [PATCH 178/303] Use helm-source-files-in-current-dir in helm omni --- modules/config-helm.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 79bd52cb..04bd61c3 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -398,7 +398,8 @@ (if projectile-root (append '(helm-source-projectile-recentf-list - helm-source-non-projectile-recentf-list) + helm-source-non-projectile-recentf-list + helm-source-files-in-current-dir) (unless slow-fs '(helm-source-projectile-files-list))) '(helm-source-recentf From c8da66a46679c328f2828a601a4d32069dd81ef4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Feb 2021 21:57:13 -0800 Subject: [PATCH 179/303] Use locate instead of find in helm omni --- modules/config-helm.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 04bd61c3..55f337f9 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -422,10 +422,10 @@ '(helm-source-do-ag))))) ;; file location, of which projectile is a faster subset - (unless projectile-root - '(helm-source-findutils)) + ;; (unless projectile-root + ;; '(helm-source-findutils)) - ;; '(helm-source-locate) + '(helm-source-locate) ))) :fuzzy-match t From ad0d30b77e7872e2b00e7c2278040572d7d99d57 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Feb 2021 21:57:30 -0800 Subject: [PATCH 180/303] Steal tty initialization hack from doom --- modules/config-core.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/config-core.el b/modules/config-core.el index c76827aa..a121f98a 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -330,4 +330,11 @@ response as a no." (message "%s" result) (kill-new result))) +(unless (daemonp) + (advice-add #'tty-run-terminal-initialization :override #'ignore) + (add-hook 'window-setup-hook + (my/defun-as-value my/tty-run-terminal-initialization () + (advice-remove #'tty-run-terminal-initialization #'ignore) + (tty-run-terminal-initialization (selected-frame) nil t)))) + (provide 'config-core) From 48bb94e651b937aba42fe7c1f65a141da77f0064 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 15:03:45 -0800 Subject: [PATCH 181/303] Remove helm-gtags --- modules/config-helm.el | 60 ------------------------------------------ 1 file changed, 60 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 55f337f9..d71fc998 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -494,66 +494,6 @@ (global-set-key (kbd "C-S-p") #'helm-locate) (global-set-key (kbd "M-P") #'helm-locate) -(use-package helm-gtags - :defer-install t - :commands (helm-gtags-clear-all-cache - helm-gtags-clear-cache - helm-gtags-next-history - helm-gtags-previous-history - helm-gtags-select - helm-gtags-select-path - helm-gtags-tags-in-this-function - helm-gtags-create-tags - helm-gtags-delete-tags - helm-gtags-find-tag - helm-gtags-find-tag-other-window - helm-gtags-find-rtag - helm-gtags-find-symbol - helm-gtags-find-pattern - helm-gtags-find-files - helm-gtags-find-tag-from-here - helm-gtags-dwim - helm-gtags-parse-file - helm-gtags-pop-stack - helm-gtags-show-stack - helm-gtags-clear-stack - helm-gtags-clear-all-stacks - helm-gtags-update-tags - helm-gtags-resume - helm-gtags-mode) - - :init - ;; Unfortunately, this must be declared at toplevel. - (setq helm-gtags-fuzzy-match t) - - :config - (require 'el-patch) - (setq helm-gtags-auto-update t - helm-gtags-ignore-case t - helm-gtags-direct-helm-completing t) - - (el-patch-feature helm-gtags) - (el-patch-defun helm-gtags--read-tagname (type &optional default-tagname) - (let ((tagname (helm-gtags--token-at-point type)) - (prompt (assoc-default type helm-gtags--prompt-alist)) - (comp-func (assoc-default type helm-gtags-comp-func-alist))) - (if (and tagname helm-gtags-use-input-at-cursor) - tagname - (when (and (not tagname) default-tagname) - (setq tagname default-tagname)) - (when tagname - (setq prompt (format "%s(default \"%s\") " prompt tagname))) - (let ((completion-ignore-case helm-gtags-ignore-case) - (completing-read-function 'completing-read-default)) - (if (and helm-gtags-direct-helm-completing (memq type '(tag rtag symbol find-file))) - (helm-comp-read prompt comp-func - (el-patch-remove :history 'helm-gtags--completing-history) - :exec-when-only-one t - (el-patch-add :fuzzy t) - :default tagname) - (completing-read prompt comp-func nil nil nil - 'helm-gtags--completing-history tagname))))))) - (use-package helm-systemd :defer-install t :commands (helm-systemd)) From 5bffa5a6aa7a81b86e1e4a43f8645d5ee941cada Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 15:04:36 -0800 Subject: [PATCH 182/303] Remove old helm-locate bindings --- modules/config-helm.el | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index d71fc998..e56b2742 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -478,8 +478,7 @@ (global-set-key (kbd "C-x C-b") #'helm-buffers-list) (global-set-key (kbd "C-x C-f") #'helm-find-files) -(use-package evil - :config +(with-eval-after-load 'evil (define-advice evil-paste-pop (:around (old-fun &rest args) maybe-helm-omni) (if (memq last-command '(evil-paste-after @@ -491,9 +490,6 @@ (define-key evil-insert-state-map (kbd "C-p") #'my/helm-interfile-omni) (define-key evil-motion-state-map (kbd "C-p") #'my/helm-interfile-omni)) -(global-set-key (kbd "C-S-p") #'helm-locate) -(global-set-key (kbd "M-P") #'helm-locate) - (use-package helm-systemd :defer-install t :commands (helm-systemd)) From babbfcae867b86a2ec0c1662e515cd4949b55b9b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 15:05:15 -0800 Subject: [PATCH 183/303] Bind mouse-8/9 to iflipb-previous/next-buffer --- modules/config-ui.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-ui.el b/modules/config-ui.el index 3c033bc6..0d4dea34 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -259,6 +259,9 @@ (global-set-key (kbd "C-c ") #'iflipb-previous-buffer-smart) (global-set-key (kbd "C-c ") #'iflipb-previous-buffer-smart) + (global-set-key (kbd "") #'iflipb-previous-buffer) + (global-set-key (kbd "") #'iflipb-next-buffer) + :config (setq iflipb-ignore-buffers (list (rx line-start " ") (rx line-start "*helm") From ef562c53a11907f65bb8a5b4a313772d5bb9c589 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 17:20:24 -0800 Subject: [PATCH 184/303] Remove terrible kill-ring reordering hack --- modules/config-paste.el | 76 ----------------------------------------- 1 file changed, 76 deletions(-) diff --git a/modules/config-paste.el b/modules/config-paste.el index 02dfcac9..0a69d697 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -8,82 +8,6 @@ (use-package evil) (require 'evil))) -;; Bring most recently yank-popped entry to the front of the kill-ring - -(defvar kill-ring-yank-index 0 - "Index into kill-ring of last yank-pop. The item yank-popped - will be at the head of the kill ring, but if the next command - is also yank-pop, it will be returned here first before this - variable is incremented.") - -(el-patch-defun current-kill (n &optional do-not-move) - "Rotate the yanking point by N places, and then return that kill. -If N is zero and `interprogram-paste-function' is set to a -function that returns a string or a list of strings, and if that -function doesn't return nil, then that string (or list) is added -to the front of the kill ring and the string (or first string in -the list) is returned as the latest kill. - -If N is not zero, and if `yank-pop-change-selection' is -non-nil, use `interprogram-cut-function' to transfer the -kill at the new yank point into the window system selection. - -If optional arg DO-NOT-MOVE is non-nil, then don't actually -move the yanking point; just return the Nth kill forward." - (el-patch-add (require 'dash)) - (let ((interprogram-paste (and (= n 0) - interprogram-paste-function - (funcall interprogram-paste-function)))) - (if interprogram-paste - (progn - ;; Disable the interprogram cut function when we add the new - ;; text to the kill ring, so Emacs doesn't try to own the - ;; selection, with identical text. - ;; Also disable the interprogram paste function, so that - ;; `kill-new' doesn't call it repeatedly. - (let ((interprogram-cut-function nil) - (interprogram-paste-function nil)) - (if (listp interprogram-paste) - ;; Use `reverse' to avoid modifying external data. - (mapc #'kill-new (reverse interprogram-paste)) - (kill-new interprogram-paste))) - (el-patch-add (setq kill-ring-yank-index 0)) - (car kill-ring)) - (or kill-ring (error "Kill ring is empty")) - (el-patch-add - ;; Put the head of kill-ring back where we had - ;; previously found it, and fetch the next element - (if (or (eq 0 n) (eq this-command 'evil-visual-paste)) - (setq kill-ring-yank-index 0) - (setq kill-ring - (-insert-at kill-ring-yank-index - (car kill-ring) - (cdr kill-ring)) - kill-ring-yank-index n) - (when (>= kill-ring-yank-index (- (length kill-ring) 1)) - (setq kill-ring-yank-index (- (length kill-ring) 1)) - (user-error "Reached end of kill-ring")) - (when (< kill-ring-yank-index 0) - (setq kill-ring-yank-index 0) - (user-error "Reached beginning of kill-ring")) - (setq kill-ring (let ((new (nth kill-ring-yank-index - kill-ring))) - (cons new (-remove-at kill-ring-yank-index - kill-ring)))))) - (let ((ARGth-kill-element - (el-patch-swap - (nthcdr (mod (- n (length kill-ring-yank-pointer)) - (length kill-ring)) - kill-ring) - kill-ring))) - (unless do-not-move - (setq kill-ring-yank-pointer ARGth-kill-element) - (when (and yank-pop-change-selection - (> n 0) - interprogram-cut-function) - (funcall interprogram-cut-function (car ARGth-kill-element)))) - (car ARGth-kill-element))))) - (use-package xclip :config (define-advice xclip-set-selection From 95c574462a9ebd4d9c7fa400afe0d3ecdd4b0f51 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 17:41:40 -0800 Subject: [PATCH 185/303] Don't save immediate duplicates to the kill ring --- modules/config-paste.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-paste.el b/modules/config-paste.el index 0a69d697..924aed82 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -8,6 +8,8 @@ (use-package evil) (require 'evil))) +(setq kill-do-not-save-duplicates t) + (use-package xclip :config (define-advice xclip-set-selection From 1871dca604f5324543b604752e9d3f7333c0d622 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 15 Feb 2021 17:42:21 -0800 Subject: [PATCH 186/303] Remove unused whitespace normalization function --- modules/config-whitespace.el | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index c718f782..6eb2a23f 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -3,6 +3,8 @@ (eval-when-compile (with-demoted-errors "Load error: %s" + (use-package evil) + (require 'evil) (require 'smie))) (setq require-final-newline t @@ -169,12 +171,6 @@ extra indent = 2 (interactive) (set-buffer-file-coding-system 'utf-8))) -(defun cleanup-buffer-unsafe () - (interactive) - (untabify (point-min) (point-max)) - (delete-trailing-whitespace) - (set-buffer-file-coding-system 'utf-8)) - (use-package ws-butler :diminish (ws-butler-mode ." β") :init @@ -206,10 +202,6 @@ extra indent = 2 (let ((smie-config--buffer-local nil)) (smie-config-guess))))) -(eval-when-compile - (with-demoted-errors "Load error: %s" - (require 'evil))) - (defun back-to-indentation-visual-or-beginning (&optional n) (interactive "^p") (or n (setq n 1)) From f8b18518a5c550d96ee5bf7afb1b4cccfedd3fbc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 19 Feb 2021 13:21:35 -0800 Subject: [PATCH 187/303] Disable rainbow-delimiters when magic-latex-buffer is enabled --- modules/config-tex.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-tex.el b/modules/config-tex.el index 1dab1307..47783119 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -211,6 +211,8 @@ command." (set-face-attribute 'ml/huge nil :height 1.35) (set-face-attribute 'ml/hhuge nil :height 1.4) + (add-hook 'magic-latex-buffer-hook #'rainbow-delimiters-mode-disable) + (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) "Like `search-regexp' but skips escaped chars, comments and verbish environments. This function raise an error on From f7a8b57d21a8db0af378c9c098f5ff2ab21c09f8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 23 Feb 2021 14:30:59 -0800 Subject: [PATCH 188/303] Enable inotify for auto-revert-mode on remote files --- modules/config-safety.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-safety.el b/modules/config-safety.el index c2367150..30363be6 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -128,6 +128,8 @@ when `auto-save-mode' is invoked manually.") (setq global-auto-revert-non-file-buffers t auto-revert-remote-files t + auto-revert-notify-exclude-dir-regexp + (rx bol "/" (or "afs" "media" "mnt" "net" "tmp_mnt") "/") auto-revert-verbose nil auto-revert-mode-text nil)) From dc2748a0d2a06ca793fe365a1853bfb72cfb375e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 25 Feb 2021 16:28:59 -0800 Subject: [PATCH 189/303] Default to markdown-mode in Atomic Chrome buffers --- modules/config-desktop.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 431110eb..e722bdb0 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -509,6 +509,8 @@ Write data into the file specified by `recentf-save-file'." :commands (atomic-chrome-start-server atomic-chrome-stop-server) :init + (setq atomic-chrome-default-major-mode 'markdown-mode) + (when (display-graphic-p) (my/onetime-setup atomic-chrome :hook 'focus-out-hook From a8133349214f02f8f9d7965dd39fc0baface9e70 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 8 Mar 2021 21:40:10 -0800 Subject: [PATCH 190/303] Replace real-auto-save-mode with quark-flysave-mode, closes #141 --- modules/config-safety.el | 57 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/modules/config-safety.el b/modules/config-safety.el index 30363be6..1f3cee50 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -140,23 +140,44 @@ when `auto-save-mode' is invoked manually.") (with-eval-after-load 'evil (evil-set-initial-state 'backup-walker-mode 'motion))) -(use-package real-auto-save - :defer-install t - :commands (real-auto-save-mode) - :config - (setq real-auto-save-interval 0.3) - - (define-advice real-auto-save-start-timer - (:override () use-idle-timer) - "Start real-auto-save-timer." - (setq real-auto-save-timer - (run-with-idle-timer real-auto-save-interval - t - 'real-auto-save-buffers))) - - (define-advice real-auto-save-buffers - (:around (old-fun &rest args) skip-timer-restart) - (cl-letf* (((symbol-function #'real-auto-save-restart-timer) #'ignore)) - (apply old-fun args)))) +(defvar quark-flysave--interval 0.3) +(defvar quark-flysave--timer 0.1) +(defvar quark-flysave--ticks nil) +(defvar quark-flysave--buffer-list nil) + +(defun quark-flysave--save-buffers (&rest _args) + (save-current-buffer + (dolist (buf quark-flysave--buffer-list) + (if (and (buffer-live-p buf) (buffer-file-name buf)) + (with-current-buffer buf + (when (and (buffer-modified-p) + (not (equal (gethash (current-buffer) quark-flysave--ticks) + (buffer-modified-tick)))) + (let ((message-log-max nil)) + (with-temp-message (or (current-message) "") + (basic-save-buffer-1)) + (set-buffer-modified-p t) + (puthash (current-buffer) (buffer-modified-tick) quark-flysave--ticks)))) + (setq quark-flysave--buffer-list + (delq buf quark-flysave--buffer-list)))))) + +(define-minor-mode quark-flysave-mode + "Save your buffers on an idle timer." + :lighter " flysave" + :keymap nil + (if quark-flysave-mode + (progn + (setq quark-flysave--timer + (run-with-idle-timer quark-flysave--interval + t + 'quark-flysave--save-buffers)) + (unless quark-flysave--ticks + (setq quark-flysave--ticks (make-hash-table :test #'equal))) + (push (current-buffer) quark-flysave--buffer-list)) + (setq quark-flysave--buffer-list + (delq (current-buffer) quark-flysave--buffer-list)) + (unless quark-flysave--buffer-list + (cancel-timer quark-flysave--timer) + (setq quark-flysave--ticks nil)))) (provide 'config-safety) From fd4542ef7e125e9d7bed494c0b578aa88c50b84c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 9 Mar 2021 13:06:40 -0800 Subject: [PATCH 191/303] Add a garbage collection strategy similar to gcmh, closes #139 --- modules/config-core.el | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/modules/config-core.el b/modules/config-core.el index a121f98a..fa539a9b 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -337,4 +337,66 @@ response as a no." (advice-remove #'tty-run-terminal-initialization #'ignore) (tty-run-terminal-initialization (selected-frame) nil t)))) +(defvar quark/max-gc-time 0) +(defvar quark/last-gc-time 0.05) +(defvar quark/garbage-collect-verbose nil) +(defvar quark/high-gc-cons-threshold (eval-when-compile (* 1024 1024 16))) +(defvar quark/low-gc-cons-threshold (eval-when-compile (* 1024 1024))) +(defvar quark/gc-timer1-delay 2) +(defvar quark/gc-timer2-delay 5) +(defvar quark/gc-timer1 nil) +(defvar quark/gc-timer2 nil) + +(defmacro quark/time (&rest body) + `(let ((time (current-time))) ,@body (float-time (time-since time)))) + +(defun quark/garbage-collect () + (unless (active-minibuffer-window) + (if quark/garbage-collect-verbose + (progn + (message "Garbage collecting...") + (condition-case-unless-debug err + (message "Garbage collecting...done (%.3fs)" + (setq quark/last-gc-time (quark/time (garbage-collect)))) + (error (message "Garbage collecting...failed") + (signal (car err) (cdr err))))) + (setq quark/last-gc-time (quark/time (garbage-collect)))) + (when (> quark/last-gc-time quark/max-gc-time) + (setq quark/max-gc-time quark/last-gc-time)) + quark/last-gc-time)) + +(defun quark/set-high-gc-cons-threshold () + (setq gc-cons-threshold quark/high-gc-cons-threshold)) + +(defun quark/set-low-gc-cons-threshold () + (unless (active-minibuffer-window) + (setq gc-cons-threshold quark/low-gc-cons-threshold))) + +(define-minor-mode quark-gc-mode + "Quark mode for intelligent garbage collection" + :global t + (if quark-gc-mode + (progn + (add-hook 'pre-command-hook #'quark/set-high-gc-cons-threshold) + (add-hook 'focus-out-hook #'quark/garbage-collect) + (add-hook 'minibuffer-exit-hook #'quark/garbage-collect) + (setq quark/gc-timer1 + (run-with-idle-timer quark/gc-timer1-delay + t + #'quark/garbage-collect) + quark/gc-timer2 + (run-with-idle-timer quark/gc-timer2-delay + t + #'quark/set-low-gc-cons-threshold))) + (remove-hook 'pre-command-hook #'quark/set-high-gc-cons-threshold) + (remove-hook 'focus-out-hook #'quark/garbage-collect) + (remove-hook 'minibuffer-exit-hook #'quark/garbage-collect) + (when quark/gc-timer1 + (cancel-timer quark/gc-timer1)) + (when quark/gc-timer2 + (cancel-timer quark/gc-timer2)) + (setq gc-cons-threshold quark/high-gc-cons-threshold))) + +(quark-gc-mode +1) + (provide 'config-core) From 49900f21d87911995474a4c86273150ca11641db Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 12 Mar 2021 14:42:03 -0800 Subject: [PATCH 192/303] Remove company-lsp --- modules/config-c.el | 23 ----------------------- modules/config-company.el | 3 --- modules/config-modes.el | 2 -- modules/config-tex.el | 12 ------------ 4 files changed, 40 deletions(-) diff --git a/modules/config-c.el b/modules/config-c.el index a6804e52..1788826f 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -48,29 +48,6 @@ :after flycheck :config (flycheck-clang-analyzer-setup)) - (eval-and-compile - (cl-macrolet - ((company-define-specific-modes - (mode) - `(progn - (add-hook ,mode - (lambda () - (require 'company) - (require 'cl-lib) - (let ((old-backends company-backends)) - (set (make-local-variable 'company-backends) - '((company-lsp - company-yasnippet - company-files) - (company-dabbrev-code) - company-dabbrev)))))))) - (with-no-warnings - (my/generate-calls-single - 'company-define-specific-modes - '('c++-mode-hook - 'objc-mode-hook - 'c-mode-hook))))) - (cl-macrolet ((my/setup-cc-mode (mode hook) diff --git a/modules/config-company.el b/modules/config-company.el index 6d1601c7..38cc4f9d 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -34,14 +34,11 @@ '(('arduino-mode-hook '(company-irony)) ('cmake-mode-hook '(company-cmake)) ('css-mode-hook '(company-css)) - ('java-mode-hook '(company-lsp)) ('nxml-mode-hook '(company-nxml)) ('html-mode-hook '(company-web-html)) ('lua-mode-hook '(company-lua)) ('web-mode-hook '(company-web-html)) ('scheme-mode-hook '(geiser-company-backend)) - ('texinfo-mode-hook '(company-semantic)) - ('python-mode-hook '(company-lsp)) ('text-mode-hook '(company-ispell)) ('go-mode-hook '(company-go))))))) diff --git a/modules/config-modes.el b/modules/config-modes.el index e75e1718..071b265b 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1485,8 +1485,6 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (when (memq window-system '(mac ns)) (setq lsp-ui-doc-use-childframe nil)))) -(use-package company-lsp :commands company-lsp) - (my/require-config-module 'config-tex) (my/require-config-module 'config-c) (my/require-config-module 'config-python) diff --git a/modules/config-tex.el b/modules/config-tex.el index 47783119..81145fc7 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -238,18 +238,6 @@ matching string." (add-hook 'TeX-mode-hook #'lsp-deferred) - (add-hook - 'TeX-mode-hook - (my/defun-as-value my/setup-tex-mode-company-backends () - (let ((old-backends company-backends)) - (set (make-local-variable 'company-backends) - (append (list (append - '(company-lsp - company-dabbrev) - (cdar old-backends))) - '((company-ispell)) - (cdr old-backends)))))) - (use-package evil :config (use-package evil-tex From 3b80f37cdb34b45e5c14abf63c0413793a41224c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Mar 2021 21:22:04 -0800 Subject: [PATCH 193/303] Enable company-box --- modules/config-company.el | 7 +++++++ modules/config-package.el | 1 + 2 files changed, 8 insertions(+) diff --git a/modules/config-company.el b/modules/config-company.el index 38cc4f9d..dce15402 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -42,6 +42,13 @@ ('text-mode-hook '(company-ispell)) ('go-mode-hook '(company-go))))))) + (use-package company-box + :init + (add-hook 'company-mode-hook #'company-box-mode) + :config + (diminish 'company-box-mode) + (setq company-box-enable-icon nil)) + :config (diminish 'company-mode (if (display-graphic-p) " ❃" " *")) (company-flx-mode +1) diff --git a/modules/config-package.el b/modules/config-package.el index 8b368f7b..ded62304 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -167,6 +167,7 @@ (idle-job-add-require 'yasnippet) (idle-job-add-require 'company) +(idle-job-add-require 'company-box) (idle-job-add-require 'undo-tree) (idle-job-add-require 'multiple-cursors) From 67d2eb203d9020f7e091488aaff9da785572bea5 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 13 Mar 2021 22:56:42 -0800 Subject: [PATCH 194/303] Don't use company-box on mac or ns window systems --- modules/config-company.el | 13 +++++++------ modules/config-package.el | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index dce15402..b15a7a7e 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -42,12 +42,13 @@ ('text-mode-hook '(company-ispell)) ('go-mode-hook '(company-go))))))) - (use-package company-box - :init - (add-hook 'company-mode-hook #'company-box-mode) - :config - (diminish 'company-box-mode) - (setq company-box-enable-icon nil)) + (unless (memq window-system '(mac ns)) + (use-package company-box + :init + (add-hook 'company-mode-hook #'company-box-mode) + :config + (diminish 'company-box-mode) + (setq company-box-enable-icon nil))) :config (diminish 'company-mode (if (display-graphic-p) " ❃" " *")) diff --git a/modules/config-package.el b/modules/config-package.el index ded62304..18659ddd 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -167,7 +167,8 @@ (idle-job-add-require 'yasnippet) (idle-job-add-require 'company) -(idle-job-add-require 'company-box) +(unless (memq window-system '(mac ns)) + (idle-job-add-require 'company-box)) (idle-job-add-require 'undo-tree) (idle-job-add-require 'multiple-cursors) From 9445a5982adb6f278c44b691f4ed180493e22009 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 21 Mar 2021 18:55:13 -0700 Subject: [PATCH 195/303] Add a better TeX input method, closes #140 --- modules/config-tex.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/config-tex.el b/modules/config-tex.el index 81145fc7..f7639fb8 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -578,4 +578,28 @@ outer indentation in case of a commented line. The symbols TeX-brace-indent-level) (t 0)))))))) +(use-package math-symbol-lists + :init + (add-to-list 'input-method-alist '("math" "UTF-8" quail-use-package "Σ" nil)) + (with-eval-after-load 'quail + (eval-when-compile (require 'quail)) + (require 'math-symbol-lists) + (quail-define-package "math" "UTF-8" "Σ" t) + (quail-define-rules + ("\\CC" "ℂ") + ("\\EE" "𝔼") + ("\\NN" "ℕ") + ("\\PP" "ℙ") + ("\\QQ" "ℚ") + ("\\RR" "ℝ") + ("\\ZZ" "ℤ")) + (mapc (lambda (x) + (if (cddr x) + (quail-defrule (cadr x) (caddr x)))) + (nreverse (append math-symbol-list-superscripts + math-symbol-list-subscripts + math-symbol-list-packages + math-symbol-list-extended + math-symbol-list-basic))))) + (provide 'config-tex) From c7a5855c22dede3c7777ae1c97baf94aa279977a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 10 Apr 2021 23:31:50 -0700 Subject: [PATCH 196/303] Replace multiple-cursors with evil-mc --- data/.mc-lists.el | 3 ++ modules/config-package.el | 17 ++++--- modules/config-ui.el | 93 +++++++++++++++++++++++++++++++++++---- 3 files changed, 96 insertions(+), 17 deletions(-) diff --git a/data/.mc-lists.el b/data/.mc-lists.el index 58c12254..e0361ae3 100644 --- a/data/.mc-lists.el +++ b/data/.mc-lists.el @@ -34,6 +34,7 @@ evil-next-visual-line evil-previous-line evil-previous-visual-line + evil-undo haskell-indentation-common-electric-command indent-for-tab-command julia-latexsub-or-indent @@ -48,6 +49,7 @@ sp-forward-slurp-sexp sp-kill-sexp sp-remove-active-pair-overlay + whole-line-or-region-kill-region )) (setq mc/cmds-to-run-once @@ -65,4 +67,5 @@ haskell-process-load-file hydra/projectile-tools/body keyboard-quit + lsp-ui-doc--handle-mouse-movement )) diff --git a/modules/config-package.el b/modules/config-package.el index 18659ddd..b1a2b38c 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -171,15 +171,14 @@ (idle-job-add-require 'company-box)) (idle-job-add-require 'undo-tree) -(idle-job-add-require 'multiple-cursors) -(idle-job-add-require 'mc-hide-unmatched-lines-mode) -(idle-job-add-require 'mc-separate-operations) -(idle-job-add-require 'rectangular-region-mode) -(idle-job-add-require 'mc-mark-pop) -(idle-job-add-require 'mc-mark-more) -(idle-job-add-require 'mc-cycle-cursors) -(idle-job-add-require 'mc-edit-lines) -(idle-job-add-require 'multiple-cursors-core) +(idle-job-add-require 'evil-mc) +(idle-job-add-require 'evil-mc-command-execute) +(idle-job-add-require 'evil-mc-command-record) +(idle-job-add-require 'evil-mc-cursor-make) +(idle-job-add-require 'evil-mc-cursor-state) +(idle-job-add-require 'evil-mc-undo) +(idle-job-add-require 'evil-mc-vars) +(idle-job-add-require 'evil-mc-common) (idle-job-add-require 'ace-jump-helm-line) (idle-job-add-require 'avy) diff --git a/modules/config-ui.el b/modules/config-ui.el index 0d4dea34..4b4791e4 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -87,14 +87,91 @@ (define-key mc/keymap (kbd "") nil) (define-key mc/keymap (kbd "C-c ") 'multiple-cursors-mode)) -(global-set-key (kbd "C-c l") #'mc/edit-lines) -(global-set-key (kbd "C-c a") #'mc/mark-all-dwim) -(global-set-key (kbd "C->") #'mc/mark-next-like-this) -(global-set-key (kbd "C-<") #'mc/mark-previous-like-this) -(global-set-key (kbd "C-?") #'mc/mark-all-dwim) -(global-set-key (kbd "C-c >") #'mc/mark-next-like-this) -(global-set-key (kbd "C-c <") #'mc/mark-previous-like-this) -(global-set-key (kbd "C-c ?") #'mc/mark-all-dwim) +(use-package evil-mc + :commands (evil-mc-make-all-cursors + evil-mc-undo-last-added-cursor + evil-mc-undo-all-cursors + evil-mc-pause-cursors + evil-mc-resume-cursors + evil-mc-make-and-goto-first-cursor + evil-mc-make-and-goto-last-cursor + evil-mc-make-cursor-here + evil-mc-make-cursor-move-next-line + evil-mc-make-cursor-move-prev-line + evil-mc-skip-and-goto-next-cursor + evil-mc-skip-and-goto-prev-cursor + evil-mc-skip-and-goto-next-match + evil-mc-skip-and-goto-prev-match + evil-mc-make-cursor-in-visual-selection-beg + evil-mc-make-cursor-in-visual-selection-end) + :init + (el-patch-feature evil-mc) + + (el-patch-defvar evil-mc-cursors-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "m") #'evil-mc-make-all-cursors) + (define-key map (kbd "u") #'evil-mc-undo-last-added-cursor) + (define-key map (kbd "q") #'evil-mc-undo-all-cursors) + (define-key map (kbd "s") #'evil-mc-pause-cursors) + (define-key map (kbd "r") #'evil-mc-resume-cursors) + (define-key map (kbd "f") #'evil-mc-make-and-goto-first-cursor) + (define-key map (kbd "l") #'evil-mc-make-and-goto-last-cursor) + (define-key map (kbd "h") #'evil-mc-make-cursor-here) + (define-key map (kbd "j") #'evil-mc-make-cursor-move-next-line) + (define-key map (kbd "k") #'evil-mc-make-cursor-move-prev-line) + (define-key map (kbd "N") #'evil-mc-skip-and-goto-next-cursor) + (define-key map (kbd "P") #'evil-mc-skip-and-goto-prev-cursor) + (define-key map (kbd "n") #'evil-mc-skip-and-goto-next-match) + (define-key map (kbd "p") #'evil-mc-skip-and-goto-prev-match) + (define-key map (kbd "I") #'evil-mc-make-cursor-in-visual-selection-beg) + (define-key map (kbd "A") #'evil-mc-make-cursor-in-visual-selection-end) + map)) + + (el-patch-defvar evil-mc-key-map + (let ((map (make-sparse-keymap))) + (evil-define-key* '(normal visual) map + (kbd "gr") evil-mc-cursors-map + (el-patch-remove + (kbd "M-n") 'evil-mc-make-and-goto-next-cursor + (kbd "M-p") 'evil-mc-make-and-goto-prev-cursor + (kbd "C-n") 'evil-mc-make-and-goto-next-match + (kbd "C-t") 'evil-mc-skip-and-goto-next-match + (kbd "C-p") 'evil-mc-make-and-goto-prev-match)) + map)) + + (global-set-key (kbd "C->") #'evil-mc-make-cursor-move-next-line) + (global-set-key (kbd "C-<") #'evil-mc-make-cursor-move-prev-line) + (define-key evil-normal-state-map (kbd "gr") evil-mc-cursors-map) + + :config + (global-evil-mc-mode +1) + + (setq evil-mc-custom-known-commands + '((evil-delete-backward-word-smart + . + ((:default . evil-mc-execute-default-call))) + (end-of-visual-line-or-end + . + ((:default . evil-mc-execute-default-call))) + (back-to-indentation-visual-or-beginning + . + ((:default . evil-mc-execute-default-call)))) + evil-mc-mode-line + `(:eval + (if (> (length evil-mc-cursor-list) 0) + (evil-mc-active-mode-line (concat " " evil-mc-mode-line-prefix)) + ""))) + + (el-patch-defun evil-mc-make-cursor-move-by-line (dir count) + "Create COUNT cursors one for each line moving in the direction DIR. +DIR should be 1 or -1 and COUNT should be a positive integer or nil." + (evil-force-normal-state) + (setq count (max 0 (or count 1))) + (dotimes (i count) + (evil-mc-run-cursors-before) + (evil-mc-make-cursor-at-pos (point)) + (let ((line-move-visual (el-patch-swap t nil))) + (evil-line-move dir))))) ;; directional window movement (if (display-graphic-p) From 999bcf89fb2abf480fc736f611d85560043da3a1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 11 Apr 2021 00:07:45 -0700 Subject: [PATCH 197/303] Minor incremental loading tweaks --- modules/config-package.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index b1a2b38c..bbf9e6f2 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -132,6 +132,7 @@ (idle-job-add-require 'magit-wip) (idle-job-add-require 'magit-log) (idle-job-add-require 'magit-diff) +(idle-job-add-require 'smerge-mode) (idle-job-add-require 'magit-core) (idle-job-add-require 'magit-autorevert) (idle-job-add-require 'magit-margin) @@ -166,9 +167,11 @@ (idle-job-add-function #'my/yas-init) (idle-job-add-require 'yasnippet) -(idle-job-add-require 'company) (unless (memq window-system '(mac ns)) - (idle-job-add-require 'company-box)) + (idle-job-add-require 'company-box) + (idle-job-add-require 'company-box-doc) + (idle-job-add-require 'company-box-icons)) +(idle-job-add-require 'company) (idle-job-add-require 'undo-tree) (idle-job-add-require 'evil-mc) @@ -225,6 +228,7 @@ (idle-job-add-require 'helm-info) (idle-job-add-require 'helm-files) +(idle-job-add-require 'filenotify) (idle-job-add-require 'helm-buffers) (idle-job-add-require 'helm-occur) (idle-job-add-require 'helm-tags) From 59b5fc0d801549b8d035687c9239b81ffe7ca8cc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Apr 2021 15:23:41 -0700 Subject: [PATCH 198/303] Add apheleia --- modules/config-modes.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 071b265b..1ddf3154 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -653,6 +653,9 @@ Returns the symbol." :defer-install t :commands (impatient-mode)) +(use-package apheleia + :recipe (apheleia :host github :repo "raxod502/apheleia")) + ;; ============================================================================= ;; Dired ======================================================================= ;; ============================================================================= From e5c2c321e94ad3c9df150d1e399cfad7d4533b4b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 14 Apr 2021 00:03:56 -0700 Subject: [PATCH 199/303] Disable lsp header-line by default --- modules/config-modes.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 1ddf3154..81ff5bda 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1453,7 +1453,8 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (require 'yasnippet) (setq lsp-prefer-flymake nil lsp-auto-guess-root t - lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1"))) + lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1")) + lsp-headerline-breadcrumb-enable nil) (defun my/lsp-before-initialize/stall-for-remote-connections () (when (lsp--client-remote? From 8bbb75fb85dc3fa2663708246c6d7268521b9b6e Mon Sep 17 00:00:00 2001 From: Jonathan Hayase Date: Mon, 26 Apr 2021 15:14:42 -0700 Subject: [PATCH 200/303] Update README.md --- README.md | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 82c64dd3..aea092e0 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,25 @@ -emacs-config -============ +Quark Emacs +=========== My personal Emacs config! *Featuring:* * *A lot of weird stuff you might not see in other configs.* - * [`vim` emulation](https://bitbucket.org/lyro/evil/wiki/Home) including custom textobjects, motions, and operators. - * Extensive version tracking backup system, even for buffers that do not visit files. + * Text editing built around `vim` emulation (using [evil](https://bitbucket.org/lyro/evil/wiki/Home)) including many custom textobjects, motions, and operators. + * Comprehensive version tracking backup system, even for buffers that do not visit files. * Persistence of: - * File locations * File major modes - * Registers - * Minibuffer histories - * Kill ring - * Jump list + * File locations (thanks to saveplace) + * Registers, minibuffer histories, kill ring, jump list (thanks to savehist) + * Undo history (thanks to [undo-tree](https://elpa.gnu.org/packages/undo-tree.html)) * Widespread [`flx`](https://github.com/lewang/flx) integration: * [Helm](https://github.com/emacs-helm/helm) (fuzzy file finder, goto definition, etc.) * [Company](https://github.com/company-mode/company-mode) (code autocomplete) - * [Icicles](https://www.emacswiki.org/emacs/Icicles) (minibuffer completion) * [Ivy](https://github.com/abo-abo/swiper) (minibuffer completion) * [Isearch](https://github.com/PythonNut/flx-isearch/) - * Extremely aggressive file lazy loading, and fast startup times (~0.3s). - * Partly thanks to [`straight.el`](https://github.com/raxod502/straight.el)! + * Extremely aggressive file lazy loading, and fast startup times (~0.4s). + * Made much easier by [`straight.el`](https://github.com/raxod502/straight.el)! * Packages are incrementally loaded during idle time immediately after init. By the time you open a file, most major packages will already have been loaded, but you won't notice the delay! * An emphasis on correct code and robustness without the need for explicit configuration. @@ -32,10 +29,10 @@ Portability =========== This config should be pretty portable, as long as your OS is UNIX-y. -I currently run it on various Arch Linux, Fedora, and Ubuntu builds, as well as Raspberry Pis, Android phones, and WSL. +I currently run it on various Arch Linux, Fedora, macOS, as well as Android phones and Windows Subsystem for Linux. One thing that it does _not_ support is older versions of Emacs. -Right now, the minimum version is 25.1. +Right now, the minimum version is 27.1. Supported Languages =================== @@ -45,6 +42,4 @@ I actively work in the following languages: * Elisp (of course) * LaTeX * Python - * C/C++ - * JS(X)/HTML/CSS - * Octave + * Julia From c58f0301fe3a0d8a3d416fc0c9f5c2a02a7426d8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 14 May 2021 00:07:36 -0700 Subject: [PATCH 201/303] Run file manager asynchronously --- modules/config-intel.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-intel.el b/modules/config-intel.el index 99040940..f4e05509 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -535,7 +535,7 @@ is binary, activate `hexl-mode'." (let ((dir (my/file-name-first-existing-parent (expand-file-name default-directory)))) (cond ((executable-find "nautilus") - (call-process "nautilus" nil nil nil dir))))) + (call-process "nautilus" nil 0 nil dir))))) (defun pdf-print-buffer-with-faces (&optional filename) "Print file in the current buffer as pdf, including font, color, and From 7a37a49e4237b5b051432cb07f6d2a892807303d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 May 2021 13:42:59 -0700 Subject: [PATCH 202/303] Enable quark-flysave-mode in LaTeX buffers --- modules/config-tex.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-tex.el b/modules/config-tex.el index f7639fb8..662cc4aa 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -237,6 +237,7 @@ matching string." (ml/search-regexp regex bound backward point-safe))))) (add-hook 'TeX-mode-hook #'lsp-deferred) + (add-hook 'TeX-mode-hook #'quark-flysave-mode) (use-package evil :config From 48b078b0ef553517e37b4f88e4ef6e2afee0508b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 May 2021 17:16:00 -0700 Subject: [PATCH 203/303] Defer install of lsp-haskell --- modules/config-modes.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 81ff5bda..5981998b 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -473,6 +473,7 @@ Returns the symbol." (add-to-list 'completion-ignored-extensions ".hi")) (use-package lsp-haskell + :defer-install t :config (lsp-register-client (make-lsp--client @@ -498,7 +499,6 @@ Returns the symbol." :defer-install t :commands (alex-mode) :init - (provide 'common) (defmacro defparameter (var &optional value doc) From 7c04d9990446fb21237f8f382400b90bdd80a5c2 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 May 2021 17:17:04 -0700 Subject: [PATCH 204/303] Add a command to run sshlatex on the current buffer --- modules/config-tex.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 662cc4aa..56bf9d84 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -305,7 +305,13 @@ matching string." "{${}}" (substring-no-properties (buffer-substring beg end))) beg - end)))))) + end))))) + + (defun sshlatex (host) + (interactive (list + (read-string (format "host (localhost): ") + nil nil "localhost"))) + (compile (concat "sshlatex " host " " buffer-file-name)))) (with-eval-after-load 'latex (setq TeX-electric-math (cons "\\\(" "\\\)")) From 873caefa21493eb19665b049b3f70b961052ef86 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 17 Jun 2021 14:25:45 -0700 Subject: [PATCH 205/303] Avoid cyclic macroexpansion error in with-editor --- modules/config-modes.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 5981998b..28ff25a6 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -867,7 +867,6 @@ Returns the symbol." (el-patch-feature term) :config - (require 'with-editor) (add-hook 'term-exec-hook 'with-editor-export-editor) (define-advice term-sentinel From 011b714ed62449c7bc0253b9f0b88970aa9e33ca Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 26 Jun 2021 13:29:22 -0700 Subject: [PATCH 206/303] Simplify su.el lazy load --- modules/config-tramp.el | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index b6581a24..a024f754 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -107,16 +107,6 @@ :type 'boolean :group 'su) - (el-patch-defcustom su-enable-helm-integration t - "Enable integration with helm" - :type 'boolean - :group 'su) - - (el-patch-defcustom su-enable-semantic-integration t - "Enable integration with semantic" - :type 'boolean - :group 'su) - (autoload #'su--nadvice-make-directory-auto-root "su") (autoload #'su--nadvice-find-file-noselect "su") (autoload #'su--nadvice-supress-find-file-hook "su") @@ -164,6 +154,7 @@ (su-mode +1) (with-eval-after-load 'helm-files + (require 'su) (su-helm-integration-mode +1)) (with-eval-after-load 'semantic/fw (require 'su) From f5233dbb6811ebf2fb96ec239f0937040541a685 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 30 Jun 2021 01:30:32 -0700 Subject: [PATCH 207/303] Update to company-box fork, see sebastiencs/company-box#152 --- modules/config-company.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-company.el b/modules/config-company.el index b15a7a7e..2d564ee6 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -44,6 +44,7 @@ (unless (memq window-system '(mac ns)) (use-package company-box + :recipe (company-box :repo "basil-conto/company-box" :branch "blc/dash") :init (add-hook 'company-mode-hook #'company-box-mode) :config From 080f58123f05defa547554d455da21ef41aa7d96 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jul 2021 14:42:18 -0700 Subject: [PATCH 208/303] Fix suppression of compression messages for undo-history --- modules/config-undo.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-undo.el b/modules/config-undo.el index 2f65e802..2d0d23f2 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -87,7 +87,7 @@ (define-advice undo-tree-save-history (:around (old-fun &rest args) inhibit-message) - (cl-letf* ((jka-compr-verbose) + (cl-letf* ((jka-compr-verbose nil) (old-write-region (symbol-function #'write-region)) ((symbol-function #'write-region) (lambda (start end filename &optional append _visit &rest args) From c40bca7b2b051e1a316b0d754002c126543b8861 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jul 2021 14:52:57 -0700 Subject: [PATCH 209/303] Remove helm-flx-historian --- modules/config-helm.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index e56b2742..7d3660fc 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -5,15 +5,11 @@ :config (setq helm-flx-for-helm-locate t)) -(use-package helm-flx-historian - :recipe (helm-flx-historian :type git :host github :repo "PythonNut/historian.el")) - (use-package ace-jump-helm-line) (use-package helm :config (helm-flx-mode +1) - (helm-flx-historian-mode +1) ;; swap C-z (i.e. accept-and-complete) with tab (i.e. select action) (define-key helm-map (kbd "") #'helm-execute-persistent-action) From 19229822342562786ee3d6ce5e6078ada6438aee Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jul 2021 17:59:34 -0700 Subject: [PATCH 210/303] Revert "Update to company-box fork", since upstream has updated This reverts commit f5233dbb6811ebf2fb96ec239f0937040541a685. --- modules/config-company.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-company.el b/modules/config-company.el index 2d564ee6..b15a7a7e 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -44,7 +44,6 @@ (unless (memq window-system '(mac ns)) (use-package company-box - :recipe (company-box :repo "basil-conto/company-box" :branch "blc/dash") :init (add-hook 'company-mode-hook #'company-box-mode) :config From f06cd343a345f440d720fa4b251947a445f6b32f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jul 2021 18:05:32 -0700 Subject: [PATCH 211/303] Update which-key description replacement config --- modules/config-ui.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index 4b4791e4..90cb228d 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -443,12 +443,12 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." (setq which-key-sort-order nil which-key-side-window-max-height 0.33) - (add-to-list 'which-key-description-replacement-alist - `(,(rx "evil-" - (or "a" "an" "inner") - "-" - (group (zero-or-more not-newline))) - . "\\1"))) + (add-to-list 'which-key-replacement-alist + `((nil . ,(rx "evil-" + (or "a" "an" "inner") + "-" + (group (zero-or-more not-newline)))) + . (nil . "\\1")))) ;; add intelligent buffer renaming (defun rename-current-buffer-file () From b494ce748bb309fd52d6cfd823ba0aeeab876b54 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 11:58:18 -0700 Subject: [PATCH 212/303] Switch from python-language-server to python-lsp-server --- modules/config-python.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 4eb77b84..7030bf71 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -269,14 +269,14 @@ directory" (make-lsp-client :new-connection (lsp-stdio-connection - (my/defun-as-value my/python-find-poetry-pyls () + (my/defun-as-value my/python-find-poetry-pylsp () (let ((pyls-path (expand-file-name - "bin/pyls" + "bin/pylsp" (my/python-find-virtualenv-cached)))) (when (file-executable-p pyls-path) pyls-path)))) :major-modes '(python-mode) - :server-id 'pyls-poetry + :server-id 'pylsp-poetry :library-folders-fn (lambda (_workspace) lsp-clients-python-library-directories) @@ -289,16 +289,16 @@ directory" (make-lsp-client :new-connection (lsp-tramp-connection - (my/defun-as-value my/python-find-remote-pyls () + (my/defun-as-value my/python-find-remote-pylsp () (let ((pyls-path (expand-file-name - "bin/pyls" + "bin/pylsp" (my/python-find-virtualenv-cached)))) (when (file-executable-p pyls-path) (my/tramp-localname pyls-path))))) :major-modes '(python-mode) :remote? t :priority -3 - :server-id 'pyls-remote + :server-id 'pylsp-remote :library-folders-fn (lambda (_workspace) lsp-clients-python-library-directories) From 55b7c35c02c921a02ec53a16bafef50fae3a66c1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 11:59:56 -0700 Subject: [PATCH 213/303] Give python-lsp-server priority over mspyls --- modules/config-python.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 7030bf71..8ae43182 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -135,7 +135,7 @@ Return either a string or nil." :major-modes (append '(python-mode) lsp-python-ms-extra-major-modes) :remote? t :server-id 'mspyls-remote - :priority -2 + :priority -3 :initialization-options 'lsp-python-ms--extra-init-params :notification-handlers (lsp-ht ("python/languageServerStarted" @@ -297,7 +297,7 @@ directory" (my/tramp-localname pyls-path))))) :major-modes '(python-mode) :remote? t - :priority -3 + :priority -2 :server-id 'pylsp-remote :library-folders-fn (lambda (_workspace) From a57e91059bdce6c9dfc969a75a7a1631c0c1d2ff Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 12:25:14 -0700 Subject: [PATCH 214/303] Add TRAMP support for julia-lsp --- modules/config-modes.el | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 28ff25a6..9dec3e8e 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -352,7 +352,55 @@ Returns the symbol." (car (last (file-expand-wildcards (expand-file-name "~/.julia/environments/v*"))))) (require 'lsp-julia) - (add-hook 'julia-mode-hook #'lsp-deferred)) + (add-hook 'julia-mode-hook #'lsp-deferred) + + (defun lsp-julia--get-root-remote () + "Get the (Julia) project root directory of the current file over TRAMP." + (concat "\"" + (tramp-file-name-localname + (tramp-dissect-file-name + (expand-file-name + (or (locate-dominating-file default-directory "Project.toml") + (locate-dominating-file default-directory "JuliaProject.toml") + (my/tramp-build-name-from-localname + (car (last (file-expand-wildcards + (expand-file-name "~/.julia/environments/v*"))))))))) + "\"")) + + (defun lsp-julia--symbol-server-store-path-to-jl-no-expand () + "Convert the variable `lsp-julia-symbol-server-store-path' to a + string or \"nothing\" if `nil'" + (if lsp-julia-symbol-server-store-path + (let ((sssp lsp-julia-symbol-server-store-path)) + (make-directory sssp t) + (concat "\"" sssp "\"")) + "nothing")) + + (defun lsp-julia--rls-command-remote () + "The command to lauch the Julia Language Server." + `(,lsp-julia-command + ,@lsp-julia-flags + ,(concat "-e " + "'" + "import Pkg; Pkg.instantiate(); " + "using InteractiveUtils, Sockets, SymbolServer, LanguageServer; " + "Union{Int64, String}(x::String) = x; " + "server = LanguageServer.LanguageServerInstance(" + "stdin, stdout, " + (lsp-julia--get-root-remote) ", " + (lsp-julia--get-depot-path) ", " + "nothing, " + (lsp-julia--symbol-server-store-path-to-jl-no-expand) "); " + "run(server);" + "'"))) + + (lsp-register-client + (make-lsp-client :new-connection (lsp-tramp-connection 'lsp-julia--rls-command-remote) + :major-modes '(julia-mode ess-julia-mode) + :server-id 'julia-ls-remote + :remote? t + :multi-root t + :priority -1))) (use-package evil :config From 6e2783d9a2415af5f3b75ff050292789bd735968 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 12:28:11 -0700 Subject: [PATCH 215/303] Remove lsp-server-present? patch now that lsp-mode has been fixed --- modules/config-modes.el | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 9dec3e8e..06910342 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1511,22 +1511,6 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (add-hook 'lsp-before-initialize-hook #'my/lsp-before-initialize/stall-for-remote-connections) - (el-patch-defun lsp-server-present? (final-command) - "Check whether FINAL-COMMAND is present." - ;; executable-find only gained support for remote checks after 27 release - (or (and (cond - ((not (file-remote-p default-directory)) - (executable-find (cl-first final-command))) - ((version<= "27.0" emacs-version) - (el-patch-wrap 2 - (or - (file-executable-p (my/tramp-build-name-from-localname (cl-first final-command))) - (with-no-warnings (executable-find (cl-first final-command) (file-remote-p default-directory)))))) - (t)) - (prog1 t - (lsp-log "Command \"%s\" is present on the path." (s-join " " final-command)))) - (ignore (lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command))))) - (use-package lsp-ui :commands lsp-ui-mode :init From 8deba35c8e8809a905695f37696938d6954317bf Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 19:12:21 -0700 Subject: [PATCH 216/303] Defer vterm install --- modules/config-modes.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 06910342..0a2e3395 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1110,6 +1110,8 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (global-set-key (kbd "") #'my/popup-ansi-term) (use-package vterm + :commands (vterm) + :defer-install t :config (evil-set-initial-state 'vterm-mode 'emacs) (set-face-foreground 'vterm-color-black "#586e75")) From 5b40534a69dd1af6409ed60f016a1a74f06f5ae2 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 19:15:14 -0700 Subject: [PATCH 217/303] Don't invoke LaTeX-environment-or-macro after a backslash --- modules/config-tex.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 56bf9d84..d5de600a 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -406,7 +406,10 @@ matching string." (define-key TeX-mode-map (kbd ";") `(menu-item "" LaTeX-environment-or-macro - :filter ,(lambda (cmd) (unless (my/LaTeX-verbatimish-p) cmd)))) + :filter ,(lambda (cmd) + (unless (or (my/LaTeX-verbatimish-p) + (looking-back (rx "\\"))) + cmd)))) (el-patch-defun LaTeX-indent-calculate (&optional force-type) "Return the indentation of a line of LaTeX source. From 3ef4593f6a0dd0d39bb216f524e6b2bfb33a1c1b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 19:15:34 -0700 Subject: [PATCH 218/303] Treat algorithm2e as verbatimish, but see #147 --- modules/config-tex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index d5de600a..fb7df38e 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -328,7 +328,8 @@ matching string." "lstlisting" "minted" "verbatim" - "algorithm") + "algorithm" + "algorithm2e") eol) (LaTeX-current-environment)))) From fb771de2aef8d0bf1a05406b88ef375c3379b073 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 21 Jul 2021 19:16:26 -0700 Subject: [PATCH 219/303] Move lsp-ui config out of lsp-mode config --- modules/config-modes.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 0a2e3395..42af0c81 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1493,7 +1493,6 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" ;;; LSP (use-package lsp-mode - ;; :hook (python-mode . lsp-deferred) :commands (lsp-mode) :config (eval-when-compile @@ -1511,16 +1510,17 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (sit-for 0.1))) (add-hook 'lsp-before-initialize-hook - #'my/lsp-before-initialize/stall-for-remote-connections) + #'my/lsp-before-initialize/stall-for-remote-connections)) - (use-package lsp-ui - :commands lsp-ui-mode - :init - (add-hook 'lsp-mode-hook 'lsp-ui-mode) - (setq lsp-ui-doc-position 'top) +(use-package lsp-ui + :commands lsp-ui-mode + :init + (add-hook 'lsp-mode-hook 'lsp-ui-mode) + :config + (setq lsp-ui-doc-position 'top) - (when (memq window-system '(mac ns)) - (setq lsp-ui-doc-use-childframe nil)))) + (when (memq window-system '(mac ns)) + (setq lsp-ui-doc-use-childframe nil))) (my/require-config-module 'config-tex) (my/require-config-module 'config-c) From 47b73fc7fc58afe11c20916025574f9fce9092d4 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 9 Nov 2021 02:46:45 -0800 Subject: [PATCH 220/303] Disable pydocstyle in pylsp by default --- modules/config-python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index 8ae43182..b4b58acb 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -126,7 +126,7 @@ Return either a string or nil." (with-demoted-errors "Load error: %s" (require 'lsp) (require 'el-patch))) - + (setq lsp-pylsp-plugins-pydocstyle-enabled nil) (lsp-register-client (make-lsp-client :new-connection (lsp-tramp-connection From 1c9039806ffe8c9eda4401fee8c64e9d59456ac7 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 9 Nov 2021 02:47:24 -0800 Subject: [PATCH 221/303] Replace git(attributes|config|ignore)-mode with git-modes --- modules/config-modes.el | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 42af0c81..2b1dfd30 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1170,27 +1170,19 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" :defer-install t :commands (pacfiles pacfiles-start)) -(use-package gitattributes-mode +(use-package git-modes :defer-install t - :commands (gitattributes-mode) + :commands (gitattributes-mode gitconfig-mode gitignore-mode) :mode (("/\\.gitattributes\\'" . gitattributes-mode) ("/\\.git/info/attributes\\'" . gitattributes-mode) - ("/git/attributes\\'" . gitattributes-mode))) - -(use-package gitconfig-mode - :defer-install t - :commands (gitconfig-mode) - :mode (("/\\.gitconfig\\'" . gitconfig-mode) - ("/\\.git/config\\'" . gitconfig-mode) - ("/git/config\\'" . gitconfig-mode) - ("/\\.gitmodules\\'" . gitconfig-mode))) - -(use-package gitignore-mode - :defer-install t - :commands (gitignore-mode) - :mode (("/\\.gitignore\\'" . gitignore-mode) - ("/\\.git/info/exclude\\'" . gitignore-mode) - ("/git/ignore\\'" . gitignore-mode))) + ("/git/attributes\\'" . gitattributes-mode) + ("/\\.gitconfig\\'" . gitconfig-mode) + ("/\\.git/config\\'" . gitconfig-mode) + ("/git/config\\'" . gitconfig-mode) + ("/\\.gitmodules\\'" . gitconfig-mode) + ("/\\.gitignore\\'" . gitignore-mode) + ("/\\.git/info/exclude\\'" . gitignore-mode) + ("/git/ignore\\'" . gitignore-mode))) (use-package ssh-config-mode :defer-install t From 56d75ea0f7980bc4f04ae8113181bc9a1325107e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 25 Nov 2021 23:59:38 -0800 Subject: [PATCH 222/303] Support native-comp, fixes #149 --- init.el | 5 +- modules/config-avy-easymotion.el | 4 +- modules/config-c.el | 4 +- modules/config-company.el | 4 +- modules/config-desktop.el | 4 +- modules/config-evil-modules.el | 1 + modules/config-evil-textobjects.el | 1 + modules/config-evil.el | 4 +- modules/config-helm.el | 4 +- modules/config-intel.el | 4 +- modules/config-ivy.el | 4 +- modules/config-modes.el | 6 +- modules/config-package.el | 341 +++++++++++++++-------------- modules/config-paste.el | 4 +- modules/config-python.el | 3 +- modules/config-safety.el | 4 +- modules/config-smartparens.el | 7 +- modules/config-solarized.el | 5 +- modules/config-tex.el | 4 +- modules/config-tramp.el | 4 +- modules/config-ui.el | 4 +- modules/config-undo.el | 4 +- modules/config-vcs.el | 4 +- modules/config-whitespace.el | 4 +- 24 files changed, 243 insertions(+), 190 deletions(-) diff --git a/init.el b/init.el index 6ff78c68..f67b8a04 100644 --- a/init.el +++ b/init.el @@ -85,7 +85,8 @@ (defun my/maybe-byte-compile-init-el () (let ((init-elc (concat (file-name-sans-extension user-init-file) ".elc"))) - (when (file-newer-than-file-p user-init-file init-elc) + (when (and (file-newer-than-file-p user-init-file init-elc) + (not (equal (file-name-extension user-init-file) "eln")))) (byte-compile-file user-init-file) (when (and (fboundp 'restart-emacs) (y-or-n-p (format "%s was newer than %s. Restart?" @@ -127,4 +128,4 @@ (my/require-config-module 'config-modes) (message "[===============] solarized") (my/require-config-module 'config-solarized) - (message "[===============] done"))) + (message "[===============] done")) diff --git a/modules/config-avy-easymotion.el b/modules/config-avy-easymotion.el index 87fb56b0..e48a94b9 100644 --- a/modules/config-avy-easymotion.el +++ b/modules/config-avy-easymotion.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package avy :init diff --git a/modules/config-c.el b/modules/config-c.el index 1788826f..fc563aa2 100644 --- a/modules/config-c.el +++ b/modules/config-c.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) ;; ============================================================================= ;; C-like ====================================================================== diff --git a/modules/config-company.el b/modules/config-company.el index b15a7a7e..1a04e272 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (require 'cl-lib) (use-package company diff --git a/modules/config-desktop.el b/modules/config-desktop.el index e722bdb0..9d83d1e3 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (require 'cl-lib) (setq history-length 100 diff --git a/modules/config-evil-modules.el b/modules/config-evil-modules.el index 1e261067..2125f4d8 100644 --- a/modules/config-evil-modules.el +++ b/modules/config-evil-modules.el @@ -1,6 +1,7 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros) + (require 'config-package) (use-package evil)) (require 'evil) diff --git a/modules/config-evil-textobjects.el b/modules/config-evil-textobjects.el index 81686e29..460c03b9 100644 --- a/modules/config-evil-textobjects.el +++ b/modules/config-evil-textobjects.el @@ -1,6 +1,7 @@ ;; -*- lexical-binding: t -*- (require 'cl-lib) (eval-when-compile + (require 'config-package) (use-package evil) (require 'evil)) diff --git a/modules/config-evil.el b/modules/config-evil.el index 2b05135a..e42b4e78 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package key-chord :init diff --git a/modules/config-helm.el b/modules/config-helm.el index 7d3660fc..f146ba28 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package helm-flx :config diff --git a/modules/config-intel.el b/modules/config-intel.el index f4e05509..f9b58265 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (require 'cl-lib) (my/require-config-module 'config-tramp) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index fc427471..f253b824 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (setq resize-mini-windows t diff --git a/modules/config-modes.el b/modules/config-modes.el index 2b1dfd30..774de9a2 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1,7 +1,9 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (require 'cl-lib) -(require 'config-package) + (eval-when-compile (with-demoted-errors "Load error: %s" diff --git a/modules/config-package.el b/modules/config-package.el index bbf9e6f2..373546b1 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -6,24 +6,181 @@ ;; Setup straight.el ;; ============================================= -(setq straight-repository-branch "develop" - straight-check-for-modifications 'live - straight-use-package-version 'ensure - straight-use-package-by-default t - straight-recipes-gnu-elpa-use-mirror t) - -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) +(eval-and-compile + (setq straight-repository-branch "develop" + straight-check-for-modifications 'live + straight-use-package-version 'ensure + straight-use-package-by-default t + straight-recipes-gnu-elpa-use-mirror t) + + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (unless (featurep 'straight) + (load bootstrap-file nil 'nomessage)))) + +;; ============================================= +;; Setup use-package +;; ============================================= + +(eval-and-compile + (straight-use-package '(use-package + :type git + :host github + :repo "raxod502/use-package")) + + (straight-use-package '(el-patch + :type git + :host github + :repo "raxod502/el-patch"))) + +(eval-when-compile (require 'el-patch)) + +(eval-and-compile + (setq el-patch-use-aggressive-defvar t) + (defvar el-patch--patches (make-hash-table)) + + (with-eval-after-load 'el-patch + (el-patch-deftype evil-define-command + :classify el-patch-classify-function + :locate el-patch-locate-function + :declare ((doc-string 3) + (indent defun))) + (el-patch-deftype evil-define-motion + :classify el-patch-classify-function + :locate el-patch-locate-function + :declare ((doc-string 3) + (indent defun))) + (el-patch-deftype evil-define-text-object + :classify el-patch-classify-function + :locate el-patch-locate-function + :declare ((doc-string 3) + (indent defun))) + (el-patch-deftype evil-define-operator + :classify el-patch-classify-function + :locate el-patch-locate-function + :declare ((doc-string 3) + (indent defun)))) + + (el-patch-feature use-package) + + (with-eval-after-load 'use-package + (setq use-package-always-ensure t + use-package-always-defer t) + + (define-advice straight-use-package-ensure-function + (:around (old-fun &rest args) y-or-n-p-always-t) + (cl-letf* (((symbol-function #'y-or-n-p) (lambda (_prompt) t))) + (apply old-fun args))) + + (el-patch-defun use-package-handler/:ensure (name keyword ensure rest state) + (let* ((body (use-package-process-keywords name rest + ;; Here we are conditionally updating the marker + ;; value for deferred installation; this will be + ;; checked later by `:config'. For more information + ;; see `use-package-handler/:defer-install'. + (if (eq (plist-get state :defer-install) + :defer-install) + (plist-put state :defer-install :ensure) + state)))) + ;; We want to avoid installing packages when the `use-package' + ;; macro is being macro-expanded by elisp completion (see + ;; `lisp--local-variables'), but still do install packages when + ;; byte-compiling to avoid requiring `package' at runtime. + (el-patch-add + (when (and (bound-and-true-p byte-compile-current-file) + (not (plist-get state :defer-install))) + ;; Eval when byte-compiling, + (funcall use-package-ensure-function + name ensure state :byte-compile))) + (cond + ((plist-get state :defer-install) + (push + `(puthash ',name '(,ensure . ,state) + use-package--deferred-packages) + body) + (push `(,use-package-pre-ensure-function + ',name ',ensure ',state) + body)) + (el-patch-remove + ((bound-and-true-p byte-compile-current-file) + ;; Eval when byte-compiling, + (funcall use-package-ensure-function + name ensure state :byte-compile))) + ;; or else wait until runtime. + (t (el-patch-wrap 2 + (unless (and (not ensure) + (eq use-package-ensure-function + 'straight-use-package-ensure-function)) + (push `(,use-package-ensure-function + ',name ',ensure ',state :ensure) + body))))) + body))) + + (autoload 'use-package-install-deferred-package "use-package" + "Install a package whose installation has been deferred. +NAME should be a symbol naming a package (actually, a feature). +This is done by calling `use-package-ensure-function' is called +with four arguments: the key (NAME) and the two elements of the +cons in `use-package--deferred-packages' (the value passed to +`:ensure', and the `state' plist), and a keyword providing +information about the context in which the installation is +happening. (This defaults to `:unknown' but can be overridden by +providing CONTEXT.) + +Return t if the package is installed, nil otherwise. (This is +determined by the return value of `use-package-ensure-function'.) +If the package is installed, its entry is removed from +`use-package--deferred-packages'. If the package has no entry in +`use-package--deferred-packages', do nothing and return t.") + + (el-patch-defvar use-package--deferred-packages (make-hash-table) + "Hash mapping packages to data about their installation. + +The keys are not actually symbols naming packages, but rather +symbols naming the features which are the names of \"packages\" +required by `use-package' forms. Since +`use-package-ensure-function' could be set to anything, it is +actually impossible for `use-package' to determine what package +is supposed to provide the feature being ensured just based on +the value of `:ensure'. + +Each value is a cons, with the car being the the value passed to +`:ensure' and the cdr being the `state' plist. See +`use-package-install-deferred-package' for information about how +these values are used to call `use-package-ensure-function'.")) + +(use-package hydra + :init + (autoload 'hydra-default-pre "hydra")) + +(use-package s) +(use-package restart-emacs) + +(use-package exec-path-from-shell + :config + (setq exec-path-from-shell-check-startup-files nil) + + :init + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'exec-path-from-shell))) + + (when (memq window-system '(mac ns)) + (setq exec-path + (or (eval-when-compile + (require 'cl-lib) + (exec-path-from-shell-initialize) + (cl-remove-duplicates exec-path :test #'string=)) + exec-path)))) ;; ================================================ ;; Require packages in the background after startup @@ -244,152 +401,4 @@ (idle-job-add-require 'winner) -(straight-use-package '(use-package - :type git - :host github - :repo "raxod502/use-package")) - -(straight-use-package '(el-patch - :type git - :host github - :repo "raxod502/el-patch")) - -(eval-when-compile (require 'el-patch)) -(setq el-patch-use-aggressive-defvar t) -(defvar el-patch--patches (make-hash-table)) - -(with-eval-after-load 'el-patch - (el-patch-deftype evil-define-command - :classify el-patch-classify-function - :locate el-patch-locate-function - :declare ((doc-string 3) - (indent defun))) - (el-patch-deftype evil-define-motion - :classify el-patch-classify-function - :locate el-patch-locate-function - :declare ((doc-string 3) - (indent defun))) - (el-patch-deftype evil-define-text-object - :classify el-patch-classify-function - :locate el-patch-locate-function - :declare ((doc-string 3) - (indent defun))) - (el-patch-deftype evil-define-operator - :classify el-patch-classify-function - :locate el-patch-locate-function - :declare ((doc-string 3) - (indent defun)))) - -(el-patch-feature use-package) - -(with-eval-after-load 'use-package - (setq use-package-always-ensure t - use-package-always-defer t) - - (define-advice straight-use-package-ensure-function - (:around (old-fun &rest args) y-or-n-p-always-t) - (cl-letf* (((symbol-function #'y-or-n-p) (lambda (_prompt) t))) - (apply old-fun args))) - - (el-patch-defun use-package-handler/:ensure (name keyword ensure rest state) - (let* ((body (use-package-process-keywords name rest - ;; Here we are conditionally updating the marker - ;; value for deferred installation; this will be - ;; checked later by `:config'. For more information - ;; see `use-package-handler/:defer-install'. - (if (eq (plist-get state :defer-install) - :defer-install) - (plist-put state :defer-install :ensure) - state)))) - ;; We want to avoid installing packages when the `use-package' - ;; macro is being macro-expanded by elisp completion (see - ;; `lisp--local-variables'), but still do install packages when - ;; byte-compiling to avoid requiring `package' at runtime. - (el-patch-add - (when (and (bound-and-true-p byte-compile-current-file) - (not (plist-get state :defer-install))) - ;; Eval when byte-compiling, - (funcall use-package-ensure-function - name ensure state :byte-compile))) - (cond - ((plist-get state :defer-install) - (push - `(puthash ',name '(,ensure . ,state) - use-package--deferred-packages) - body) - (push `(,use-package-pre-ensure-function - ',name ',ensure ',state) - body)) - (el-patch-remove - ((bound-and-true-p byte-compile-current-file) - ;; Eval when byte-compiling, - (funcall use-package-ensure-function - name ensure state :byte-compile))) - ;; or else wait until runtime. - (t (el-patch-wrap 2 - (unless (and (not ensure) - (eq use-package-ensure-function - 'straight-use-package-ensure-function)) - (push `(,use-package-ensure-function - ',name ',ensure ',state :ensure) - body))))) - body))) - -(autoload 'use-package-install-deferred-package "use-package" - "Install a package whose installation has been deferred. -NAME should be a symbol naming a package (actually, a feature). -This is done by calling `use-package-ensure-function' is called -with four arguments: the key (NAME) and the two elements of the -cons in `use-package--deferred-packages' (the value passed to -`:ensure', and the `state' plist), and a keyword providing -information about the context in which the installation is -happening. (This defaults to `:unknown' but can be overridden by -providing CONTEXT.) - -Return t if the package is installed, nil otherwise. (This is -determined by the return value of `use-package-ensure-function'.) -If the package is installed, its entry is removed from -`use-package--deferred-packages'. If the package has no entry in -`use-package--deferred-packages', do nothing and return t.") - -(el-patch-defvar use-package--deferred-packages (make-hash-table) - "Hash mapping packages to data about their installation. - -The keys are not actually symbols naming packages, but rather -symbols naming the features which are the names of \"packages\" -required by `use-package' forms. Since -`use-package-ensure-function' could be set to anything, it is -actually impossible for `use-package' to determine what package -is supposed to provide the feature being ensured just based on -the value of `:ensure'. - -Each value is a cons, with the car being the the value passed to -`:ensure' and the cdr being the `state' plist. See -`use-package-install-deferred-package' for information about how -these values are used to call `use-package-ensure-function'.") - -(use-package hydra - :init - (autoload 'hydra-default-pre "hydra")) - -(use-package s) -(use-package restart-emacs) - -(use-package exec-path-from-shell - :config - (setq exec-path-from-shell-check-startup-files nil) - - :init - (eval-when-compile - (with-demoted-errors "Load error: %s" - (require 'exec-path-from-shell))) - - (when (memq window-system '(mac ns)) - (setq exec-path - (or (eval-when-compile - (require 'cl-lib) - (exec-path-from-shell-initialize) - (cl-remove-duplicates exec-path :test #'string=)) - exec-path)))) - (provide 'config-package) diff --git a/modules/config-paste.el b/modules/config-paste.el index 924aed82..4968b832 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (eval-when-compile (with-demoted-errors "Load error: %s" diff --git a/modules/config-python.el b/modules/config-python.el index b4b58acb..e5840e32 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -1,7 +1,8 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros) - (require 'config-core)) + (require 'config-core) + (require 'config-package)) ;; ============================================================================= diff --git a/modules/config-safety.el b/modules/config-safety.el index 1f3cee50..3968eab1 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (defvar my/unnamed-autosave-location (locate-user-emacs-file "data/unnamed-autosave") diff --git a/modules/config-smartparens.el b/modules/config-smartparens.el index ef0631cf..1da6617c 100644 --- a/modules/config-smartparens.el +++ b/modules/config-smartparens.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package on-parens :commands (;; motion @@ -30,7 +32,8 @@ :config (eval-when-compile (with-demoted-errors "Load error: %s" - (require 'el-patch))) + (require 'el-patch) + (require 'hydra))) (setq sp-cancel-autoskip-on-backward-movement nil) diff --git a/modules/config-solarized.el b/modules/config-solarized.el index 5f067062..80e7c58f 100644 --- a/modules/config-solarized.el +++ b/modules/config-solarized.el @@ -1,5 +1,8 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) + (use-package solarized-theme) (define-advice load-theme diff --git a/modules/config-tex.el b/modules/config-tex.el index fb7df38e..9cb2dd0a 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) ;; ============================================================================= ;; TeX/LaTeX =================================================================== diff --git a/modules/config-tramp.el b/modules/config-tramp.el index a024f754..9d72d099 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (eval-when-compile (with-demoted-errors "Load error: %s" diff --git a/modules/config-ui.el b/modules/config-ui.el index 90cb228d..924cd635 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (require 'cl-lib) diff --git a/modules/config-undo.el b/modules/config-undo.el index 2d0d23f2..df909d15 100644 --- a/modules/config-undo.el +++ b/modules/config-undo.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package undo-tree :init diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 1c0cf95e..a6ef0704 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (use-package auth-source :ensure nil diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index 6eb2a23f..df15495b 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -1,5 +1,7 @@ ;; -*- lexical-binding: t -*- -(eval-when-compile (require 'config-macros)) +(eval-when-compile + (require 'config-macros) + (require 'config-package)) (eval-when-compile (with-demoted-errors "Load error: %s" From b39018b46da209bcb6a624d4110d08bd1575efbc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 26 Nov 2021 11:54:23 -0800 Subject: [PATCH 223/303] Fix letters-do-avy-jump advice --- modules/config-avy-easymotion.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-avy-easymotion.el b/modules/config-avy-easymotion.el index e48a94b9..ac806b9e 100644 --- a/modules/config-avy-easymotion.el +++ b/modules/config-avy-easymotion.el @@ -6,7 +6,7 @@ (use-package avy :init (define-advice self-insert-command - (:around (old-fun &optional arg) letters-do-avy-jump) + (:around (old-fun &optional arg _C) letters-do-avy-jump) (interactive "P") (cond ;; `C-u a` jumps to `a`. From 4d3d3676d4251087396d207620c749122ec85996 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 26 Nov 2021 11:57:38 -0800 Subject: [PATCH 224/303] Fix unconditional restart on stale init.elc --- init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index f67b8a04..cb8de78c 100644 --- a/init.el +++ b/init.el @@ -86,13 +86,13 @@ (let ((init-elc (concat (file-name-sans-extension user-init-file) ".elc"))) (when (and (file-newer-than-file-p user-init-file init-elc) - (not (equal (file-name-extension user-init-file) "eln")))) + (not (equal (file-name-extension user-init-file) "eln"))) (byte-compile-file user-init-file) (when (and (fboundp 'restart-emacs) (y-or-n-p (format "%s was newer than %s. Restart?" user-init-file - init-elc)))) - (restart-emacs)))) + init-elc))) + (restart-emacs)))))) (add-hook 'after-init-hook #'my/maybe-byte-compile-init-el) From 010825cc0318ec0c03c0754c461392527f947739 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Jan 2022 14:29:41 -0800 Subject: [PATCH 225/303] lsp-mode: do not suggest downloading servers --- modules/config-modes.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 774de9a2..f8fd4aec 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1496,7 +1496,8 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (setq lsp-prefer-flymake nil lsp-auto-guess-root t lsp-session-file (expand-file-name (locate-user-emacs-file "data/.lsp-session-v1")) - lsp-headerline-breadcrumb-enable nil) + lsp-headerline-breadcrumb-enable nil + lsp-enable-suggest-server-download nil) (defun my/lsp-before-initialize/stall-for-remote-connections () (when (lsp--client-remote? From 540a3f1f03fcdcf7e147677d21a82dee1ce83dd1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 2 Jan 2022 14:30:18 -0800 Subject: [PATCH 226/303] Ignore eln-cache --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6042cb66..7cbe0947 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,4 @@ flycheck_* /data/places /data/transient /data/lsp +/eln-cache From 62c7a46dcc7e9fe5dba950b44a9f83754a93458d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 4 Jan 2022 13:37:07 -0800 Subject: [PATCH 227/303] Update rsyncx tramp method --- modules/config-tramp.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index 9d72d099..a39aa3f5 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -30,20 +30,29 @@ (add-to-list 'tramp-methods `("rsyncx" (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") - ("-t" "-t") ("%h") ("%l"))) + (tramp-login-args + (("-l" "%u") + ("-p" "%p") + ("%c") + ("-e" "none") + ("-t" "-t") + ("-o" "RemoteCommand=\"%l\"") + ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")) (tramp-copy-program - ,(if (and (eq system-type 'darwin) - (file-executable-p "/usr/local/bin/rsync")) - "/usr/local/bin/rsync" - "rsync")) + ,(cond + ((and (eq system-type 'darwin) + (file-executable-p "/opt/homebrew/bin/rsync")) + "/opt/homebrew/bin/rsync") + ((and (eq system-type 'darwin) + (file-executable-p "/usr/local/bin/rsync")) + "/usr/local/bin/rsync") + (t "rsync"))) (tramp-copy-args (("-t" "%k") ("-p") ("-r") ("-s") ("-c"))) - (tramp-copy-env (("RSYNC_RSH") - ("ssh" "%c"))) + (tramp-copy-env (("RSYNC_RSH") ("ssh") ("%c"))) (tramp-copy-keep-date t) (tramp-copy-keep-tmpfile t) (tramp-copy-recursive t))) From e83ea249adcbd4746801b1644dba17b69c37af92 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 4 Jan 2022 13:57:36 -0800 Subject: [PATCH 228/303] Revert "Remove lsp-server-present? patch now that lsp-mode has been fixed" This reverts commit 6e2783d9a2415af5f3b75ff050292789bd735968. --- modules/config-modes.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index f8fd4aec..ed308ea1 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1505,7 +1505,23 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" (sit-for 0.1))) (add-hook 'lsp-before-initialize-hook - #'my/lsp-before-initialize/stall-for-remote-connections)) + #'my/lsp-before-initialize/stall-for-remote-connections) + + (el-patch-defun lsp-server-present? (final-command) + "Check whether FINAL-COMMAND is present." + ;; executable-find only gained support for remote checks after 27 release + (or (and (cond + ((not (file-remote-p default-directory)) + (executable-find (cl-first final-command))) + ((version<= "27.0" emacs-version) + (el-patch-wrap 2 + (or + (file-executable-p (my/tramp-build-name-from-localname (cl-first final-command))) + (with-no-warnings (executable-find (cl-first final-command) (file-remote-p default-directory)))))) + (t)) + (prog1 t + (lsp-log "Command \"%s\" is present on the path." (s-join " " final-command)))) + (ignore (lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command)))))) (use-package lsp-ui :commands lsp-ui-mode From ddb10713df756b58ca6e07021e774f09e9cf5e50 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 4 Jan 2022 14:04:17 -0800 Subject: [PATCH 229/303] Set tab-width to 4 in python-mode --- modules/config-python.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-python.el b/modules/config-python.el index e5840e32..a41abaab 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -109,7 +109,9 @@ Return either a string or nil." :config (add-hook 'python-mode-hook - (lambda () (setq mode-name "Py"))) + (my/defun-as-value my/python-mode-setup () + (setq mode-name "Py") + (setq-local tab-width 4))) ;; Use the Microsoft python ls if we can (use-package lsp-python-ms From 79dc194653e4da2802ee103bd1d78dabe242ca18 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 30 Nov 2021 23:43:30 -0800 Subject: [PATCH 230/303] Add code to decorate delimiters with magic-latex-buffer --- modules/config-tex.el | 124 +++++++++++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 37 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 9cb2dd0a..6eadfa40 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -199,44 +199,7 @@ command." (error "Cannot have two processes for the same document"))) (delete-process process))))) - (use-package magic-latex-buffer - :defer-install t - :commands (magic-latex-buffer) - :init - (el-patch-feature magic-latex-buffer) - :config - (setq magic-latex-enable-block-align nil - magic-latex-enable-inline-image nil) - - (set-face-attribute 'ml/llarge nil :height 1.25) - (set-face-attribute 'ml/xlarge nil :height 1.3) - (set-face-attribute 'ml/huge nil :height 1.35) - (set-face-attribute 'ml/hhuge nil :height 1.4) - (add-hook 'magic-latex-buffer-hook #'rainbow-delimiters-mode-disable) - - (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) - "Like `search-regexp' but skips escaped chars, comments and -verbish environments. This function raise an error on -failure. When POINT-SAFE is non-nil, the point must not be in the -matching string." - (ml/safe-excursion - (let ((case-fold-search nil)) - (if backward - (search-backward-regexp regex bound) - (search-forward-regexp regex bound))) - (or (save-match-data - (save-excursion - (and (goto-char (match-beginning 0)) - (not (and point-safe - (< (point) ml/jit-point) - (< ml/jit-point (match-end 0)))) - (looking-back "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" - (el-patch-swap - (point-min) - (line-beginning-position))) - (not (ml/skip-comments-and-verbs backward))))) - (ml/search-regexp regex bound backward point-safe))))) (add-hook 'TeX-mode-hook #'lsp-deferred) (add-hook 'TeX-mode-hook #'quark-flysave-mode) @@ -315,6 +278,93 @@ matching string." nil nil "localhost"))) (compile (concat "sshlatex " host " " buffer-file-name)))) +(use-package magic-latex-buffer + :commands (magic-latex-buffer) + :init + (el-patch-feature magic-latex-buffer) + :config + (setq magic-latex-enable-block-align nil + magic-latex-enable-inline-image nil) + + (push '("\\\\EE\\>" . "𝔼") ml/symbols) + (push '("\\\\RR\\>" . "ℝ") ml/symbols) + (push '("\\\\NN\\>" . "ℕ") ml/symbols) + (push '("\\\\QQ\\>" . "ℚ") ml/symbols) + (push '("\\\\CC\\>" . "ℂ") ml/symbols) + (push '("\\\\sqrt\\>" . "√") ml/symbols) + (push '("\\\\ldots\\>" . "…") ml/symbols) + (push '("\\\\triangleq\\>" . "≜") ml/symbols) + (push '("\\\\coloneqq\\>" . "≔") ml/symbols) + (push '("\\\\frac\\>" . "∕") ml/symbols) + + (defvar ml/wrappers + '( + ("\\\\del{" "(" . ")") + ("\\\\del\\*{" "⦅" . "⦆") + ("\\\\sbr{" "[" . "]") + ("\\\\sbr\\*{" "〚" . "〛") + ("\\\\set{" "{" . "}") + ("\\\\set\\*{" "⦃" . "⦄") + ("\\\\abs{" "|" . "|") + ("\\\\abs\\*{" "¦" . "¦") + ("\\\\norm{" "ǁ" . "ǁ") + ("\\\\norm\\*{" "⃒¦" . "¦⃒") + ("\\\\ceil{" "⌈" . "⌉") + ("\\\\floor{" "⌊" . "⌋") + ("\\\\inner{" "〈" . "〉") + ("\\\\inner\\*{" "《" . "》"))) + + (define-advice ml/jit-prettifier + (:after (beg end) prettify-wrapers) + (dolist (wrapper ml/wrappers) + (save-excursion + (let ((regex (car wrapper))) + (while (ignore-errors (ml/search-regexp regex end nil t)) + (let* ((close (scan-lists (1- (match-end 0)) 1 0)) + (oldov (ml/overlay-at (match-beginning 0) 'category 'ml/ov-pretty)) + (priority-base (and oldov (or (overlay-get oldov 'priority) 1))) + (oldprop (and oldov (overlay-get oldov 'display)))) + (unless (stringp oldprop) + (ml/make-pretty-overlay + (match-beginning 0) (match-end 0) + 'priority (when oldov (1+ priority-base)) + 'display (propertize (eval (cadr wrapper)) 'display oldprop)) + (ml/make-pretty-overlay + (1- close) close + 'priority (when oldov (1+ priority-base)) + 'display (propertize (eval (cddr wrapper)) 'display oldprop) + 'face font-lock-keyword-face)))))))) + + (set-face-attribute 'ml/llarge nil :height 1.25) + (set-face-attribute 'ml/xlarge nil :height 1.3) + (set-face-attribute 'ml/huge nil :height 1.35) + (set-face-attribute 'ml/hhuge nil :height 1.4) + + (add-hook 'magic-latex-buffer-hook #'rainbow-delimiters-mode-disable) + + (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) + "Like `search-regexp' but skips escaped chars, comments and +verbish environments. This function raise an error on +failure. When POINT-SAFE is non-nil, the point must not be in the +matching string." + (ml/safe-excursion + (let ((case-fold-search nil)) + (if backward + (search-backward-regexp regex bound) + (search-forward-regexp regex bound))) + (or (save-match-data + (save-excursion + (and (goto-char (match-beginning 0)) + (not (and point-safe + (< (point) ml/jit-point) + (< ml/jit-point (match-end 0)))) + (looking-back "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" + (el-patch-swap + (point-min) + (line-beginning-position))) + (not (ml/skip-comments-and-verbs backward))))) + (ml/search-regexp regex bound backward point-safe))))) + (with-eval-after-load 'latex (setq TeX-electric-math (cons "\\\(" "\\\)")) From c6a9a5d5f8b30f295bf7689a079a5d1d6eb95c4e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 16 Jan 2022 21:56:32 -0800 Subject: [PATCH 231/303] Update magit-read-stash patch --- modules/config-vcs.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index a6ef0704..13fb8f52 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -135,13 +135,24 @@ ;; If there is only one stash, operate on it immediately (el-patch-defun magit-read-stash (prompt) - (let ((stashes (magit-list-stashes))) - (el-patch-wrap 2 1 - (if (> (length stashes) 1) - (magit-completing-read prompt stashes nil t nil nil - (magit-stash-at-point) - (car stashes)) - (car stashes))))) + (let* ((atpoint (magit-stash-at-point)) + (default (and atpoint + (concat atpoint (magit-rev-format " %s" atpoint)))) + (choices (mapcar (lambda (c) + (pcase-let ((`(,rev ,msg) (split-string c "\0"))) + (concat (propertize rev 'face 'magit-hash) + " " msg))) + (magit-list-stashes "%gd%x00%s"))) + (choice (el-patch-wrap 2 1 + (if (> (length choices) 1) + (magit-completing-read prompt choices + nil t nil nil + default + (car choices)) + (car choices))))) + (and choice + (string-match "^\\([^ ]+\\) \\(.+\\)" choice) + (substring-no-properties (match-string 1 choice))))) (el-patch-defun magit-process-username-prompt (process string) "Forward username prompts to the user." From 12fca6fd1b399bc0073dcb5cc0af912ad7897eb9 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 12:45:26 -0800 Subject: [PATCH 232/303] Load helm-mode to avoid helm-completion--flex-transform-pattern bug --- modules/config-helm.el | 3 +++ modules/config-package.el | 1 + 2 files changed, 4 insertions(+) diff --git a/modules/config-helm.el b/modules/config-helm.el index f146ba28..8d611f3b 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -25,6 +25,9 @@ (define-key helm-map (kbd "M-") #'helm-next-source) (set-face-attribute 'helm-selection nil :underline nil) + + (autoload 'helm-completion--flex-transform-pattern "helm-mode") + (setq helm-case-fold-search 'smart helm-candidate-separator (make-string 20 ?─) helm-display-header-line nil diff --git a/modules/config-package.el b/modules/config-package.el index 373546b1..dd1f8cca 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -378,6 +378,7 @@ these values are used to call `use-package-ensure-function'.")) (idle-job-add-require 'url-history) (idle-job-add-require 'mailcap) +(idle-job-add-require 'helm-mode) (idle-job-add-require 'helm-ring) (idle-job-add-require 'helm-elisp) (idle-job-add-require 'helm-eval) From 33912c62a7177d9f28390c74b15d263395c45c3e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 12:45:46 -0800 Subject: [PATCH 233/303] Fix advice removing dots from helm-find-files --- modules/config-helm.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 8d611f3b..86d27a0b 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -158,21 +158,21 @@ helm-ff-keep-cached-candidates nil helm-boring-file-regexp-list (append helm-boring-file-regexp-list (list (rx ".synctex.gz" line-end) - (rx ".undo.xz" line-end) (rx ".elc" line-end) (rx "#" line-end) (rx "~" line-end) - (rx ".zwc.old" line-end) - (rx ".zwc" line-end) + (rx ".zwc" (opt ".old") line-end) (rx "/.#")))) - (define-advice helm-ff-filter-candidate-one-by-one - (:around (old-fun file &rest args) skip-dots) - (when (or (not (string-match-p (rx (or "." "..") line-end) file)) - (string-match-p (rx ".") - (helm-basename (or (bound-and-true-p helm-input) - "")))) - (funcall old-fun file args)))) + (define-advice helm-ff-directory-files + (:filter-return (ret) skip-dots) + (if (string-match-p (rx (or".")) + (helm-basename (or (bound-and-true-p helm-input) + ""))) + ret + (cl-remove-if (lambda (f) + (string-match-p (rx (or "." "..") line-end) (car f))) + ret)))) (use-package helm-buffers :ensure nil From 26dd336d65ad6da136e7962e56879184852f1f54 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 16:31:39 -0800 Subject: [PATCH 234/303] Fix PATH advice for TeX-run-command on macOS --- modules/config-tex.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 6eadfa40..f97c049a 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -117,7 +117,10 @@ (:around (old-fun &rest args) add-exec-path) (let ((process-environment process-environment)) (setenv "PATH" - (concat "$PATH" (string-join exec-path path-separator)) t) + (concat (getenv "PATH") + path-separator + (string-join exec-path path-separator)) + t) (apply old-fun args)))) (defun my/LaTeX-format-name () From f7b7c45d1b6c743938f0e27b547ba3ab92a50a63 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 16:32:16 -0800 Subject: [PATCH 235/303] Use Zathura instead of Skim on macOS --- modules/config-tex.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index f97c049a..7860fd02 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -105,9 +105,12 @@ (when (executable-find "zathura") (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Zathura")) - (when (and (eq system-type 'darwin) - (file-directory-p "/Applications/Skim.app")) - (setf (cadr (assoc 'output-pdf TeX-view-program-selection)) "Skim") + (when (eq system-type 'darwin) + ;; AUCTeX doesn't know zathura exists on macOS now! + (add-to-list 'TeX-view-program-list + '("Zathura" + "zathura %o" + "zathura")) ;; Due to the way AUCTeX invokes commands, the programs need to be ;; in the PATH, however for some reason on macOS the required From a566874a7e729721905a3667d5a95046c4299078 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 21:34:04 -0800 Subject: [PATCH 236/303] Update to personal fork of helm-git-grep --- modules/config-helm.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 86d27a0b..1518bfb0 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -348,7 +348,10 @@ (setq helm-ag-base-command "ack-grep --nocolor --nogroup" my/ag-available t)))) -(use-package helm-git-grep) +(use-package helm-git-grep + :recipe (helm-git-grep :type git + :host github + :repo "PythonNut/helm-git-grep")) (use-package helm-rg :init From 717d0de94da71e176e543744e6f646f0738d1b58 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 18 Jan 2022 21:34:30 -0800 Subject: [PATCH 237/303] Fix whitespace-mode faces, closes #150 --- modules/config-ui.el | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index 924cd635..a0cbb4fd 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -397,19 +397,8 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." ;; ================== (with-eval-after-load 'whitespace - (setq whitespace-display-mappings '((space-mark 32 [?·])) - whitespace-style '(face trailing spaces space-mark)) - - (set-face-attribute 'whitespace-space nil - :inherit nil - :foreground (face-background 'default) - :background nil) - - (set-face-attribute 'whitespace-trailing nil - :inherit 'avy-background-face - :background nil - :inverse-video nil - :foreground nil) + (setf (alist-get 'space-mark whitespace-display-mappings) '(32 [?·])) + (setq whitespace-style '(face trailing tab tab-mark spaces space-mark)) (define-advice whitespace-trailing-regexp (:override (limit) match-all) From 7fe1d2296c1af80e33b5466aecc6192c2cedd4d8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 23 Jan 2022 09:41:32 -0800 Subject: [PATCH 238/303] Update adaptive-wrap patches for Emacs 28 --- modules/config-whitespace.el | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index df15495b..983b22d7 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -50,16 +50,21 @@ extra indent = 2 (make-variable-buffer-local 'adaptive-wrap-extra-indent) - (el-patch-defun adaptive-wrap--face-extends (face) - (if (fboundp 'face-extend-p) - (face-extend-p face nil t) - ;; Before Emacs 27, faces always extended beyond EOL. Check for a - ;; non-default background. - (face-background face nil t))) - - (el-patch-defun adaptive-wrap--prefix-face (fcp beg end) + (el-patch-defun adaptive-wrap--face-extend-p (face) + ;; Before Emacs 27, faces always extended beyond EOL, so we check for a + ;; non-default background instead. + (cond + ((listp face) + (plist-get face (if (fboundp 'face-extend-p) :extend :background))) + ((symbolp face) + (if (fboundp 'face-extend-p) + (face-extend-p face nil t) + (face-background face nil t))))) + + (el-patch-defun adaptive-wrap--prefix-face (fcp _beg end) + ;; If the fill-context-prefix already specifies a face, just use that. (cond ((get-text-property 0 'face fcp)) - ;; If the last character is a newline and has a face that + ;; Else, if the last character is a newline and has a face that ;; extends beyond EOL, assume that this face spans the whole ;; line and apply it to the prefix to preserve the "block" ;; visual effect. @@ -69,7 +74,14 @@ extra indent = 2 ;; line has the diff-removed face. ((= (char-before end) ?\n) (let ((eol-face (get-text-property (1- end) 'face))) - (and eol-face (adaptive-wrap--face-extends eol-face) eol-face))))) + ;; `eol-face' can be a face, a "face value" + ;; (plist of face properties) or a list of one of those. + (if (or (not (consp eol-face)) (keywordp (car eol-face))) + ;; A single face. + (if (adaptive-wrap--face-extend-p eol-face) eol-face) + ;; A list of faces. Keep the ones that extend beyond EOL. + (delq nil (mapcar (lambda (f) (if (adaptive-wrap--face-extend-p f) f)) + eol-face))))))) (el-patch-defun adaptive-wrap--prefix (fcp) (let ((fcp-len (string-width fcp))) From 4824ab7e6fab57b90870260c127742c2b27dd9db Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 23 Jan 2022 12:23:27 -0800 Subject: [PATCH 239/303] Use C-c m to toggle magic-latex-buffer in TeX-mode --- modules/config-tex.el | 157 ++++++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 75 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 7860fd02..e713d654 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -289,87 +289,94 @@ command." :init (el-patch-feature magic-latex-buffer) :config + + (with-eval-after-load 'tex + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'tex))) + (define-key TeX-mode-map (kbd "C-c m") #'magic-latex-buffer)) + (setq magic-latex-enable-block-align nil magic-latex-enable-inline-image nil) - (push '("\\\\EE\\>" . "𝔼") ml/symbols) - (push '("\\\\RR\\>" . "ℝ") ml/symbols) - (push '("\\\\NN\\>" . "ℕ") ml/symbols) - (push '("\\\\QQ\\>" . "ℚ") ml/symbols) - (push '("\\\\CC\\>" . "ℂ") ml/symbols) - (push '("\\\\sqrt\\>" . "√") ml/symbols) - (push '("\\\\ldots\\>" . "…") ml/symbols) - (push '("\\\\triangleq\\>" . "≜") ml/symbols) - (push '("\\\\coloneqq\\>" . "≔") ml/symbols) - (push '("\\\\frac\\>" . "∕") ml/symbols) - - (defvar ml/wrappers - '( - ("\\\\del{" "(" . ")") - ("\\\\del\\*{" "⦅" . "⦆") - ("\\\\sbr{" "[" . "]") - ("\\\\sbr\\*{" "〚" . "〛") - ("\\\\set{" "{" . "}") - ("\\\\set\\*{" "⦃" . "⦄") - ("\\\\abs{" "|" . "|") - ("\\\\abs\\*{" "¦" . "¦") - ("\\\\norm{" "ǁ" . "ǁ") - ("\\\\norm\\*{" "⃒¦" . "¦⃒") - ("\\\\ceil{" "⌈" . "⌉") - ("\\\\floor{" "⌊" . "⌋") - ("\\\\inner{" "〈" . "〉") - ("\\\\inner\\*{" "《" . "》"))) - - (define-advice ml/jit-prettifier - (:after (beg end) prettify-wrapers) - (dolist (wrapper ml/wrappers) - (save-excursion - (let ((regex (car wrapper))) - (while (ignore-errors (ml/search-regexp regex end nil t)) - (let* ((close (scan-lists (1- (match-end 0)) 1 0)) - (oldov (ml/overlay-at (match-beginning 0) 'category 'ml/ov-pretty)) - (priority-base (and oldov (or (overlay-get oldov 'priority) 1))) - (oldprop (and oldov (overlay-get oldov 'display)))) - (unless (stringp oldprop) - (ml/make-pretty-overlay - (match-beginning 0) (match-end 0) - 'priority (when oldov (1+ priority-base)) - 'display (propertize (eval (cadr wrapper)) 'display oldprop)) - (ml/make-pretty-overlay - (1- close) close - 'priority (when oldov (1+ priority-base)) - 'display (propertize (eval (cddr wrapper)) 'display oldprop) - 'face font-lock-keyword-face)))))))) - - (set-face-attribute 'ml/llarge nil :height 1.25) - (set-face-attribute 'ml/xlarge nil :height 1.3) - (set-face-attribute 'ml/huge nil :height 1.35) - (set-face-attribute 'ml/hhuge nil :height 1.4) - - (add-hook 'magic-latex-buffer-hook #'rainbow-delimiters-mode-disable) - - (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) - "Like `search-regexp' but skips escaped chars, comments and + (push '("\\\\EE\\>" . "𝔼") ml/symbols) + (push '("\\\\RR\\>" . "ℝ") ml/symbols) + (push '("\\\\NN\\>" . "ℕ") ml/symbols) + (push '("\\\\QQ\\>" . "ℚ") ml/symbols) + (push '("\\\\CC\\>" . "ℂ") ml/symbols) + (push '("\\\\sqrt\\>" . "√") ml/symbols) + (push '("\\\\ldots\\>" . "…") ml/symbols) + (push '("\\\\triangleq\\>" . "≜") ml/symbols) + (push '("\\\\coloneqq\\>" . "≔") ml/symbols) + (push '("\\\\frac\\>" . "∕") ml/symbols) + + (defvar ml/wrappers + '( + ("\\\\del{" "(" . ")") + ("\\\\del\\*{" "⦅" . "⦆") + ("\\\\sbr{" "[" . "]") + ("\\\\sbr\\*{" "〚" . "〛") + ("\\\\set{" "{" . "}") + ("\\\\set\\*{" "⦃" . "⦄") + ("\\\\abs{" "|" . "|") + ("\\\\abs\\*{" "¦" . "¦") + ("\\\\norm{" "ǁ" . "ǁ") + ("\\\\norm\\*{" "⃒¦" . "¦⃒") + ("\\\\ceil{" "⌈" . "⌉") + ("\\\\floor{" "⌊" . "⌋") + ("\\\\inner{" "〈" . "〉") + ("\\\\inner\\*{" "《" . "》"))) + + (define-advice ml/jit-prettifier + (:after (beg end) prettify-wrapers) + (dolist (wrapper ml/wrappers) + (save-excursion + (let ((regex (car wrapper))) + (while (ignore-errors (ml/search-regexp regex end nil t)) + (let* ((close (scan-lists (1- (match-end 0)) 1 0)) + (oldov (ml/overlay-at (match-beginning 0) 'category 'ml/ov-pretty)) + (priority-base (and oldov (or (overlay-get oldov 'priority) 1))) + (oldprop (and oldov (overlay-get oldov 'display)))) + (unless (stringp oldprop) + (ml/make-pretty-overlay + (match-beginning 0) (match-end 0) + 'priority (when oldov (1+ priority-base)) + 'display (propertize (eval (cadr wrapper)) 'display oldprop)) + (ml/make-pretty-overlay + (1- close) close + 'priority (when oldov (1+ priority-base)) + 'display (propertize (eval (cddr wrapper)) 'display oldprop) + 'face font-lock-keyword-face)))))))) + + (set-face-attribute 'ml/llarge nil :height 1.25) + (set-face-attribute 'ml/xlarge nil :height 1.3) + (set-face-attribute 'ml/huge nil :height 1.35) + (set-face-attribute 'ml/hhuge nil :height 1.4) + + (add-hook 'magic-latex-buffer-hook #'rainbow-delimiters-mode-disable) + + (el-patch-defun ml/search-regexp (regex &optional bound backward point-safe) + "Like `search-regexp' but skips escaped chars, comments and verbish environments. This function raise an error on failure. When POINT-SAFE is non-nil, the point must not be in the matching string." - (ml/safe-excursion - (let ((case-fold-search nil)) - (if backward - (search-backward-regexp regex bound) - (search-forward-regexp regex bound))) - (or (save-match-data - (save-excursion - (and (goto-char (match-beginning 0)) - (not (and point-safe - (< (point) ml/jit-point) - (< ml/jit-point (match-end 0)))) - (looking-back "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" - (el-patch-swap - (point-min) - (line-beginning-position))) - (not (ml/skip-comments-and-verbs backward))))) - (ml/search-regexp regex bound backward point-safe))))) + (ml/safe-excursion + (let ((case-fold-search nil)) + (if backward + (search-backward-regexp regex bound) + (search-forward-regexp regex bound))) + (or (save-match-data + (save-excursion + (and (goto-char (match-beginning 0)) + (not (and point-safe + (< (point) ml/jit-point) + (< ml/jit-point (match-end 0)))) + (looking-back "\\([^\\\\]\\|^\\)\\(\\\\\\\\\\)*" + (el-patch-swap + (point-min) + (line-beginning-position))) + (not (ml/skip-comments-and-verbs backward))))) + (ml/search-regexp regex bound backward point-safe))))) (with-eval-after-load 'latex (setq TeX-electric-math (cons "\\\(" "\\\)")) From a13d0e95aa935e588a3667dea3fb90964251b6a1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 19 Feb 2022 11:47:09 -0800 Subject: [PATCH 240/303] Add more math words to user dictionary --- data/user-dict.en.pws | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index ec7495ab..73098315 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,9 +1,11 @@ -personal_ws-1.1 en 41 +personal_ws-1.1 en 45 +Frobenius Gaussians Hayase Kolmogorov Lipschitz Reidemeister +Schatten biconditional bijection cardinality @@ -22,12 +24,14 @@ infimum injective integrable integrands +invertible irreducibles lexicographically monomial monomials nondecreasing nonincreasing +nonnegative nontrivially pointwise satisfiable From c3515153ba2cde87652b78ba8cab9e009570426e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 21 Feb 2022 11:27:05 -0800 Subject: [PATCH 241/303] Fix environment advice for TeX-view on macOS --- modules/config-tex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index e713d654..3fc93098 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -116,7 +116,7 @@ ;; in the PATH, however for some reason on macOS the required ;; directories are only added to exec-path and not PATH, so we ;; correct this here. - (define-advice TeX-run-command + (define-advice TeX-run-discard (:around (old-fun &rest args) add-exec-path) (let ((process-environment process-environment)) (setenv "PATH" From c78fa10f474e204d9d620dab7d0626eeecbb37bc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 23 Mar 2022 22:31:13 -0700 Subject: [PATCH 242/303] Move punctuation in evil-tex-toggle-math, closes #151 --- modules/config-tex.el | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 3fc93098..8d7688c1 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -213,7 +213,38 @@ command." (use-package evil :config (use-package evil-tex - :commands (evil-tex-mode)) + :commands (evil-tex-mode) + :config + (defun quark/evil-tex-toggle-math () + "Toggle surrounding math between \\(foo\\) and \\=\\[foo\\]." + (interactive) + (let* ((outer (evil-tex-a-math)) (inner (evil-tex-inner-math)) + (left-over (make-overlay (car outer) (car inner))) + (right-over (make-overlay (cadr inner) (cadr outer)))) + (save-excursion + (goto-char (overlay-start left-over)) + (cond + ((looking-at (regexp-quote "\\(")) + (evil-tex--overlay-replace left-over "\\[") + (evil-tex--overlay-replace right-over "\\]" ) + (goto-char (overlay-end right-over)) + (when (looking-at (rx punct)) + (let ((match (match-string 0))) + (delete-char 1) + (goto-char (overlay-start right-over)) + (insert match)))) + ((looking-at (regexp-quote "\\[")) + (evil-tex--overlay-replace left-over "\\(") + (evil-tex--overlay-replace right-over "\\)" ) + (goto-char (overlay-start right-over)) + (when (looking-back (rx punct) 1) + (let ((match (match-string 0))) + (delete-char -1) + (goto-char (overlay-end right-over)) + (insert match)))))) + (delete-overlay left-over) (delete-overlay right-over))) + + (define-key evil-tex-toggle-map (kbd "m") #'quark/evil-tex-toggle-math)) (add-hook 'LaTeX-mode-hook #'evil-tex-mode) (evil-set-initial-state 'TeX-error-overview-mode 'insert)) From 6ba3356a6a3feff8d2d6c2278b8b3fcd00228f56 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 18 Jun 2022 17:12:39 -0700 Subject: [PATCH 243/303] idle load magit-base --- modules/config-package.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-package.el b/modules/config-package.el index dd1f8cca..3cbe889b 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -294,6 +294,7 @@ these values are used to call `use-package-ensure-function'.")) (idle-job-add-require 'magit-autorevert) (idle-job-add-require 'magit-margin) (idle-job-add-require 'magit-mode) +(idle-job-add-require 'magit-base) (idle-job-add-require 'transient) (idle-job-add-require 'git-commit) (idle-job-add-require 'log-edit) From 4eda364551309f546e82a6d839b133e0323c68e8 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Jun 2022 13:33:28 -0700 Subject: [PATCH 244/303] Update to fixed auctex-latexmk fork --- modules/config-tex.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/config-tex.el b/modules/config-tex.el index 8d7688c1..aaf34e8a 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -260,6 +260,11 @@ command." (add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode) (use-package auctex-latexmk + :recipe (auctex-latexmk + :type git + :flavor melpa + :host github + :repo "wang1zhen/auctex-latexmk") :commands (auctex-latexmk-setup) :init (auctex-latexmk-setup) From 0aabd889b4199ea4dc05ef9cc18a7f9a82502165 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Jun 2022 14:28:02 -0700 Subject: [PATCH 245/303] Add compat package to fix magit --- modules/config-vcs.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config-vcs.el b/modules/config-vcs.el index 13fb8f52..6f49b2f7 100644 --- a/modules/config-vcs.el +++ b/modules/config-vcs.el @@ -49,7 +49,9 @@ (transient-bind-q-to-quit)) (use-package magit - :init (defvar magit-no-message (list "Turning on magit-auto-revert-mode")) + :init + (use-package compat) + (defvar magit-no-message (list "Turning on magit-auto-revert-mode")) :config (eval-when-compile (with-demoted-errors "Load error: %s" From 7f64ee6609526223880d47273ecbd38ad66f2435 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Jun 2022 14:28:34 -0700 Subject: [PATCH 246/303] Use flx-rs to replace flx on x86_64 --- modules/config-ivy.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index f253b824..158b0bba 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -54,6 +54,27 @@ recursion depth in the minibuffer prompt. This is only useful if (global-set-key (kbd "C-M-s") #'flx-isearch-forward) (global-set-key (kbd "C-M-r") #'flx-isearch-backward)) +(when (string-prefix-p "x86_64" system-configuration) + (use-package flx-rs + :recipe + (flx-rs :type git + :host github + :repo "PythonNut/flx-rs" + :files ("*.el" "bin/*")) + :init + (with-eval-after-load 'flx + (require 'flx-rs) + (advice-add 'flx-score :override #'flx-rs-score)) + :config + (setq flx-rs--bin-dir + (eval-when-compile + (require 'find-func) + (file-name-directory (find-library-name "flx-rs")))) + (define-advice flx-rs-load-dyn + (:around (old-fun &rest args) quiet) + (let ((message-log-max)) + (apply old-fun args))))) + (use-package historian :init (eval-when-compile From 3769dddd5e7da855fe3400137ff1262c04eb78f3 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Jun 2022 14:37:04 -0700 Subject: [PATCH 247/303] Link f-shortdoc until melpa updates --- modules/config-package.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/config-package.el b/modules/config-package.el index 3cbe889b..e2828020 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -163,6 +163,11 @@ these values are used to call `use-package-ensure-function'.")) (autoload 'hydra-default-pre "hydra")) (use-package s) +(use-package f + :recipe (f + :fetcher github + :repo "rejeep/f.el" + :files ("f.el" "f-shortdoc.el"))) (use-package restart-emacs) (use-package exec-path-from-shell From fbc978d400a3798bb80ddbdf5b3b041fa5974d6a Mon Sep 17 00:00:00 2001 From: Jon Hayase Date: Tue, 28 Jun 2022 20:22:31 -0700 Subject: [PATCH 248/303] Make poetry venv check more robust to failure --- modules/config-python.el | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index a41abaab..cbd7fac0 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -40,7 +40,7 @@ Return either a string or nil." (universal-path (if (tramp-tramp-file-p default-directory) (my/tramp-build-name-from-localname path) path))) - (when (file-directory-p universal-path) + (when (and universal-path (file-directory-p universal-path)) (substring-no-properties universal-path)))) (defvar my/python-virtualenv-cache nil) @@ -54,14 +54,12 @@ Return either a string or nil." (if (and (my/local-executable-find "poetry") dir (not (file-exists-p (expand-file-name ".venv" dir)))) - (let ((cached (or (gethash dir my/python-virtualenv-cache) - (puthash dir - (my/python-find-virtualenv dir) - my/python-virtualenv-cache)))) - (if (file-exists-p cached) + (let ((cached (gethash dir my/python-virtualenv-cache))) + (if (and cached (file-exists-p cached)) cached - (my/python-find-virtualenv dir))) - (my/python-find-virtualenv dir)))) + (puthash dir + (my/python-find-virtualenv dir) + my/python-virtualenv-cache)))))) (with-eval-after-load 'pythonic (eval-when-compile From c3529d511524a59ceba27882b91e539645e1b36c Mon Sep 17 00:00:00 2001 From: Jon Hayase Date: Tue, 28 Jun 2022 20:36:18 -0700 Subject: [PATCH 249/303] Skip poetry venv check when inside local conda env --- modules/config-python.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index cbd7fac0..16d24011 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -49,17 +49,19 @@ Return either a string or nil." (defun my/python-find-virtualenv-cached (&optional dir) (let* ((dir (or dir default-directory)) (pyproject (locate-dominating-file dir "pyproject.toml"))) - (unless my/python-virtualenv-cache - (setq my/python-virtualenv-cache (make-hash-table :test #'equal))) - (if (and (my/local-executable-find "poetry") - dir - (not (file-exists-p (expand-file-name ".venv" dir)))) - (let ((cached (gethash dir my/python-virtualenv-cache))) - (if (and cached (file-exists-p cached)) - cached - (puthash dir - (my/python-find-virtualenv dir) - my/python-virtualenv-cache)))))) + (when (and dir + (my/local-executable-find "poetry") + (or (file-remote-p dir) + (not (getenv "CONDA_PREFIX"))) + (not (file-exists-p (expand-file-name ".venv" dir)))) + (unless my/python-virtualenv-cache + (setq my/python-virtualenv-cache (make-hash-table :test #'equal))) + (let ((cached (gethash dir my/python-virtualenv-cache))) + (if (and cached (file-exists-p cached)) + cached + (puthash dir + (my/python-find-virtualenv dir) + my/python-virtualenv-cache)))))) (with-eval-after-load 'pythonic (eval-when-compile From db6bca2f8ec4e1f271f07a1753c502d176f2c115 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Jun 2022 21:54:47 -0700 Subject: [PATCH 250/303] Switch from flx-rs--bin-dir to flx-rs-bin-dir --- modules/config-ivy.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index 158b0bba..38f81b6a 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -59,14 +59,14 @@ recursion depth in the minibuffer prompt. This is only useful if :recipe (flx-rs :type git :host github - :repo "PythonNut/flx-rs" + :repo "jcs-elpa/flx-rs" :files ("*.el" "bin/*")) :init (with-eval-after-load 'flx (require 'flx-rs) (advice-add 'flx-score :override #'flx-rs-score)) :config - (setq flx-rs--bin-dir + (setq flx-rs-bin-dir (eval-when-compile (require 'find-func) (file-name-directory (find-library-name "flx-rs")))) From 0f53a823fa4a7d3a1482409fb32df05714455e3d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 29 Jul 2022 19:33:31 -0700 Subject: [PATCH 251/303] Remove patch substituting obarray in helpful--read-symbol --- modules/config-modes.el | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index ed308ea1..c5c35eac 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -75,30 +75,7 @@ :config (define-key helpful-mode-map "J" #'forward-button) - (define-key helpful-mode-map "K" #'backward-button) - - (el-patch-defun helpful--read-symbol (prompt default-val predicate) - "Read a symbol from the minibuffer, with completion. -Returns the symbol." - (when (and default-val - (not (funcall predicate default-val))) - (setq default-val nil)) - (when default-val - ;; `completing-read' expects a string. - (setq default-val (symbol-name default-val)) - - ;; TODO: Only modify the prompt when we don't have ido/ivy/helm, - ;; because the default is obvious for them. - (setq prompt - (replace-regexp-in-string - (rx ": " eos) - (format " (default: %s): " default-val) - prompt))) - (intern (completing-read prompt - (el-patch-swap obarray - #'help--symbol-completion-table) - predicate t nil nil - default-val)))) + (define-key helpful-mode-map "K" #'backward-button)) (use-package macrostep :defer-install t From 58df92b276ed851be9c46f3447343c1f965b4b01 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 20 Sep 2022 23:18:24 -0700 Subject: [PATCH 252/303] Update patch inlining helm-projectile --- modules/config-helm.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 1518bfb0..5b400cd0 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -263,11 +263,14 @@ :persistent-action #'helm-ff-kill-or-find-buffer-fname) "Helm source definition for recent files not in current project.") + (el-patch-defvar helm-source-projectile-files-list-before-init-hook + (lambda () + (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) + (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))) + (el-patch-defvar helm-source-projectile-files-list (helm-build-sync-source "Projectile files" - :before-init-hook (lambda () - (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) - (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) + :before-init-hook 'helm-source-projectile-files-list-before-init-hook :candidates (lambda () (when (projectile-project-p) (with-helm-current-buffer From b6c9d2712fb840e1467c2b6177f76fc7fad09d65 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 17 Oct 2022 17:10:21 -0700 Subject: [PATCH 253/303] Remove lsp-python-ms --- modules/config-python.el | 149 --------------------------------------- 1 file changed, 149 deletions(-) diff --git a/modules/config-python.el b/modules/config-python.el index 16d24011..6296d0cd 100644 --- a/modules/config-python.el +++ b/modules/config-python.el @@ -113,155 +113,6 @@ Return either a string or nil." (setq mode-name "Py") (setq-local tab-width 4))) - ;; Use the Microsoft python ls if we can - (use-package lsp-python-ms - :init - (require 'lsp-python-ms) - (add-hook 'python-mode-hook - (my/defun-as-value my/python-mode-maybe-lsp (&rest _) - (unless (file-remote-p buffer-file-name) - (lsp-deferred)))) - - (el-patch-feature lsp-python-ms) - - :config - (eval-when-compile - (with-demoted-errors "Load error: %s" - (require 'lsp) - (require 'el-patch))) - (setq lsp-pylsp-plugins-pydocstyle-enabled nil) - (lsp-register-client - (make-lsp-client - :new-connection (lsp-tramp-connection - (my/defun-as-value my/python-find-mspyls () - (my/local-executable-find "mspyls"))) - :major-modes (append '(python-mode) lsp-python-ms-extra-major-modes) - :remote? t - :server-id 'mspyls-remote - :priority -3 - :initialization-options 'lsp-python-ms--extra-init-params - :notification-handlers - (lsp-ht ("python/languageServerStarted" - 'lsp-python-ms--language-server-started-callback) - ("telemetry/event" 'ignore) - ("python/reportProgress" - 'lsp-python-ms--report-progress-callback) - ("python/beginProgress" 'lsp-python-ms--begin-progress-callback) - ("python/endProgress" 'lsp-python-ms--end-progress-callback)) - :initialized-fn - (lambda (workspace) - (with-lsp-workspace workspace - (lsp--set-configuration (lsp-configuration-section "python")))))) - - ;; when on arch, check if we can use the system ls - (let ((system-ls "/usr/lib/microsoft-python-language-server/") - (system-ls-bin (executable-find "mspyls"))) - (if (and (file-directory-p system-ls) system-ls-bin) - (setq lsp-python-ms-dir system-ls - lsp-python-ms-executable system-ls-bin) - (setq lsp-python-ms-dir - (locate-user-emacs-file "data/mspyls") - lsp-python-ms-executable - (concat lsp-python-ms-dir - "Microsoft.Python.LanguageServer" - (and (eq system-type 'windows-nt) ".exe"))))) - - (el-patch-defun lsp-python-ms-locate-python (&optional dir) - "Look for virtual environments local to the workspace." - (let* ((el-patch-add - (virtualenv (my/python-find-virtualenv-cached dir)) - (virtualenv-python (and virtualenv (f-expand "bin/python" virtualenv)))) - (pyenv-python (lsp-python-ms--dominating-pyenv-python dir)) - (venv-python (lsp-python-ms--dominating-venv-python dir)) - (conda-python (lsp-python-ms--dominating-conda-python dir)) - (sys-python (if (>= emacs-major-version 27) - (executable-find lsp-python-ms-python-executable-cmd lsp-python-ms-prefer-remote-env) - (executable-find lsp-python-ms-python-executable-cmd)))) - ;; pythons by preference: local pyenv version, local conda version - - (if lsp-python-ms-guess-env - (cond ((lsp-python-ms--valid-python lsp-python-ms-python-executable)) - (el-patch-add ((lsp-python-ms--valid-python virtualenv-python))) - ((lsp-python-ms--valid-python venv-python)) - ((lsp-python-ms--valid-python pyenv-python)) - ((lsp-python-ms--valid-python conda-python)) - ((lsp-python-ms--valid-python sys-python))) - (cond ((lsp-python-ms--valid-python sys-python)))))) - - (el-patch-defun lsp-python-ms--get-python-ver-and-syspath (&optional workspace-root) - "Return list with pyver-string and list of python search paths. - -The WORKSPACE-ROOT will be prepended to the list of python search -paths and then the entire list will be json-encoded." - (let* ((python (and t (lsp-python-ms-locate-python))) - (workspace-root (and python (or workspace-root "."))) - (default-directory (and workspace-root workspace-root)) - (init (and default-directory - "from __future__ import print_function; import sys; sys.path = list(filter(lambda p: p != '', sys.path)); import json;")) - (ver (and init "v=(\"%s.%s\" % (sys.version_info[0], sys.version_info[1]));")) - (sp (and ver (concat "sys.path.insert(0, '" workspace-root "'); p=sys.path;"))) - (ex (and sp "e=sys.executable;")) - (val (and ex "print(json.dumps({\"version\":v,\"paths\":p,\"executable\":e}))"))) - (when val - (with-temp-buffer - (el-patch-wrap 3 - (if (tramp-tramp-file-p python) - (with-parsed-tramp-file-name python parsed - (let ((default-directory (file-name-directory python))) - (process-file parsed-localname nil t nil "-c" - (concat init ver sp ex val)))) - (call-process python nil t nil "-c" - (concat init ver sp ex val)))) - (let* ((json-array-type 'vector) - (json-key-type 'string) - (json-object-type 'hash-table) - (json-string (buffer-string)) - (json-hash (json-read-from-string json-string))) - (list - (gethash "version" json-hash) - (gethash "paths" json-hash) - (gethash "executable" json-hash))))))) - - (el-patch-defun lsp-python-ms--extra-init-params (&optional workspace) - "Return form describing parameters for language server. - -Old lsp will pass in a WORKSPACE, new lsp has a global -lsp-workspace-root function that finds the current buffer's -workspace root. If nothing works, default to the current file's -directory" - (let ((workspace-root - (if workspace (lsp--workspace-root workspace) - (lsp-python-ms--workspace-root)))) - (when lsp-python-ms-parse-dot-env-enabled - (lsp-python-ms--parse-dot-env workspace-root)) - (cl-destructuring-bind (pyver pysyspath pyintpath) - (lsp-python-ms--get-python-ver-and-syspath workspace-root) - `(:interpreter - (:properties - (:InterpreterPath - ,(el-patch-wrap 1 (my/tramp-localname pyintpath)) - :UseDefaultDatabase t - :Version ,pyver)) - ;; preferredFormat "markdown" or "plaintext" experiment - ;; to find what works best -- over here mostly plaintext - :displayOptions - (:preferredFormat - "markdown" - :trimDocumentationLines :json-false - :maxDocumentationLineLength 0 - :trimDocumentationText :json-false - :maxDocumentationTextLength 0) - :searchPaths - ,(vconcat lsp-python-ms-extra-paths - (el-patch-wrap 3 - (cl-map 'vector #'my/tramp-localname pysyspath))) - :analysisUpdates t - :asyncStartup t - :logLevel ,lsp-python-ms-log-level - :typeStubSearchPaths - ,(vector (expand-file-name - (f-join lsp-python-ms-dir "Typeshed")))))))) - (add-hook 'python-mode-hook #'eldoc-mode) (with-eval-after-load 'lsp-mode From ebfedfb0ebf902b2594644adcb4d15507f58c9d1 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sat, 5 Nov 2022 01:57:51 -0700 Subject: [PATCH 254/303] Add clipetty-mode --- modules/config-paste.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/config-paste.el b/modules/config-paste.el index 4968b832..a474ac84 100644 --- a/modules/config-paste.el +++ b/modules/config-paste.el @@ -54,6 +54,8 @@ (lambda () (xterm-mouse-mode -1)))) +(use-package clipetty) + (defun my/setup-paste (&optional frame) (with-selected-frame (or frame (selected-frame)) (unless (display-graphic-p) @@ -62,6 +64,8 @@ (executable-find "pbcopy"))) (xclip-mode +1)) + (global-clipetty-mode +1) + ;; just in case the terminal is a failure (defvar arrow-keys-brace-map (make-sparse-keymap) "Keymap for untranslated brace arrow keys") From 99b656f0907cc9bf28ae9498a7ccc44dedd82445 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 17 Jan 2023 13:34:08 -0800 Subject: [PATCH 255/303] Hide stderr from mdfind in helm-locate on macOS --- modules/config-helm.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 5b400cd0..faa0ddb6 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -1,7 +1,8 @@ ;; -*- lexical-binding: t -*- (eval-when-compile (require 'config-macros) - (require 'config-package)) + (require 'config-package) + (require 'el-patch)) (use-package helm-flx :config @@ -162,6 +163,7 @@ (rx "#" line-end) (rx "~" line-end) (rx ".zwc" (opt ".old") line-end) + (rx ".DS_Store" line-end) (rx "/.#")))) (define-advice helm-ff-directory-files @@ -321,7 +323,7 @@ helm-locate-command "locate %s -r %s -e -l 100")) ((eq system-type 'darwin) (setq helm-locate-fuzzy-match nil - helm-locate-command "mdfind -name %s %s"))) + helm-locate-command "mdfind -name %s %s 2> /dev/null"))) (el-patch-defvar helm-source-locate (helm-make-source "Locate" 'helm-locate-source From 843dd7218183a0af34dba9c63e6e3b35dfee2900 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Feb 2023 11:34:17 -0800 Subject: [PATCH 256/303] Prevent evil from overriding CUA shift-select bindings --- modules/config-evil.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-evil.el b/modules/config-evil.el index e42b4e78..a146dd7c 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -43,6 +43,9 @@ (define-key evil-motion-state-map (kbd "") #'evil-next-visual-line) (define-key evil-normal-state-map (kbd "") #'evil-previous-visual-line) + (define-key evil-insert-state-map (kbd "S-") nil) + (define-key evil-insert-state-map (kbd "S-") nil) + (key-chord-define evil-insert-state-map "jj" #'evil-normal-state) (key-chord-define evil-replace-state-map "jj" #'evil-normal-state) (key-chord-define evil-emacs-state-map "jj" #'evil-normal-state) From 07dceefefd4f440c355ca0b384f5cfeaf74ab7f0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 1 Feb 2023 11:42:33 -0800 Subject: [PATCH 257/303] Add more math words to dictionary --- data/user-dict.en.pws | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/user-dict.en.pws b/data/user-dict.en.pws index 73098315..44558591 100644 --- a/data/user-dict.en.pws +++ b/data/user-dict.en.pws @@ -1,4 +1,4 @@ -personal_ws-1.1 en 45 +personal_ws-1.1 en 55 Frobenius Gaussians Hayase @@ -6,6 +6,8 @@ Kolmogorov Lipschitz Reidemeister Schatten +Schwarz +adaptively biconditional bijection cardinality @@ -14,9 +16,12 @@ colorings conjugacy contrapositive cosets +cyclicity +disincentivize durations equisatisfiable factorizations +functionals incompressible indeterminates inequivalent @@ -33,7 +38,12 @@ nondecreasing nonincreasing nonnegative nontrivially +orthonormal pointwise +polytope +preimage +quartic +rotationally satisfiable subadditivity subfield From f1a28ea445afac58f6c4a1ac57900fe49d2ea40b Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 13:34:12 -0800 Subject: [PATCH 258/303] Enable company-box on macOS --- modules/config-company.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/config-company.el b/modules/config-company.el index 1a04e272..e6caeff8 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -44,13 +44,12 @@ ('text-mode-hook '(company-ispell)) ('go-mode-hook '(company-go))))))) - (unless (memq window-system '(mac ns)) - (use-package company-box - :init - (add-hook 'company-mode-hook #'company-box-mode) - :config - (diminish 'company-box-mode) - (setq company-box-enable-icon nil))) + (use-package company-box + :init + (add-hook 'company-mode-hook #'company-box-mode) + :config + (diminish 'company-box-mode) + (setq company-box-enable-icon nil)) :config (diminish 'company-mode (if (display-graphic-p) " ❃" " *")) From 6ecfc61021dd63846195e39ad8de2ca44eeaaf11 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 13:51:08 -0800 Subject: [PATCH 259/303] Fix iflipb At some point the hacks I was using were no longer needed. --- modules/config-ui.el | 53 +++++++------------------------------------- 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index a0cbb4fd..52c2e550 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -299,44 +299,13 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." ;;; ==================================== (use-package iflipb :init - (defhydra iflipb-hydra (:pre - (setq hydra-is-helpful nil) - :post - (setq hydra-is-helpful t)) - ("" - (call-interactively #'iflipb-next-buffer)) - ("TAB" - (call-interactively #'iflipb-next-buffer)) - ("" - (call-interactively #'iflipb-previous-buffer)) - ("" - (call-interactively #'iflipb-previous-buffer)) - ("" - (call-interactively #'iflipb-previous-buffer))) - - (defun iflipb-next-buffer-smart () - "A `hydra' enabled next-buffer" - (interactive) - (require 'iflipb) - (let ((my/iflipb-first t)) - (call-interactively #'iflipb-next-buffer)) - (iflipb-hydra/body)) - - (defun iflipb-previous-buffer-smart () - "A `hydra' enabled previous-buffer" - (interactive) - (require 'iflipb) - (let ((my/iflipb-first t)) - (call-interactively #'iflipb-previous-buffer)) - (iflipb-hydra/body)) - - (global-set-key (kbd "") #'iflipb-next-buffer-smart) - (global-set-key (kbd "C-S-") #'iflipb-previous-buffer-smart) - (global-set-key (kbd "") #'iflipb-previous-buffer-smart) - - (global-set-key (kbd "C-c TAB") #'iflipb-next-buffer-smart) - (global-set-key (kbd "C-c ") #'iflipb-previous-buffer-smart) - (global-set-key (kbd "C-c ") #'iflipb-previous-buffer-smart) + (global-set-key (kbd "") #'iflipb-next-buffer) + (global-set-key (kbd "C-S-") #'iflipb-previous-buffer) + (global-set-key (kbd "") #'iflipb-previous-buffer) + + (global-set-key (kbd "C-c TAB") #'iflipb-next-buffer) + (global-set-key (kbd "C-c ") #'iflipb-previous-buffer) + (global-set-key (kbd "C-c ") #'iflipb-previous-buffer) (global-set-key (kbd "") #'iflipb-previous-buffer) (global-set-key (kbd "") #'iflipb-next-buffer) @@ -352,13 +321,7 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." (rx line-start "*anaconda") (rx line-start "*" (zero-or-more anything) "output*") (rx line-start "*straight-process*")) - iflipb-wrap-around t) - - (defvar my/iflipb-first nil) - - (define-advice iflipb-first-iflipb-buffer-switch-command - (:override (&rest _args) return-my/iflipb-first) - my/iflipb-first)) + iflipb-wrap-around t)) ;; also allow undo/redo on window configs (add-hook 'window-configuration-change-hook #'winner-mode) From 1455fa697038996d8a68c6020976e38d5c053e66 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 13:57:15 -0800 Subject: [PATCH 260/303] Fix loading of flx-rs on macOS --- modules/config-ivy.el | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index 38f81b6a..25fc6bce 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -54,26 +54,18 @@ recursion depth in the minibuffer prompt. This is only useful if (global-set-key (kbd "C-M-s") #'flx-isearch-forward) (global-set-key (kbd "C-M-r") #'flx-isearch-backward)) -(when (string-prefix-p "x86_64" system-configuration) - (use-package flx-rs - :recipe - (flx-rs :type git - :host github - :repo "jcs-elpa/flx-rs" - :files ("*.el" "bin/*")) - :init - (with-eval-after-load 'flx - (require 'flx-rs) - (advice-add 'flx-score :override #'flx-rs-score)) - :config - (setq flx-rs-bin-dir - (eval-when-compile - (require 'find-func) - (file-name-directory (find-library-name "flx-rs")))) - (define-advice flx-rs-load-dyn - (:around (old-fun &rest args) quiet) - (let ((message-log-max)) - (apply old-fun args))))) +(use-package flx-rs + :recipe (flx-rs :type git :host github :repo "emacsmirror/flx-rs" :files ("bin" "*.el")) + :init + (with-eval-after-load 'flx + (require 'flx-rs) + (advice-add 'flx-score :override #'flx-rs-score)) + + :config + (define-advice flx-rs-load-dyn + (:around (old-fun &rest args) quiet) + (let ((message-log-max)) + (apply old-fun args)))) (use-package historian :init From c1828a48c4ed6a84ec7b3a736c5e701d73a59e8c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 14:10:54 -0800 Subject: [PATCH 261/303] Add copilot --- modules/config-intel.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/config-intel.el b/modules/config-intel.el index f9b58265..ec44bbff 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -525,6 +525,16 @@ is binary, activate `hexl-mode'." "dpaste.de" "gist.github.com"))) +;;; ============================================= +;;; github copilot - AI code completion for Emacs +;;; ============================================= + +(use-package copilot + :recipe (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) + :config + (evil-define-key 'insert copilot-mode-map (kbd "") + #'copilot-accept-completion)) + ;;; ============================================ ;;; open a file manager in the current directory ;;; ============================================ From 6289f3245e1eaf3aeffc0cde982dccb41095ce7c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 17:33:47 -0800 Subject: [PATCH 262/303] Unify configuration of evil-nerd-commenter --- modules/config-evil-modules.el | 6 +++++- modules/config-evil-textobjects.el | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/config-evil-modules.el b/modules/config-evil-modules.el index 2125f4d8..4183721f 100644 --- a/modules/config-evil-modules.el +++ b/modules/config-evil-modules.el @@ -56,7 +56,11 @@ ;; evil NERD commenter, commenting awesomeness! (use-package evil-nerd-commenter - :init (global-set-key (kbd "M-;") #'evilnc-comment-or-uncomment-lines)) + :commands (evilnc-comment-operator) + :init + (global-set-key (kbd "M-;") #'evilnc-comment-or-uncomment-lines) + (define-key evil-operator-state-map "gc" #'evilnc-comment-operator) + (define-key evil-normal-state-map "gc" #'evilnc-comment-operator)) (use-package evil-matchit :commands (evilmi-inner-text-object diff --git a/modules/config-evil-textobjects.el b/modules/config-evil-textobjects.el index 460c03b9..b949f19e 100644 --- a/modules/config-evil-textobjects.el +++ b/modules/config-evil-textobjects.el @@ -185,10 +185,6 @@ (define-key evil-inner-text-objects-map "P" #'evil-inner-last-paste) ;;; === evil operators === -(autoload #'evilnc-comment-operator "evil-nerd-commenter") -(autoload #'evilnc-hotkey-comment-operator "evil-nerd-commenter") -(define-key evil-operator-state-map "gc" #'evilnc-comment-operator) -(define-key evil-normal-state-map "gc" #'evilnc-comment-operator) (evil-define-operator evil-macro-on-all-lines (beg end &optional _arg) (evil-with-state 'normal From bfabb789be08e3b918e03a14de640cf23353520c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 8 Feb 2023 17:38:37 -0800 Subject: [PATCH 263/303] Remove old fix-key-chords function --- modules/config-evil.el | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/config-evil.el b/modules/config-evil.el index a146dd7c..0684a87b 100644 --- a/modules/config-evil.el +++ b/modules/config-evil.el @@ -3,14 +3,7 @@ (require 'config-macros) (require 'config-package)) -(use-package key-chord - :init - (defun fix-key-chords () - (interactive) - (key-chord-mode -1) - (key-chord-mode +1)) - - (key-chord-mode +1)) +(use-package key-chord :init (key-chord-mode +1)) (use-package evil :init (evil-mode +1) From 6e3657cf0af402f265e79ea243a624f19fa06a1f Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 15 Feb 2023 16:21:09 -0800 Subject: [PATCH 264/303] Remove vestigial recentf patch Patch to recentf-track-closed-file appears to be redundant --- modules/config-desktop.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 9d83d1e3..7a28e5bc 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -301,18 +301,12 @@ where it was when you previously visited the same file." recentf-track-closed-file recentf-save-list) :init - ;; TODO: Why is this necessary? - (defun my/recentf-track-closed-file-maybe () - (and buffer-file-name - (recentf-track-closed-file))) - (el-patch-feature recentf) (el-patch-defconst recentf-used-hooks '((find-file-hook recentf-track-opened-file) (write-file-functions recentf-track-opened-file) - (kill-buffer-hook (el-patch-swap recentf-track-closed-file - my/recentf-track-closed-file-maybe)) + (kill-buffer-hook recentf-track-closed-file) (kill-emacs-hook recentf-save-list)) "Hooks used by recentf.") From 4d79030804fe61c6909a2d9a25f536caaabf2b26 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Feb 2023 15:28:15 -0800 Subject: [PATCH 265/303] Switch auctex-latexmk to emacsmirror fork --- modules/config-tex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index aaf34e8a..8962b2a5 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -264,7 +264,7 @@ command." :type git :flavor melpa :host github - :repo "wang1zhen/auctex-latexmk") + :repo "emacsmirror/auctex-latexmk") :commands (auctex-latexmk-setup) :init (auctex-latexmk-setup) From 1fe3945b0f541753130221a6bd34da6b26b5b7cb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Mar 2023 14:31:26 -0800 Subject: [PATCH 266/303] Fix compiler warnings in config-tex --- modules/config-tex.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 8962b2a5..b5915c7f 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -495,13 +495,13 @@ matching string." (setq my/LaTeX-environment-or-macro-default thing) (if (not (assoc thing symbol-list)) (let ((entry (assoc thing (LaTeX-environment-list)))) - (when (interactive-p) + (when (called-interactively-p) (setq LaTeX-default-environment thing)) (if (null entry) (LaTeX-add-environments (list thing))) (if arg (LaTeX-modify-environment thing) (LaTeX-environment-menu thing))) - (when (interactive-p) + (when (called-interactively-p) (setq TeX-default-macro thing)) (TeX-parse-macro thing (cdr-safe (assoc thing (TeX-symbol-list)))) (run-hooks 'TeX-after-insert-macro-hook)))) @@ -704,7 +704,8 @@ outer indentation in case of a commented line. The symbols ("\\PP" "ℙ") ("\\QQ" "ℚ") ("\\RR" "ℝ") - ("\\ZZ" "ℤ")) + ("\\ZZ" "ℤ") + ("\\implies" "⟹")) (mapc (lambda (x) (if (cddr x) (quail-defrule (cadr x) (caddr x)))) From 38ba4d4b684d930706c461f2b3a47addd0e5a088 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Mar 2023 15:07:52 -0800 Subject: [PATCH 267/303] Add singularity-mode --- modules/config-modes.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index c5c35eac..68088cbf 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1201,6 +1201,21 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" dockerfile-mode) :mode (("Dockerfile.*\\'" . dockerfile-mode))) +(use-package singularity-mode + :recipe (singularity-mode :type git + :host github + :repo "karljohanw/singularity-mode") + :defer-install t + :commands (singularity-mode) + :mode (("\\.def$" . singularity-mode)) + :config + ;; TODO: major SMIE annoyances here + (require 'dtrt-indent) + (add-to-list 'dtrt-indent-hook-mapping-list + '(singularity-mode default singularity-indent)) + + (add-hook 'singularity-mode-hook #'dtrt-indent-adapt)) + (use-package cmake-mode :defer-install t :commands (cmake-mode From f54fcf5824187666f82c5822b25ae68cbde5abfb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 28 Feb 2023 15:28:55 -0800 Subject: [PATCH 268/303] Fix loading of expand-region --- modules/config-ui.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config-ui.el b/modules/config-ui.el index 52c2e550..c49ee58d 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -445,7 +445,6 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." (global-set-key (kbd "C-4") #'find-file-other-window) (global-set-key (kbd "C-5") #'make-frame-command) (global-set-key (kbd "M-j") #'evil-join) -(global-set-key (kbd "C-.") #'er/expand-region) (define-key key-translation-map (kbd "") (kbd "")) (define-key key-translation-map (kbd "") (kbd "")) @@ -457,6 +456,10 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." :diminish subword-mode :init (global-subword-mode +1)) +(use-package expand-region + :config + (global-set-key (kbd "C-.") #'er/expand-region)) + ;; ========================================== ;; Window splitting that is actually sensible ;; ========================================== From e48a9307b6e7ad9418901bcbab3345770c354d79 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 5 Apr 2023 00:57:43 -0700 Subject: [PATCH 269/303] Add gitignore-templates --- modules/config-modes.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 68088cbf..f9356372 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1163,6 +1163,11 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" ("/\\.git/info/exclude\\'" . gitignore-mode) ("/git/ignore\\'" . gitignore-mode))) +(use-package gitignore-templates + :defer-install t + :commands (gitignore-templates-insert + gitignore-templates-new-file)) + (use-package ssh-config-mode :defer-install t :commands (ssh-config-mode From 57d515587643d694ccec68290db62319c1af9684 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 5 Apr 2023 00:59:16 -0700 Subject: [PATCH 270/303] Keep disconnected TRAMP files in recentf --- modules/config-desktop.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/config-desktop.el b/modules/config-desktop.el index 7a28e5bc..729e7eff 100644 --- a/modules/config-desktop.el +++ b/modules/config-desktop.el @@ -316,10 +316,17 @@ where it was when you previously visited the same file." (dolist (hook recentf-used-hooks) (apply #'add-hook hook)))) :config + (defun quark/recentf-keep-predicate (file) + (cond + ((file-remote-p file nil t) (file-readable-p file)) + ((file-remote-p file) t) + ((file-readable-p file)))) + (setq recentf-save-file (locate-user-emacs-file "data/recentf") recentf-max-saved-items 1000 recentf-max-menu-items 50 - recentf-auto-cleanup 30) + recentf-auto-cleanup 30 + recentd-keep '(quark/recentf-keep-predicate)) (add-to-list 'recentf-exclude (eval-when-compile (concat (rx line-start) (expand-file-name From c41fbbf5a9357169586710350e0902bb411b90ec Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jun 2023 21:40:09 +0000 Subject: [PATCH 271/303] remove idle loading of magit-obsolete --- modules/config-package.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-package.el b/modules/config-package.el index e2828020..38762ea4 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -267,7 +267,6 @@ these values are used to call `use-package-ensure-function'.")) (my/load-magit-submodule 'magit-bookmark) (my/load-magit-submodule 'magit-submodule) -(my/load-magit-submodule 'magit-obsolete) (my/load-magit-submodule 'magit-blame) (my/load-magit-submodule 'magit-stash) (my/load-magit-submodule 'magit-bisect) From 4c2e39f4b7b2c545e55aaced7059af4636121d0e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 13 Jun 2023 21:43:06 +0000 Subject: [PATCH 272/303] straight: update to boostrap version 6 --- modules/config-package.el | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index 38762ea4..c815bdf3 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -14,18 +14,17 @@ straight-recipes-gnu-elpa-use-mirror t) (defvar bootstrap-version) - (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (unless (featurep 'straight) - (load bootstrap-file nil 'nomessage)))) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 6)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage))) ;; ============================================= ;; Setup use-package From 844f8a14d7be3d6540fc17ef67e7e251e237c1cf Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 4 Feb 2024 20:04:29 -0800 Subject: [PATCH 273/303] Switch to hlissner fork of ws-butler --- modules/config-whitespace.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index 983b22d7..5e1e8d65 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -186,6 +186,9 @@ extra indent = 2 (set-buffer-file-coding-system 'utf-8))) (use-package ws-butler + :recipe (ws-butler :type git + :host github + :repo "hlissner/ws-butler") :diminish (ws-butler-mode ." β") :init ;; autoload ws-butler on file open From d5eef2e81ace620f6c6ebc957b17d96f26893519 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Feb 2024 23:06:12 -0800 Subject: [PATCH 274/303] Update straight bootstrap to version 7 --- modules/config-package.el | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index c815bdf3..95aee394 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -8,23 +8,26 @@ (eval-and-compile (setq straight-repository-branch "develop" - straight-check-for-modifications 'live + straight-check-for-modifications '(check-on-save) straight-use-package-version 'ensure straight-use-package-by-default t straight-recipes-gnu-elpa-use-mirror t) (defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 6)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage))) + (let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage))) ;; ============================================= ;; Setup use-package From 0bfde7ec4d905b0402c41075fc842173fc1e3a9d Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Feb 2024 23:13:14 -0800 Subject: [PATCH 275/303] Stop hardcoding clipboard variables Fixes pasting from other programs in wayland --- modules/config-core.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/config-core.el b/modules/config-core.el index fa539a9b..7d1f85c6 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -21,10 +21,6 @@ inhibit-startup-echo-area-message t inhibit-startup-screen t inhibit-x-resources t - interprogram-cut-function (and (fboundp #'x-select-text) - #'x-select-text) - interprogram-paste-function (and (fboundp #'x-selection-value) - #'x-selection-value) jit-lock-defer-time 0.04 jit-lock-stealth-nice 0.1 jit-lock-stealth-time 0.2 @@ -49,7 +45,6 @@ user-full-name "PythonNut" user-mail-address "PythonNut@PythonNut.com" visible-cursor nil - x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) x-stretch-cursor t) (setq-default bidi-display-reordering 'left-to-right From 37ffc3bf478fde6e605d842b20c73a84e349b737 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Feb 2024 23:38:17 -0800 Subject: [PATCH 276/303] Switch back to mainline f recipe --- modules/config-package.el | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/config-package.el b/modules/config-package.el index 95aee394..85cb0cd4 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -165,11 +165,7 @@ these values are used to call `use-package-ensure-function'.")) (autoload 'hydra-default-pre "hydra")) (use-package s) -(use-package f - :recipe (f - :fetcher github - :repo "rejeep/f.el" - :files ("f.el" "f-shortdoc.el"))) +(use-package f) (use-package restart-emacs) (use-package exec-path-from-shell From 6a0496c9985632a5a4153a8da384b89d83962f79 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 15 Feb 2024 23:38:59 -0800 Subject: [PATCH 277/303] Remove obsolete rmail-loaddefs lazy load --- modules/config-package.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/config-package.el b/modules/config-package.el index 85cb0cd4..27535da4 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -310,7 +310,6 @@ these values are used to call `use-package-ensure-function'.")) (idle-job-add-require 'epg) (idle-job-add-require 'gnus-util) (idle-job-add-require 'rmail) -(idle-job-add-require 'rmail-loaddefs) (idle-job-add-require 'mm-decode) (idle-job-add-require 'mm-bodies) (idle-job-add-require 'mail-parse) From 086d27d5ad05a19893f062c268e37b1a99d43443 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 16 Feb 2024 02:06:46 -0800 Subject: [PATCH 278/303] Let arrows in helm move between sources --- modules/config-helm.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index faa0ddb6..652c8607 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -32,7 +32,8 @@ (setq helm-case-fold-search 'smart helm-candidate-separator (make-string 20 ?─) helm-display-header-line nil - helm-inherit-input-method nil)) + helm-inherit-input-method nil + helm-move-to-line-cycle-in-source nil)) (use-package helm-info :ensure nil From e7757e9715c821f5efe26a205a51cb4e5d604fab Mon Sep 17 00:00:00 2001 From: PythonNut Date: Sun, 18 Feb 2024 16:31:08 -0800 Subject: [PATCH 279/303] Only use locate when installed --- modules/config-helm.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-helm.el b/modules/config-helm.el index 652c8607..1e753c0b 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -434,8 +434,8 @@ ;; file location, of which projectile is a faster subset ;; (unless projectile-root ;; '(helm-source-findutils)) - - '(helm-source-locate) + (when (executable-find (car (split-string-shell-command helm-locate-command))) + '(helm-source-locate)) ))) :fuzzy-match t From 080ace218a7703563ac2d592696e3dd160bc716a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 22 Feb 2024 21:57:33 -0800 Subject: [PATCH 280/303] Open .jsonl files in json-mode --- modules/config-modes.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index f9356372..20fad616 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -175,6 +175,7 @@ json-mode-show-path json-mode-beautify) :mode (("\\.json$" . json-mode) + ("\\.jsonl$" . json-mode) ("\\.jsonld$" . json-mode))) ;; ============================================================================= From c4683fff747cf6a444d59c5477860729e75ae6f0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 20 Mar 2024 10:39:51 -0700 Subject: [PATCH 281/303] Ergonomic improvements for dired --- modules/config-modes.el | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index 20fad616..bdcecb46 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -710,33 +710,35 @@ (defun dired-first-file () (interactive) (goto-char (point-min)) - (dired-next-line 4)) + (dired-next-line 3)) (defun dired-last-file () (interactive) (goto-char (point-max)) (dired-next-line -1)) - (defun dired-up-directory () + (defun dired-really-do-delete (&optional arg) + (interactive "P") + (let ((delete-by-moving-to-trash nil)) + (dired-do-delete arg))) + + (defun quark/dired-up-directory () "Take dired up one directory, but behave like dired-find-alternate-file" (interactive) (let ((old (current-buffer))) (dired-up-directory) (kill-buffer old))) - (defun dired-enable-wdired () - (interactive) - (unless (evil-insert-state-p) - (evil-insert-state)) - (wdired-change-to-wdired-mode)) - (with-eval-after-load 'evil - (evil-define-key 'normal dired-mode-map "h" #'dired-up-directory) + (with-eval-after-load 'wdired + (remove-hook 'wdired-mode-hook #'evil-change-to-initial-state)) + + (evil-define-key 'normal dired-mode-map "h" #'quark/dired-up-directory) (evil-define-key 'normal dired-mode-map "l" #'dired-find-alternate-file) (evil-define-key 'normal dired-mode-map "j" #'dired-next-line) (evil-define-key 'normal dired-mode-map "k" #'dired-previous-line) - (evil-define-key 'normal dired-mode-map "I" #'dired-enable-wdired) + (evil-define-key 'normal dired-mode-map "I" #'wdired-change-to-wdired-mode) (evil-define-key 'normal dired-mode-map "o" #'dired-sort-toggle-or-edit) (evil-define-key 'normal dired-mode-map "m" #'dired-toggle-marks) @@ -749,32 +751,30 @@ (evil-define-key 'normal dired-mode-map "n" #'evil-search-next) (evil-define-key 'normal dired-mode-map "N" #'evil-search-previous) (evil-define-key 'normal dired-mode-map "q" #'kill-this-buffer) + (evil-define-key 'normal dired-mode-map "gg" #'dired-first-file) - (defun my/dired-avy-navigate-down () + (defun quark/dired-avy-navigate-down () (interactive) (evilem--jump (evilem--collect #'dired-next-line))) - (defun my/dired-avy-navigate-up () + (defun quark/dired-avy-navigate-up () (interactive) (evilem--jump (evilem--collect #'dired-previous-line))) - (defun my/dired-avy-find-file-down () + (defun quark/dired-avy-find-file-down () (interactive) - (my/dired-avy-navigate-down) + (quark/dired-avy-navigate-down) (dired-find-file)) - (defun my/dired-avy-find-file-up () + (defun quark/dired-avy-find-file-up () (interactive) - (my/dired-avy-navigate-up) + (quark/dired-avy-navigate-up) (dired-find-file)) - (evil-define-key 'normal dired-mode-map (kbd "SPC J") #'my/dired-avy-navigate-down) - - (evil-define-key 'normal dired-mode-map (kbd "SPC K") #'my/dired-avy-navigate-up) - - (evil-define-key 'normal dired-mode-map (kbd "SPC j") #'my/dired-avy-find-file-down) - - (evil-define-key 'normal dired-mode-map (kbd "SPC k") #'my/dired-avy-find-file-up)) + (evil-define-key 'normal dired-mode-map (kbd "SPC J") #'quark/dired-avy-navigate-down) + (evil-define-key 'normal dired-mode-map (kbd "SPC K") #'quark/dired-avy-navigate-up) + (evil-define-key 'normal dired-mode-map (kbd "SPC j") #'quark/dired-avy-find-file-down) + (evil-define-key 'normal dired-mode-map (kbd "SPC k") #'quark/dired-avy-find-file-up)) (define-key dired-mode-map (kbd " ") #'dired-first-file) From a552e5b0c473fc8d7b5946c11768588b8833ca0a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 28 Aug 2024 23:55:01 -0700 Subject: [PATCH 282/303] Add gross fix for unreadable .git dir in helm-interfile-omni --- modules/config-helm.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/config-helm.el b/modules/config-helm.el index 1e753c0b..85e3af58 100644 --- a/modules/config-helm.el +++ b/modules/config-helm.el @@ -395,6 +395,11 @@ (when projectile-root (projectile-maybe-invalidate-cache nil)) + (let ((git-dir (expand-file-name ".git" projectile-root))) + (when (and (file-exists-p git-dir) + (not (file-readable-p git-dir))) + (setq projectile-root nil))) + (unwind-protect (helm :sources (append From 8fab5a4c3dc0fb00fcdaf4cd23e9c635e9e9c5ba Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 28 Aug 2024 23:55:56 -0700 Subject: [PATCH 283/303] Do not save su-mode buffers on frame blur --- modules/config-safety.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/config-safety.el b/modules/config-safety.el index 3968eab1..251856e4 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -115,7 +115,16 @@ when `auto-save-mode' is invoked manually.") 'focus-out-hook (my/defun-as-value quark/save-buffers-on-focus-out () (let ((inhibit-message t)) - (save-some-buffers t)))) + (save-some-buffers + t + (lambda () + ;; See def'n of files--buffers-needing-to-be-saved. Act as if + ;; pred is nil, but also check for su-auto-save-mode + (and + (or + buffer-file-name + (eq buffer-offer-save 'always)) + (not (bound-and-true-p su-auto-save-mode)))))))) (use-package autorevert :init From 9c25c569f86bdbbe4e12ab4bb8e38784cdcb86ee Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 29 Aug 2024 00:34:36 -0700 Subject: [PATCH 284/303] Always run flx-rs-load-dyn --- modules/config-ivy.el | 5 ++++- modules/config-package.el | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/config-ivy.el b/modules/config-ivy.el index 25fc6bce..ab72cdf6 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -65,7 +65,10 @@ recursion depth in the minibuffer prompt. This is only useful if (define-advice flx-rs-load-dyn (:around (old-fun &rest args) quiet) (let ((message-log-max)) - (apply old-fun args)))) + (apply old-fun args))) + + (let ((inhibit-message t)) + (flx-rs-load-dyn))) (use-package historian :init diff --git a/modules/config-package.el b/modules/config-package.el index 27535da4..5df8c516 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -354,6 +354,8 @@ these values are used to call `use-package-ensure-function'.")) (idle-job-add-require 'counsel) (idle-job-add-require 'swiper) (idle-job-add-require 'ivy) +(idle-job-add-require 'flx-rs) +(idle-job-add-require 'flx) (idle-job-add-require 'colir) (idle-job-add-require 'ivy-overlay) (idle-job-add-require 'ffap) From db17c8b410dcfbd24fb25cd6419af4bcacf2adb0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 9 Sep 2024 15:18:40 -0700 Subject: [PATCH 285/303] Try to use zsh for remote vterm --- modules/config-modes.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index bdcecb46..e3e6e3b9 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1094,7 +1094,18 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" :defer-install t :config (evil-set-initial-state 'vterm-mode 'emacs) - (set-face-foreground 'vterm-color-black "#586e75")) + (set-face-foreground 'vterm-color-black "#586e75") + + (define-advice vterm--get-shell + (:around (old-fun) prefer-zsh) + (require 's) + (let ((old (funcall old-fun))) + (if (not (s-suffix? "/sh" old)) + old + (or + (executable-find "zsh" t) + (executable-find "bash" t) + old))))) ;; ============================================================================= ;; Config file modes =========================================================== From 066a4524412254eea4c868d338443eb4b0f64fe0 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Mon, 9 Sep 2024 15:23:30 -0700 Subject: [PATCH 286/303] Use remote path for TRAMP --- modules/config-tramp.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-tramp.el b/modules/config-tramp.el index a39aa3f5..b74b7538 100644 --- a/modules/config-tramp.el +++ b/modules/config-tramp.el @@ -25,6 +25,7 @@ (with-eval-after-load 'tramp (eval-when-compile (require 'tramp)) + (add-to-list 'tramp-remote-path 'tramp-own-remote-path) (setq tramp-completion-use-auth-sources nil) ;; Define a rsyncx method analogous to scpx (add-to-list 'tramp-methods From 6ba41ffcf6e5d838ec58ce4d8ac71b97892e11fb Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Sep 2024 15:27:02 -0700 Subject: [PATCH 287/303] Add transpose-frame --- modules/config-ui.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/config-ui.el b/modules/config-ui.el index c49ee58d..5966e1cf 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -540,4 +540,16 @@ split." :commands (digit-groups-global-mode digit-groups-mode)) +;; ========================================================= +;; transpose-frame - high level window manipulation commands +;; ========================================================= + +(use-package transpose-frame + :commands (transpose-frame + flip-frame + flop-frame + rotate-frame + rotate-frame-clockwise + rotate-frame-anticlockwise)) + (provide 'config-ui) From 3dc044192c53b9d61b9cfe298df411b11542529e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Sep 2024 15:27:40 -0700 Subject: [PATCH 288/303] Rename dired-do-delete-skip-trash --- modules/config-modes.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-modes.el b/modules/config-modes.el index e3e6e3b9..69c5e39a 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -717,7 +717,7 @@ (goto-char (point-max)) (dired-next-line -1)) - (defun dired-really-do-delete (&optional arg) + (defun dired-do-delete-skip-trash (&optional arg) (interactive "P") (let ((delete-by-moving-to-trash nil)) (dired-do-delete arg))) From dbdee79f3031b63f047bff6f3492acf559e0ec79 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Sep 2024 17:30:36 -0700 Subject: [PATCH 289/303] Disable hl-line-mode in list-faces-display buffers --- modules/config-solarized.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config-solarized.el b/modules/config-solarized.el index 80e7c58f..f277ec8b 100644 --- a/modules/config-solarized.el +++ b/modules/config-solarized.el @@ -50,4 +50,10 @@ (set-face-background 'fringe "#022F3A") (set-face-background 'mode-line-inactive "#073642")) +(define-advice list-faces-display + (:after (&rest _args) turn-off-hl-line-mode) + (with-current-buffer (get-buffer "*Faces*") + (setq-local global-hl-line-mode nil + hl-line-mode nil))) + (provide 'config-solarized) From c5280cef50c1fa0e7fbecbb7ea9b39bd5df91114 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Tue, 10 Sep 2024 23:45:56 -0700 Subject: [PATCH 290/303] Use child theme to customize faces --- init.el | 5 ++- modules/config-avy-easymotion.el | 21 ---------- modules/config-company.el | 46 ++-------------------- modules/config-ivy.el | 19 +++------ modules/config-solarized.el | 59 ---------------------------- modules/config-ui.el | 24 +++++------ themes/quark-solarized-dark-theme.el | 48 ++++++++++++++++++++++ 7 files changed, 69 insertions(+), 153 deletions(-) delete mode 100644 modules/config-solarized.el create mode 100644 themes/quark-solarized-dark-theme.el diff --git a/init.el b/init.el index cb8de78c..eb2525a2 100644 --- a/init.el +++ b/init.el @@ -46,7 +46,8 @@ (setq my/slow-device t)) (eval-and-compile - (add-to-list 'load-path (locate-user-emacs-file "modules/"))) + (add-to-list 'load-path (locate-user-emacs-file "modules/")) + (add-to-list 'custom-theme-load-path (locate-user-emacs-file "themes/"))) ;; suppress the GNU spam (fset 'display-startup-echo-area-message #'ignore) @@ -127,5 +128,5 @@ (message "[============== ] modes") (my/require-config-module 'config-modes) (message "[===============] solarized") - (my/require-config-module 'config-solarized) + (load-theme 'quark-solarized-dark t) (message "[===============] done")) diff --git a/modules/config-avy-easymotion.el b/modules/config-avy-easymotion.el index ac806b9e..516409db 100644 --- a/modules/config-avy-easymotion.el +++ b/modules/config-avy-easymotion.el @@ -31,27 +31,6 @@ avy-timeout-seconds 0.3 avy-keys (eval-when-compile (string-to-list "jfkdlsaurieowncpqmxzb"))) - (defun my/avy-setup-faces () - (set-face-foreground 'avy-background-face "#586e75") - - (set-face-attribute 'avy-lead-face nil - :weight 'normal - :background nil - :foreground "#b58900" - :inherit nil) - (set-face-attribute 'avy-lead-face-0 nil - :weight 'extra-bold - :background nil - :foreground "#dc322f" - :inherit nil) - (set-face-attribute 'avy-lead-face-1 nil - :background nil - :foreground "#839493" - :inherit nil)) - - (my/avy-setup-faces) - (add-hook 'load-theme-hook #'my/avy-setup-faces) - (use-package evil ;; Note: evil is ensured in config-evil :ensure nil diff --git a/modules/config-company.el b/modules/config-company.el index e6caeff8..7f015a6a 100644 --- a/modules/config-company.el +++ b/modules/config-company.el @@ -12,8 +12,7 @@ :hook 'first-change-hook :after-hook 'emacs-startup-hook :condition (get-buffer-window) - (global-company-mode +1) - (run-hooks 'load-theme-hook)) + (global-company-mode +1)) (eval-and-compile (cl-macrolet @@ -109,47 +108,8 @@ (company-select-next-or-abort arg))) (define-key company-active-map (kbd "") #'company-select-above) - (define-key company-active-map (kbd "") #'company-select-below) - - (add-hook - 'load-theme-hook - (my/defun-as-value my/company-setup-tooltip-faces () - (set-face-attribute 'company-tooltip-common-selection nil - :background "#839496" - :foreground (if (< (display-color-cells) 256) - "black" - nil) - :underline nil - :inherit 'region) - - (set-face-attribute 'company-tooltip-selection nil - :background "#586e75" - :foreground nil - :inherit 'region) - - (set-face-attribute 'company-tooltip-common nil - :background nil - :underline nil - :inherit 'company-tooltip - :foreground "#586e75") - - (set-face-attribute 'company-tooltip-annotation nil - :foreground nil - :background nil - :inherit 'company-tooltip) - - (set-face-attribute 'company-tooltip nil - :foreground nil - :inherit 'default)))) - -(with-eval-after-load 'company-template - (add-hook - 'load-theme-hook - (my/defun-as-value my/company-setup-template-faces () - (set-face-attribute 'company-template-field nil - :foreground nil - :background nil - :inherit 'region)))) + (define-key company-active-map (kbd "") #'company-select-below)) + (with-eval-after-load 'company-dabbrev-code (eval-when-compile diff --git a/modules/config-ivy.el b/modules/config-ivy.el index ab72cdf6..96cb8f55 100644 --- a/modules/config-ivy.el +++ b/modules/config-ivy.el @@ -169,18 +169,11 @@ Minibuffer bindings: (require 'historian) (require 'ivy))) - (ivy-historian-mode +1) - - (defun my/ivy-setup-faces () - (set-face-attribute 'ivy-minibuffer-match-face-1 nil - :background nil) - (set-face-attribute 'ivy-minibuffer-match-face-2 nil - :background nil - :foreground "#268bd2") - - (setq ivy-minibuffer-faces (list 'ivy-minibuffer-match-face-1 - 'ivy-minibuffer-match-face-2))) + (setq ivy-minibuffer-faces + (list 'ivy-minibuffer-match-face-1 + 'ivy-minibuffer-match-face-2)) + (ivy-historian-mode +1) (diminish 'ivy-mode) (setq ivy-display-style 'fancy @@ -188,10 +181,8 @@ Minibuffer bindings: ivy-extra-directories nil ivy-count-format "" ivy-flx-limit 2000 - ivy-use-selectable-prompt t) + ivy-use-selectable-prompt t)) - (my/ivy-setup-faces) - (add-hook 'load-theme-hook #'my/ivy-setup-faces)) (use-package counsel :init diff --git a/modules/config-solarized.el b/modules/config-solarized.el deleted file mode 100644 index f277ec8b..00000000 --- a/modules/config-solarized.el +++ /dev/null @@ -1,59 +0,0 @@ -;; -*- lexical-binding: t -*- -(eval-when-compile - (require 'config-macros) - (require 'config-package)) - -(use-package solarized-theme) - -(define-advice load-theme - (:before (&rest _args) unload-themes) - ;; TODO: This is probably a horrible hack - (mapc #'disable-theme custom-enabled-themes)) - -(define-advice load-theme - (:after (&rest _args) run-hook) - (run-hooks 'load-theme-hook)) - -(add-hook - 'load-theme-hook - (my/defun-as-value my/setup-faces () - (set-face-attribute 'mode-line nil - :underline nil - :box nil - :overline nil) - (set-face-attribute 'mode-line-inactive nil - :underline nil - :box nil - :overline nil) - (set-face-attribute 'mode-line-buffer-id nil - :foreground nil) - (if (display-graphic-p) - (set-face-attribute 'vertical-border nil - :foreground nil - :inherit 'region) - - (let ((display-table (or standard-display-table (make-display-table)))) - (set-display-table-slot display-table 'vertical-border (make-glyph-code ?│)) - (setq standard-display-table display-table))))) - - -(if (<= (display-color-cells) 256) - (progn - (load-theme 'tango-dark) - (set-face-attribute 'font-lock-keyword-face nil - :weight 'extra-bold) - (set-face-attribute 'hl-line nil - :foreground nil - :background "grey20" - :inherit nil)) - (load-theme 'solarized-dark t) - (set-face-background 'fringe "#022F3A") - (set-face-background 'mode-line-inactive "#073642")) - -(define-advice list-faces-display - (:after (&rest _args) turn-off-hl-line-mode) - (with-current-buffer (get-buffer "*Faces*") - (setq-local global-hl-line-mode nil - hl-line-mode nil))) - -(provide 'config-solarized) diff --git a/modules/config-ui.el b/modules/config-ui.el index 5966e1cf..5c416d37 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -20,6 +20,16 @@ frame-inhibit-implied-resize t inhibit-compacting-font-caches t) +(define-advice list-faces-display + (:after (&rest _args) turn-off-hl-line-mode) + (with-current-buffer (get-buffer "*Faces*") + (setq-local global-hl-line-mode nil + hl-line-mode nil))) + +(let ((display-table (or standard-display-table (make-display-table)))) + (set-display-table-slot display-table 'vertical-border (make-glyph-code ?│)) + (setq standard-display-table display-table)) + (defun isearch-exit-chord-worker () "Exit out of isearch after a chord" (interactive) @@ -238,20 +248,6 @@ DIR should be 1 or -1 and COUNT should be a positive integer or nil." (defvar-local my/rainbow-delimiters-face-cookies nil "a list of face-remap-add-relative cookies to reset") - (defun my/rainbow-delimiters-setup-faces () - (set-face-foreground 'rainbow-delimiters-depth-1-face "#889899") - (set-face-foreground 'rainbow-delimiters-depth-2-face "#9b7b6b") - (set-face-foreground 'rainbow-delimiters-depth-3-face "#7b88a5") - (set-face-foreground 'rainbow-delimiters-depth-4-face "#889899") - (set-face-foreground 'rainbow-delimiters-depth-5-face "#839564") - (set-face-foreground 'rainbow-delimiters-depth-6-face "#6391aa") - (set-face-foreground 'rainbow-delimiters-depth-7-face "#9d748f") - (set-face-foreground 'rainbow-delimiters-depth-8-face "#7b88a5") - (set-face-foreground 'rainbow-delimiters-depth-9-face "#659896")) - - (my/rainbow-delimiters-setup-faces) - (add-hook 'load-theme-hook #'my/rainbow-delimiters-setup-faces) - (defun my/rainbow-delimiters-focus-on () "Punch the rainbow-delimiters" (setq my/rainbow-delimiters-face-cookies diff --git a/themes/quark-solarized-dark-theme.el b/themes/quark-solarized-dark-theme.el new file mode 100644 index 00000000..882cfd29 --- /dev/null +++ b/themes/quark-solarized-dark-theme.el @@ -0,0 +1,48 @@ +(eval-and-compile + (use-package solarized-theme) + (require 'solarized)) +(eval-when-compile + (require 'solarized-palettes)) + +(setq quark/solarized-faces + '("My personal solarized theme customization." + (custom-theme-set-faces + theme-name + `(mode-line + ((,class (:inverse-video unspecified + :foreground ,s-mode-line-fg + :background ,s-mode-line-bg)))) + `(mode-line-inactive + ((,class (:inverse-video unspecified + :underline ,s-mode-line-underline + :foreground ,s-mode-line-inactive-fg + :background ,base02)))) + `(mode-line-buffer-id ((,class (:weight bold)))) + `(fringe ((,class (:foreground ,s-fringe-fg :background "#022F3A")))) + `(vertical-border ((,class (:background nil :foreground ,base02)))) + `(diff-hl-change ((,class (:background ,s-diff-fine-C-bg :foreground ,s-diff-C-fg)))) + `(diff-hl-delete ((,class (:background ,s-diff-fine-A-bg :foreground ,s-diff-A-fg)))) + `(diff-hl-insert ((,class (:background ,s-diff-fine-B-bg :foreground ,s-diff-B-fg)))) + `(avy-background-face ((,class (:foreground ,base01)))) + `(avy-lead-face ((,class (:foreground ,yellow :background nil)))) + `(avy-lead-face-0 ((,class (:weight extra-bold :foreground ,red :background nil)))) + `(avy-lead-face-1 ((,class (:foreground ,base0 :background nil)))) + `(ivy-minibuffer-match-face-1 ((,class (:background nil)))) + `(ivy-minibuffer-match-face-2 ((,class (:background nil :foreground ,blue)))) + `(rainbow-delimiters-depth-1-face ((,class (:foreground "#889899")))) + `(rainbow-delimiters-depth-2-face ((,class (:foreground "#9b7b6b")))) + `(rainbow-delimiters-depth-3-face ((,class (:foreground "#7b88a5")))) + `(rainbow-delimiters-depth-4-face ((,class (:foreground "#889899")))) + `(rainbow-delimiters-depth-5-face ((,class (:foreground "#839564")))) + `(rainbow-delimiters-depth-6-face ((,class (:foreground "#6391aa")))) + `(rainbow-delimiters-depth-7-face ((,class (:foreground "#9d748f")))) + `(rainbow-delimiters-depth-8-face ((,class (:foreground "#7b88a5")))) + `(rainbow-delimiters-depth-9-face ((,class (:foreground "#659896")))) + ))) + +(deftheme quark-solarized-dark "The dark variant of the Solarized colour theme") + +(solarized-with-color-variables + 'dark 'quark-solarized-dark solarized-dark-color-palette-alist quark/solarized-faces) + +(provide-theme 'quark-solarized-dark) From fbee759595d121770be3aebce8f16226cfddc08c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 11 Sep 2024 12:19:41 -0700 Subject: [PATCH 291/303] Move theme loading to the beginning of init --- init.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.el b/init.el index eb2525a2..7d54c36e 100644 --- a/init.el +++ b/init.el @@ -103,30 +103,30 @@ (my/require-config-module 'config-core) (message "[= ] package") (my/require-config-module 'config-package) - (message "[== ] desktop") + (message "[== ] solarized") + (load-theme 'quark-solarized-dark t) + (message "[=== ] desktop") (my/require-config-module 'config-desktop) - (message "[=== ] safety") + (message "[==== ] safety") (my/require-config-module 'config-safety) - (message "[==== ] evil") + (message "[===== ] evil") (my/require-config-module 'config-evil) - (message "[===== ] ui") + (message "[====== ] ui") (my/require-config-module 'config-ui) - (message "[====== ] whitespace") + (message "[======= ] whitespace") (my/require-config-module 'config-whitespace) - (message "[======= ] paste") + (message "[======== ] paste") (my/require-config-module 'config-paste) - (message "[======== ] company") + (message "[========= ] company") (my/require-config-module 'config-company) - (message "[========= ] vcs") + (message "[========== ] vcs") (my/require-config-module 'config-vcs) - (message "[========== ] ivy") + (message "[=========== ] ivy") (my/require-config-module 'config-ivy) - (message "[=========== ] helm") + (message "[============ ] helm") (my/require-config-module 'config-helm) (message "[============= ] intel") (my/require-config-module 'config-intel) (message "[============== ] modes") (my/require-config-module 'config-modes) - (message "[===============] solarized") - (load-theme 'quark-solarized-dark t) (message "[===============] done")) From 40b6d6326cdf47bd75fce7bcd75f80f383f28c20 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 25 Oct 2024 16:38:57 -0700 Subject: [PATCH 292/303] Disable auto-revert for remote files --- modules/config-safety.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config-safety.el b/modules/config-safety.el index 251856e4..986ba1e5 100644 --- a/modules/config-safety.el +++ b/modules/config-safety.el @@ -138,7 +138,7 @@ when `auto-save-mode' is invoked manually.") (require 'autorevert))) (setq global-auto-revert-non-file-buffers t - auto-revert-remote-files t + auto-revert-remote-files nil auto-revert-notify-exclude-dir-regexp (rx bol "/" (or "afs" "media" "mnt" "net" "tmp_mnt") "/") auto-revert-verbose nil From b76ed57db16094f72fce5d49ea5c79f0ce0a0801 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 25 Oct 2024 16:39:07 -0700 Subject: [PATCH 293/303] Disable process-adaptive-read-buffering --- modules/config-core.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-core.el b/modules/config-core.el index 7d1f85c6..8a8c4472 100644 --- a/modules/config-core.el +++ b/modules/config-core.el @@ -34,6 +34,7 @@ mouse-drag-copy-region nil my/flag-debug-init (eq debug-on-error 'startup) read-process-output-max (eval-when-compile (* 1024 1024)) + process-adaptive-read-buffering nil right-margin-width 0 ring-bell-function 'ignore save-interprogram-paste-before-kill t From 84b8d457a34d5c1a65787412157241ef5777d000 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 25 Oct 2024 16:48:32 -0700 Subject: [PATCH 294/303] More performance enhancing options (from Doom) --- modules/config-ui.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config-ui.el b/modules/config-ui.el index 5c416d37..486d2f99 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -17,6 +17,8 @@ auto-window-vscroll nil scroll-conservatively 1000 fast-but-imprecise-scrolling t + redisplay-skip-fontification-on-input t + inhibit-compacting-font-caches t frame-inhibit-implied-resize t inhibit-compacting-font-caches t) From 8eb1a6b16a2d0dd2f361ed51d68fc4f0e1b0bc2c Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 25 Oct 2024 16:50:25 -0700 Subject: [PATCH 295/303] Fix byte-compile error for copilot --- modules/config-intel.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config-intel.el b/modules/config-intel.el index ec44bbff..1b2f562d 100644 --- a/modules/config-intel.el +++ b/modules/config-intel.el @@ -532,6 +532,9 @@ is binary, activate `hexl-mode'." (use-package copilot :recipe (copilot :host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) :config + (eval-when-compile + (with-demoted-errors "Load error: %s" + (require 'evil-core))) (evil-define-key 'insert copilot-mode-map (kbd "") #'copilot-accept-completion)) From e1e98ecb3bec4e3e9402ca82ab5c26c308b7a144 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2025 17:52:32 -0800 Subject: [PATCH 296/303] Enable ultra-scroll --- modules/config-package.el | 1 + modules/config-ui.el | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/modules/config-package.el b/modules/config-package.el index 5df8c516..48b8ff01 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -405,5 +405,6 @@ these values are used to call `use-package-ensure-function'.")) (idle-job-add-require 'helm-lib) (idle-job-add-require 'winner) +(idle-job-add-require 'ultra-scroll) (provide 'config-package) diff --git a/modules/config-ui.el b/modules/config-ui.el index 486d2f99..227a4032 100644 --- a/modules/config-ui.el +++ b/modules/config-ui.el @@ -32,6 +32,13 @@ (set-display-table-slot display-table 'vertical-border (make-glyph-code ?│)) (setq standard-display-table display-table)) +(use-package ultra-scroll + :recipe (ultra-scroll :type git + :host github + :repo "jdtsmith/ultra-scroll") + :config + (ultra-scroll-mode +1)) + (defun isearch-exit-chord-worker () "Exit out of isearch after a chord" (interactive) From 6b9b291512f84de299aa40816d0bc20f9248b339 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 9 Jan 2025 17:53:17 -0800 Subject: [PATCH 297/303] Move evil-snipe face customization into theme --- modules/config-evil-modules.el | 3 --- themes/quark-solarized-dark-theme.el | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/config-evil-modules.el b/modules/config-evil-modules.el index 4183721f..b56a7975 100644 --- a/modules/config-evil-modules.el +++ b/modules/config-evil-modules.el @@ -129,9 +129,6 @@ evil-snipe-smart-case t evil-snipe-tab-increment t) - (set-face-attribute 'evil-snipe-matches-face nil - :background "#586e75") - (evil-snipe-mode +1) (evil-snipe-override-mode +1)) diff --git a/themes/quark-solarized-dark-theme.el b/themes/quark-solarized-dark-theme.el index 882cfd29..6584d1dc 100644 --- a/themes/quark-solarized-dark-theme.el +++ b/themes/quark-solarized-dark-theme.el @@ -38,6 +38,7 @@ `(rainbow-delimiters-depth-7-face ((,class (:foreground "#9d748f")))) `(rainbow-delimiters-depth-8-face ((,class (:foreground "#7b88a5")))) `(rainbow-delimiters-depth-9-face ((,class (:foreground "#659896")))) + `(evil-snipe-matches-face ((,class (:background ,base00 :foreground ,base03)))) ))) (deftheme quark-solarized-dark "The dark variant of the Solarized colour theme") From d999a3d827e0abd2856d0e9501c86b75de34593a Mon Sep 17 00:00:00 2001 From: PythonNut Date: Thu, 6 Mar 2025 15:50:28 -0800 Subject: [PATCH 298/303] Add Caddyfile mode --- modules/config-modes.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config-modes.el b/modules/config-modes.el index 69c5e39a..899cb96c 100644 --- a/modules/config-modes.el +++ b/modules/config-modes.el @@ -1260,6 +1260,12 @@ if [ $1 = .. ]; then shift; fi; exec \"$@\"" :commands (terraform-mode) :mode (("\\.tf\\(vars\\)?\\'" . terraform-mode))) +(use-package caddyfile-mode + :defer-install t + :commands (caddyfile-mode) + :mode (("Caddyfile\\'" . caddyfile-mode) + ("caddy\\.conf\\'" . caddyfile-mode))) + ;; ============================================================================= ;; Markup modes ================================================================ ;; ============================================================================= From 632722ac3b36f5a56072c3ea7e88a0b7f3644cb7 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 18 Apr 2025 01:05:11 -0700 Subject: [PATCH 299/303] Switch back to lewang/ws-butler --- modules/config-whitespace.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config-whitespace.el b/modules/config-whitespace.el index 5e1e8d65..abde92e7 100644 --- a/modules/config-whitespace.el +++ b/modules/config-whitespace.el @@ -188,7 +188,8 @@ extra indent = 2 (use-package ws-butler :recipe (ws-butler :type git :host github - :repo "hlissner/ws-butler") + :branch "master" + :repo "lewang/ws-butler") :diminish (ws-butler-mode ." β") :init ;; autoload ws-butler on file open From 8278458e8b4c16f82ba8861abccd10d4a036cc4e Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 23 Apr 2025 14:29:50 -0700 Subject: [PATCH 300/303] Fix LaTeX math chords --- modules/config-tex.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index b5915c7f..6c559429 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -459,7 +459,7 @@ matching string." (interactive) (if (texmathp) (my/TeX-escape-from-math) - (TeX-insert-dollar))) + (call-interactively #'TeX-insert-dollar))) (defun TeX-math-chord-spaced () (interactive) @@ -468,7 +468,7 @@ matching string." (unless (or (bolp) (looking-back (rx (or space punct)) 1)) (insert " ")) - (TeX-insert-dollar))) + (call-interactively #'TeX-insert-dollar))) (key-chord-define TeX-mode-map (kbd "fj") `(menu-item "" TeX-math-chord From c555741b07d41f187be895749931d9eb5d7c07fc Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 23 Apr 2025 15:28:50 -0700 Subject: [PATCH 301/303] Map "fj" to sp-up-sexp in TeX-mode --- modules/config-tex.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/config-tex.el b/modules/config-tex.el index 6c559429..d84e48bc 100644 --- a/modules/config-tex.el +++ b/modules/config-tex.el @@ -470,9 +470,7 @@ matching string." (insert " ")) (call-interactively #'TeX-insert-dollar))) - (key-chord-define TeX-mode-map (kbd "fj") - `(menu-item "" TeX-math-chord - :filter ,(lambda (cmd) (unless (my/LaTeX-verbatimish-p) cmd)))) + (key-chord-define TeX-mode-map (kbd "fj") #'sp-up-sexp) (key-chord-define TeX-mode-map (kbd "SPC SPC") `(menu-item "" TeX-math-chord-spaced :filter ,(lambda (cmd) (unless (my/LaTeX-verbatimish-p) cmd)))) From 80f26b82cbfb536be50a3cd4462461df98327ec6 Mon Sep 17 00:00:00 2001 From: PythonNut Date: Wed, 23 Apr 2025 15:29:46 -0700 Subject: [PATCH 302/303] Make sure compat is loaded during package setup --- modules/config-package.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/config-package.el b/modules/config-package.el index 48b8ff01..ac86d8e3 100644 --- a/modules/config-package.el +++ b/modules/config-package.el @@ -167,6 +167,7 @@ these values are used to call `use-package-ensure-function'.")) (use-package s) (use-package f) (use-package restart-emacs) +(use-package compat) (use-package exec-path-from-shell :config From c9bcbf305c4061b06c3e3c202bf8ba8722796eab Mon Sep 17 00:00:00 2001 From: PythonNut Date: Fri, 6 Jun 2025 15:58:07 -0700 Subject: [PATCH 303/303] Add automatic delimiter textobjects --- modules/config-evil-textobjects.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/config-evil-textobjects.el b/modules/config-evil-textobjects.el index b949f19e..e975aef5 100644 --- a/modules/config-evil-textobjects.el +++ b/modules/config-evil-textobjects.el @@ -279,4 +279,33 @@ (define-key evil-inner-text-objects-map evil-textobj-syntax-i-key #'evil-i-syntax)) +;; https://emacs.stackexchange.com/questions/74162 +(eval-when-compile (require 'dash)) +(defun quark/evil-paren-range (count beg end type inclusive) + (->> '((?\( . ?\)) + (?\[ . ?\]) + (?{ . ?}) + (?< . ?>)) + (--keep (ignore-errors + (save-excursion + (evil-select-paren (car it) (cdr it) + beg end type + count inclusive)))) + (-min-by (-on #'> (lambda (x) + (abs (- (car x) (point) ))))) + (-take 2))) + +(evil-define-text-object quark/evil-a-paren (count &optional beg end type) + "Select a paren." + :extend-selection nil + (quark/evil-paren-range count beg end type t)) + +(evil-define-text-object quark/evil-inner-paren (count &optional beg end type) + "Select 'inner' paren." + :extend-selection nil + (quark/evil-paren-range count beg end type nil)) + +(define-key evil-inner-text-objects-map "d" #'quark/evil-inner-paren) +(define-key evil-outer-text-objects-map "d" #'quark/evil-a-paren) + (provide 'config-evil-textobjects)