diff --git a/.gitignore b/.gitignore index 2d7dc7455..78fdd0789 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .local/ -.cask/ var/ modules/private/ .yas-compiled-snippets.el diff --git a/Makefile b/Makefile index a233df3cf..ca088d921 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DOOM = bin/doom +DOOM = "bin/doom" MODULES = $(patsubst modules/%/, %, $(sort $(dir $(wildcard modules/*/ modules/*/*/)))) all: diff --git a/bin/doom.cmd b/bin/doom.cmd index 810f3fb06..132691e4b 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -1,13 +1,24 @@ :: Forward the ./doom script to Emacs @ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + PUSHD "%~dp0" >NUL -IF %1=="run" ( - SHIFT - emacs -Q %* -l init.el -f "doom|run-all-startup-hooks" +SET args= +SET command=%1 + +:LOOP +SHIFT /1 +IF NOT [%1]==[] ( + SET args=%args% %1 + GOTO :LOOP +) + +IF [%command%]==[run] ( + start runemacs -Q %args% -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( - emacs --quick --script ./doom -- %* + emacs --quick --script .\doom -- %* ) POPD >NUL diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 5a096b816..47f571ca3 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -40,10 +40,12 @@ ready to be pasted in a bug report on github." ,doom-core-dir ,doom-private-dir) :type 'files :match "\\.elc$")) - (with-temp-buffer - (unless (zerop (call-process "uname" nil t nil "-a")) - (insert (format "%s" system-type))) - (string-trim (buffer-string))) + (if IS-WINDOWS + "n/a" + (with-temp-buffer + (unless (zerop (call-process "uname" nil t nil "-a")) + (insert (format "%s" system-type))) + (string-trim (buffer-string)))) (or (cl-loop with cat = nil for key being the hash-keys of (doom-modules) if (or (not cat) (not (eq cat (car key)))) @@ -120,6 +122,20 @@ branch and commit." (or (vc-git-working-revision doom-core-dir) "n/a"))) +;;;###autoload +(defun doom/copy-backtrace () + "Copy the first 1000 bytes from the *Backtrace* window into your clipboard for +easy pasting into a bug report or discord." + (interactive) + (if-let* ((buf (get-buffer "*Backtrace*"))) + (with-current-buffer buf + (kill-new + (string-trim + (buffer-substring-no-properties + (point-min) + (min (point-max) 1000))))) + (user-error "No backtrace buffer detected"))) + ;; ;; Vanilla sandbox diff --git a/init.el b/init.el index 0b3b905e0..07e42f0a2 100644 --- a/init.el +++ b/init.el @@ -27,7 +27,7 @@ ;; ;;; License: MIT -(unless (boundp 'early-init-file) +(unless (bound-and-true-p early-init-file) (load (concat (file-name-directory load-file-name) "early-init") nil t)) diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index 88651a03c..84cf3c1f0 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -248,10 +248,8 @@ order. (t (file-relative-name directory project-root)))))) (require 'counsel) - (cl-letf (((symbol-function 'counsel-ag-function) - (symbol-function '+ivy*counsel-ag-function)) - ((symbol-function 'counsel-git-grep-function) - (symbol-function '+ivy*counsel-git-grep-function))) + (let ((counsel-more-chars-alist + (if query '((t . 1)) counsel-more-chars-alist))) (pcase engine ('grep (let ((args (if recursive " -R")) @@ -363,41 +361,3 @@ non-nil)." non-nil)." (interactive "P") (+ivy-file-search 'grep :query query :in default-directory :recursive recursive-p)) - - -;; -;; Advice -;; - -;;;###autoload -(defun +ivy*counsel-ag-function (string) - "Advice to get rid of the character limit from `counsel-ag-function'. - -NOTE This may need to be updated frequently, to meet changes upstream (in -counsel-rg)." - (if (< (length string) 1) ; <-- modified the character limit - (counsel-more-chars 1) ; <-- - (let ((default-directory (ivy-state-directory ivy-last)) - (regex (counsel-unquote-regex-parens - (setq ivy--old-re - (ivy--regex string))))) - (counsel--async-command (format counsel-ag-command - (shell-quote-argument regex))) - nil))) - -;;;###autoload -(defun +ivy*counsel-git-grep-function (string) - "Advice to get rid of the character limit from `counsel-git-grep-function'. - -NOTE This may need to be updated frequently, to meet changes upstream (in -counsel-git-grep)." - (if (and (> counsel--git-grep-count counsel--git-grep-count-threshold) - (< (length string) 1)) ; <-- modified the character limit - (counsel-more-chars 1) ; <-- - (let* ((default-directory (ivy-state-directory ivy-last)) - (cmd (format counsel-git-grep-cmd - (setq ivy--old-re (ivy--regex string t))))) - (if (<= counsel--git-grep-count counsel--git-grep-count-threshold) - (split-string (shell-command-to-string cmd) "\n" t) - (counsel--gg-candidates (ivy--regex string)) - nil)))) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 2c91a1340..409df5fca 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -197,7 +197,7 @@ immediately runs it on the current candidate (ending the ivy session)." ;; posframe doesn't work well with async sources (dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep)) - (setf (alist-get fn ivy-display-functions-alist) nil))) + (setf (alist-get fn ivy-display-functions-alist) #'ivy-display-function-fallback))) (def-package! flx diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index ec627fb9b..631d091b6 100644 --- a/modules/config/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -170,12 +170,14 @@ "a" (evilem-create #'evil-forward-arg) "A" (evilem-create #'evil-backward-arg) "s" (evilem-create #'evil-snipe-repeat + :name 'evil-easymotion-snipe-forward :pre-hook (save-excursion (call-interactively #'evil-snipe-s)) :bind ((evil-snipe-scope 'buffer) (evil-snipe-enable-highlight) (evil-snipe-enable-incremental-highlight))) - "S" (evilem-create #'evil-snipe-repeat-reverse - :pre-hook (save-excursion (call-interactively #'evil-snipe-s)) + "S" (evilem-create #'evil-snipe-repeat + :name 'evil-easymotion-snipe-backward + :pre-hook (save-excursion (call-interactively #'evil-snipe-S)) :bind ((evil-snipe-scope 'buffer) (evil-snipe-enable-highlight) (evil-snipe-enable-incremental-highlight))) @@ -838,5 +840,5 @@ ;; Evil-collection fixes (setq evil-collection-key-blacklist - (list "C-j" "C-k" "gd" "gf" "K" "[" "]" + (list "C-j" "C-k" "gd" "gf" "K" "[" "]" "gz" doom-leader-key doom-localleader-key)) diff --git a/modules/config/default/+evil-commands.el b/modules/config/default/+evil-commands.el index 7e2b7391b..662d2718f 100644 --- a/modules/config/default/+evil-commands.el +++ b/modules/config/default/+evil-commands.el @@ -111,7 +111,8 @@ command from the current directory instead of the project root." (ex! "grep" #'+helm:grep) (ex! "grepc[wd]" #'+helm:grep-from-cwd) (ex! "sw[oop]" #'+helm:swoop) - (ex! "todo" #'+helm:todo))) + ;; (ex! "todo" #'+helm:todo) TODO implement `+helm:todo' + )) ;; Project tools (ex! "mak[e]" #'doom:make) (ex! "debug" #'+debug/run) @@ -135,5 +136,5 @@ command from the current directory instead of the project root." (ex! "tabs" #'+workspace/display) (ex! "tabsave" #'+workspace:save) ;; Org-mode -(ex! "cap" #'+org-capture/dwim) +(ex! "cap" #'org-capture) diff --git a/modules/emacs/term/config.el b/modules/emacs/term/config.el index 6be92ed5b..c70417601 100644 --- a/modules/emacs/term/config.el +++ b/modules/emacs/term/config.el @@ -8,5 +8,4 @@ (after! term (set-env! "SHELL") - ;; Consider term buffers real (add-hook 'term-mode-hook #'doom|mark-buffer-as-real)) diff --git a/modules/feature/eval/autoload/repl.el b/modules/feature/eval/autoload/repl.el index 437e73a4e..dcd8df1a1 100644 --- a/modules/feature/eval/autoload/repl.el +++ b/modules/feature/eval/autoload/repl.el @@ -18,7 +18,11 @@ (funcall (if same-window-p #'switch-to-buffer #'pop-to-buffer) (if (buffer-live-p buffer) buffer - (setq buffer (save-window-excursion (call-interactively command))) + (setq buffer + (save-window-excursion + (if (commandp command) + (call-interactively command) + (funcall command)))) (unless (bufferp buffer) (error "REPL command didn't return a buffer")) (with-current-buffer buffer (+eval-repl-mode +1)) diff --git a/modules/feature/eval/autoload/settings.el b/modules/feature/eval/autoload/settings.el index 443678f7d..0f9dd1dfb 100644 --- a/modules/feature/eval/autoload/settings.el +++ b/modules/feature/eval/autoload/settings.el @@ -9,10 +9,11 @@ `+eval/open-repl' and filled with the `:repl' setting.") ;;;###autodef -(defun set-repl-handler! (mode command) - "Define a REPL for a mode. MODE is a major mode symbol and COMMAND is a -function that creates and returns the REPL buffer." - (push (cons mode command) +eval-repls)) +(defun set-repl-handler! (modes command) + "Define a REPL for MODES. MODES is either a single major mode symbol or a list +of them. COMMAND is a function that creates and returns the REPL buffer." + (dolist (mode (doom-enlist modes)) + (setf (alist-get mode +eval-repls) command))) ;; FIXME obsolete :repl ;;;###autoload diff --git a/modules/feature/evil/autoload/evil-mc.el b/modules/feature/evil/autoload/evil-mc.el index 5e76a5d8e..c874a7b48 100644 --- a/modules/feature/evil/autoload/evil-mc.el +++ b/modules/feature/evil/autoload/evil-mc.el @@ -50,16 +50,24 @@ cursor at the final match. If BANG, then treat PATTERN as literal." :move-point nil :evil-mc t (interactive "") + (unless (and (stringp pattern) + (not (string-empty-p pattern))) + (user-error "A regexp pattern is required")) (require 'evil-mc) - (setq evil-mc-pattern (cons (evil-mc-make-pattern (if bang (regexp-quote pattern) pattern) nil) - (list beg end type))) + (setq evil-mc-pattern + (cons (evil-ex-make-search-pattern + (if bang (regexp-quote pattern) pattern)) + (list beg end type))) (save-excursion (evil-with-restriction beg end - (evil-mc-make-cursors-for-all) - (evil-mc-print-cursors-info "Created"))) + (evil-mc-make-cursors-for-all))) (evil-exit-visual-state) (evil-mc-goto-cursor (if (= (evil-visual-direction) 1) (evil-mc-find-last-cursor) (evil-mc-find-first-cursor)) - nil)) + nil) + (evil-mc-undo-cursor-at-pos (point)) + (if (evil-mc-has-cursors-p) + (evil-mc-print-cursors-info "Created") + (evil-mc-message "No cursors were created"))) diff --git a/modules/feature/file-templates/autoload.el b/modules/feature/file-templates/autoload.el index acd8b0ca2..b92d410c6 100644 --- a/modules/feature/file-templates/autoload.el +++ b/modules/feature/file-templates/autoload.el @@ -18,9 +18,13 @@ these properties: Provides a secondary predicate. This function takes no arguments and is executed from within the target buffer. If it returns nil, this rule will be skipped over. - :trigger - The yasnippet trigger keyword used to trigger the target snippet. If - omitted, `+file-templates-default-trigger' is used. + :trigger STRING|FUNCTION + If a string, this is the yasnippet trigger keyword used to trigger the + target snippet. + If a function, this function will be run in the context of the buffer to + insert a file template into. It is given no arguments and must insert text + into the current buffer manually. + If omitted, `+file-templates-default-trigger' is used. :mode SYMBOL What mode to get the yasnippet snippet from. If omitted, either PRED (if it's a major-mode symbol) or the mode of the buffer is used. @@ -69,19 +73,21 @@ evil is loaded and enabled)." (user-error "Couldn't determine mode for %s file template" pred)) (unless trigger (setq trigger +file-templates-default-trigger)) - (require 'yasnippet) - (unless yas-minor-mode - (yas-minor-mode-on)) - (when (and yas-minor-mode - (yas-expand-snippet - (yas--template-content - (cl-find trigger (yas--all-templates (yas--get-snippet-tables mode)) - :key #'yas--template-key :test #'equal))) - (and (featurep 'evil) evil-mode) - (and yas--active-field-overlay - (overlay-buffer yas--active-field-overlay) - (overlay-get yas--active-field-overlay 'yas--field))) - (evil-initialize-state 'insert))))) + (if (functionp trigger) + (funcall trigger) + (require 'yasnippet) + (unless yas-minor-mode + (yas-minor-mode-on)) + (when (and yas-minor-mode + (yas-expand-snippet + (yas--template-content + (cl-find trigger (yas--all-templates (yas--get-snippet-tables mode)) + :key #'yas--template-key :test #'equal))) + (and (featurep 'evil) evil-mode) + (and yas--active-field-overlay + (overlay-buffer yas--active-field-overlay) + (overlay-get yas--active-field-overlay 'yas--field))) + (evil-initialize-state 'insert)))))) ;;;###autoload (defun +file-templates-get-short-path () diff --git a/modules/feature/file-templates/config.el b/modules/feature/file-templates/config.el index d28e4ae75..e42059c43 100644 --- a/modules/feature/file-templates/config.el +++ b/modules/feature/file-templates/config.el @@ -37,7 +37,7 @@ don't have a :trigger property in `+file-templates-alist'.") ("\\.c\\(?:c\\|pp\\)$" :trigger "__cpp" :mode c++-mode) ("\\.h\\(?:h\\|pp\\|xx\\)$" :trigger "__hpp" :mode c++-mode) ("\\.h$" :trigger "__h" :mode c-mode) - (c-mode :trigger "__c" :mode c-mode) + (c-mode :trigger "__c") ;; go ("/main\\.go$" :trigger "__main.go" :mode go-mode :project t) (go-mode :trigger "__.go") diff --git a/modules/lang/haskell/+dante.el b/modules/lang/haskell/+dante.el index 2eb5645f5..5c7dd96f6 100644 --- a/modules/lang/haskell/+dante.el +++ b/modules/lang/haskell/+dante.el @@ -5,5 +5,4 @@ :hook (haskell-mode . dante-mode) :config (when (featurep! :feature syntax-checker) - (add-hook! 'dante-mode-hook - (flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint))))) + (flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 5dc501743..87d9ab65c 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -13,4 +13,6 @@ This is necessary because `intero-mode' doesn't do its own error checks." (message "Couldn't find stack. Refusing to enable intero-mode.")))) (add-hook 'haskell-mode-hook #'+haskell|init-intero) :config - (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)) + (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition) + (when (featurep! :feature syntax-checker) + (flycheck-add-next-checker 'intero '(warning . haskell-hlint)))) diff --git a/modules/lang/haskell/autoload.el b/modules/lang/haskell/autoload.el new file mode 100644 index 000000000..92cc42afe --- /dev/null +++ b/modules/lang/haskell/autoload.el @@ -0,0 +1,15 @@ +;;; lang/haskell/autoload.el -*- lexical-binding: t; -*- + +;;;###autoload +(defun +haskell-repl-buffer () + "Returns the appropriate Haskell REPL buffer." + (if (featurep! +intero) + (intero-repl-buffer arg) + (haskell-session-interactive-buffer (haskell-session)))) + +;;;###autoload +(defun +haskell/repl (&optional arg) + "Opens a Haskell REPL." + (interactive "P") + (display-buffer (+haskell-repl-buffer))) + diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 9b44c7531..dd5b6d1b4 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -11,6 +11,9 @@ :hook (haskell-mode . hindent-mode)) (after! haskell-mode - (set-repl-handler! 'haskell-mode #'switch-to-haskell) + (add-hook 'haskell-mode-hook #'interactive-haskell-mode) + (set-lookup-handlers! 'haskell-mode :definition #'haskell-mode-jump-to-def-or-tag) + (set-file-template! 'haskell-mode :trigger #'haskell-auto-insert-module-template :project t) + (set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell-repl-buffer) (add-to-list 'completion-ignored-extensions ".hi")) diff --git a/modules/lang/haskell/doctor.el b/modules/lang/haskell/doctor.el index df465bc7b..e9e776b0b 100644 --- a/modules/lang/haskell/doctor.el +++ b/modules/lang/haskell/doctor.el @@ -3,9 +3,7 @@ (when (featurep! +dante) (unless (executable-find "cabal") - (warn! "Couldn't find cabal, haskell-mode may have issues")) - (unless (executable-find "hlint") - (warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode"))) + (warn! "Couldn't find cabal, haskell-mode may have issues"))) (when (featurep! +intero) (unless (executable-find "stack") @@ -14,3 +12,8 @@ (unless (executable-find "hindent") (warn! "Couldn't find hindent. hindent-mode won't work")) +(when (or (featurep! +dante) (featurep! +intero)) + (unless (executable-find "hlint") + (warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode"))) + + diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el new file mode 100644 index 000000000..b03095541 --- /dev/null +++ b/modules/lang/nix/config.el @@ -0,0 +1,21 @@ +;;; lang/nix/config.el -*- lexical-binding: t; -*- + +(after! nix-mode + (set-company-backend! 'nix-mode 'company-nixos-options) + + (map! :map nix-mode-map + :localleader + :n "f" #'nix-update-fetch + :n "p" #'nix-format-buffer + :n "r" #'nix-repl-show + :n "s" #'nix-shell + :n "b" #'nix-build + :n "u" #'nix-unpack + (:when (featurep! :completion helm) + :n "o" #'helm-nixos-options))) + +(def-package! nix-update + :commands (nix-update-fetch)) + +(def-package! nix-repl + :commands (nix-repl-show)) diff --git a/modules/lang/nix/doctor.el b/modules/lang/nix/doctor.el new file mode 100644 index 000000000..93f4de0c3 --- /dev/null +++ b/modules/lang/nix/doctor.el @@ -0,0 +1,9 @@ +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; lang/nix/doctor.el + +(unless (executable-find "nix") + (warn! "Couldn't find the nix package manager. nix-mode won't work.")) + +(unless (executable-find "nixfmt") + (warn! "Couldn't find nixfmt. nix-format-buffer won't work.")) + diff --git a/modules/lang/nix/packages.el b/modules/lang/nix/packages.el index 7cbed49e6..47ebff527 100644 --- a/modules/lang/nix/packages.el +++ b/modules/lang/nix/packages.el @@ -2,3 +2,11 @@ ;;; lang/nix/packages.el (package! nix-mode) + +(package! nix-update) + +(when (featurep! :completion company) + (package! company-nixos-options)) + +(when (featurep! :completion helm) + (package! helm-nixos-options)) diff --git a/modules/lang/org/+export.el b/modules/lang/org/+export.el index 5eb36d1d8..0ab06eabc 100644 --- a/modules/lang/org/+export.el +++ b/modules/lang/org/+export.el @@ -18,7 +18,8 @@ path too.") (add-to-list 'org-export-backends 'pandoc nil #'eq) (setq org-pandoc-options '((standalone . t) - (mathjax . t)))) + (mathjax . t) + (variable . "revealjs-url=https://cdn.jsdelivr.net/npm/reveal.js@3/")))) ;; (defun +org|init-export () diff --git a/modules/lang/org/+present.el b/modules/lang/org/+present.el index 3a26c6f36..99b3f5d49 100644 --- a/modules/lang/org/+present.el +++ b/modules/lang/org/+present.el @@ -13,7 +13,7 @@ (def-package! ox-reveal :defer t :config - (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/" + (setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js@3/" org-reveal-mathjax t)) diff --git a/modules/lang/python/+conda.el b/modules/lang/python/+conda.el index 78f373b8a..50d5486f0 100644 --- a/modules/lang/python/+conda.el +++ b/modules/lang/python/+conda.el @@ -1,21 +1,33 @@ ;;; lang/python/+conda.el -*- lexical-binding: t; -*- ;;;###if (featurep! +conda) -;; This file add conda support to doom-emacs. To get started, try `M-x' -;; `+python/set-conda-home' and then `M-x' `conda-env-activate'. +;; Adds conda support to Doom Emacs. `conda-anaconda-home' should be the path to +;; your anaconda installation, and will be guessed from the following: +;; +;; + ~/.anaconda3 +;; + ~/.anaconda +;; + ~/usr/bin/anaconda3 +;; +;; If none of these work, you'll need to set `conda-anaconda-home' yourself. +;; +;; Once set, run M-x `conda-env-activate' to switch between environments OR turn +;; on `conda-env-autoactivate-mode' if you want it done automatically. (def-package! conda :when (featurep! +conda) - :after (python) - :init - (defvar +python-conda-home '("~/.anaconda3" "/usr/bin/anaconda3" "~/.anaconda") - "A list of host pattern and corresponding anaconda home.") + :after python :config - (advice-add 'anaconda-mode-bootstrap :override #'+python*anaconda-mode-bootstrap) - (conda-env-autoactivate-mode -1) - ;; (add-hook 'python-mode-hook #'conda-env-activate-for-buffer) + (unless (cl-loop for dir in (list conda-anaconda-home "/usr/bin/anaconda3" "~/.anaconda") + if (file-directory-p dir) + return (setq conda-anaconda-home dir + conda-env-home-directory dir)) + (message "Cannot find Anaconda installation")) + + ;; integration with term/eshell (conda-env-initialize-interactive-shells) - (conda-env-initialize-eshell) - ;; Version management with conda - (add-hook 'conda-postactivate-hook #'+python|add-conda-env-to-modeline) - (add-hook 'conda-postdeactivate-hook #'+python|add-conda-env-to-modeline)) + (after! eshell (conda-env-initialize-eshell)) + + (add-hook! '(conda-postactivate-hook conda-postdeactivate-hook) + #'+python|add-conda-env-to-modeline) + + (advice-add 'anaconda-mode-bootstrap :override #'+python*anaconda-mode-bootstrap-in-remote-environments)) diff --git a/modules/lang/python/autoload/conda.el b/modules/lang/python/autoload/conda.el index 62778c27d..1d0a25f96 100644 --- a/modules/lang/python/autoload/conda.el +++ b/modules/lang/python/autoload/conda.el @@ -3,25 +3,28 @@ ;;;###autoload (defun +python/set-conda-home () - "Set the CONDA HOME. -Usually it's `~/.anaconda3' on local machine, but you can also set it to a -remote directory using TRAMP syntax such as `/ssh:host:/usr/bin/anaconda3'. In -that way you can use the remote conda environment as well as the corresponding -remote python executable and packages." + "Set `conda-anaconda-home' (ANACONDA_HOME). + +Usually it's `~/.anaconda3' on local machine, but it can be set to a remote +directory using TRAMP syntax, e.g. `/ssh:host:/usr/bin/anaconda3'. This way, you +can use a remote conda environment, including the corresponding remote python +executable and packages." (interactive) - (ivy-read "Set conda home:" +python-conda-home - :history +python/set-conda-home--history - :action (lambda (cand) (setq conda-anaconda-home cand)))) + (require 'conda) + (when-let* ((home (read-directory-name "Set conda home: " "~" nil nil conda-anaconda-home))) + (setq conda-anaconda-home home) + (message "Successfully changed conda home to: %s" (abbreviate-file-name home)))) ;;;###autoload (defun +python|add-conda-env-to-modeline () - "Add conda environment string to the major mode in the modeline." - (setq mode-name - (if conda-env-current-name - (format "Py:conda:%s" conda-env-current-name) - "Python"))) + "Add conda environment string to the major mode modeline segment." + (setq mode-name + (if conda-env-current-name + (format "Py:conda:%s" conda-env-current-name) + "Python"))) + ;;;###autoload -(defun +python*anaconda-mode-bootstrap (&optional callback) +(defun +python*anaconda-mode-bootstrap-in-remote-environments (&optional callback) "Advice to set up the anaconda-mode even in remote environment. Original doc: Run `anaconda-mode' server. diff --git a/modules/lang/python/autoload.el b/modules/lang/python/autoload/python.el similarity index 65% rename from modules/lang/python/autoload.el rename to modules/lang/python/autoload/python.el index 122ef045a..c6ae3b17c 100644 --- a/modules/lang/python/autoload.el +++ b/modules/lang/python/autoload/python.el @@ -1,4 +1,4 @@ -;;; lang/python/autoload.el -*- lexical-binding: t; -*- +;;; lang/python/autoload/python.el -*- lexical-binding: t; -*- ;;;###autoload (defun +python/repl () diff --git a/modules/lang/swift/config.el b/modules/lang/swift/config.el index d099d8677..6925ab766 100644 --- a/modules/lang/swift/config.el +++ b/modules/lang/swift/config.el @@ -1,7 +1,7 @@ ;;; lang/swift/config.el -*- lexical-binding: t; -*- -;; `swift-mode' -(set-repl-handler! 'swift-mode #'run-swift) +(after! swift-mode + (set-repl-handler! 'swift-mode #'run-swift)) (def-package! flycheck-swift diff --git a/modules/tools/magit/config.el b/modules/tools/magit/config.el index e583208e6..bc86f6a95 100644 --- a/modules/tools/magit/config.el +++ b/modules/tools/magit/config.el @@ -42,15 +42,9 @@ load everything.") (def-package! magit-todos - :after magit + :hook (magit-mode . magit-todos-mode) :config (setq magit-todos-require-colon nil) - ;; `magit-todos-mode' defines keybinds on activation, so it's better to just - ;; do this manually: - (magit-add-section-hook 'magit-status-sections-hook - #'magit-todos--insert-todos - 'magit-insert-staged-changes - 'append) (define-key magit-todos-section-map "j" nil))