From 763dba72cdf2641cb751794b9b1a7063e2caa44e Mon Sep 17 00:00:00 2001 From: HaoZeke Date: Wed, 11 Jul 2018 19:06:49 +0530 Subject: [PATCH 01/48] org: Update +export to generate revealjs stuff --- modules/lang/org/+export.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 () From 03cb076fd6a100f53474667d3320571fc06b8cec Mon Sep 17 00:00:00 2001 From: HaoZeke Date: Wed, 11 Jul 2018 19:15:24 +0530 Subject: [PATCH 02/48] org: Update revealJS url This grabs all minor versions upto 4.xx --- modules/lang/org/+present.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) From 31143f9f9e9bd46a411fd9032ecce52a62f8d8b5 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 15:13:19 -0700 Subject: [PATCH 03/48] Fix a couple errors in doom.cmd - Properly stringize the optional first argument - Use correct path to init.el (relative to script directory) --- bin/doom.cmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 810f3fb06..000e811c7 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -3,12 +3,12 @@ @ECHO OFF PUSHD "%~dp0" >NUL -IF %1=="run" ( +IF "%1"=="run" ( SHIFT - emacs -Q %* -l init.el -f "doom|run-all-startup-hooks" + emacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( - emacs --quick --script ./doom -- %* + emacs --quick --script .\doom -- %* ) POPD >NUL -ECHO ON +ECHO ON \ No newline at end of file From a0604e3febb453742a9e34ed1e72f104e3066846 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 15:45:37 -0700 Subject: [PATCH 04/48] Tweak the command used for the "run" argument - Using "start" will allow the batch script to return immediately, rather than waiting for the command to finish. - Using "runemacs" (instead of plain "emacs") will hide the console window that is displayed while Emacs is running --- bin/doom.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 000e811c7..7d9e6179b 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -5,10 +5,10 @@ PUSHD "%~dp0" >NUL IF "%1"=="run" ( SHIFT - emacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" + start runemacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( emacs --quick --script .\doom -- %* ) POPD >NUL -ECHO ON \ No newline at end of file +ECHO ON From 58b723bc54e4729b70fa2e2eafff6fec276acf10 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 16:32:07 -0700 Subject: [PATCH 05/48] Load early-init.el if early-init-file is not bound *and* true For Emacs 27, the symbol is still bound when using -Q, which means it won't be loaded from bin/doom. --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) From 95848ea5f69b22aac5e9f0f2ced241068f4518e9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 12:43:28 +0200 Subject: [PATCH 06/48] Disable :todo for helm users There is no +helm/tasks or +helm:todo. Reported by @ar1a --- modules/config/default/+evil-commands.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config/default/+evil-commands.el b/modules/config/default/+evil-commands.el index 7e2b7391b..d23605e05 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) From 574c62f85bd2d0da610cc7b711e0a80bce29e791 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 12:45:35 +0200 Subject: [PATCH 07/48] :cap => org-capture +org-capture/dwim doesn't exist. Reported by @ar1a --- modules/config/default/+evil-commands.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/default/+evil-commands.el b/modules/config/default/+evil-commands.el index d23605e05..662d2718f 100644 --- a/modules/config/default/+evil-commands.el +++ b/modules/config/default/+evil-commands.el @@ -136,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) From 6e52e2d07c55425eaaff3d0a6156cf0ffcaef58e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 12:58:58 +0200 Subject: [PATCH 08/48] Refactor +evil:mc + Improve error handling when no PATTERN is given (reported by @ar1a) + Report correct number of resulting cursors + Handle edge case where only one cursor is created + Report edge case where no cursors are created --- modules/feature/evil/autoload/evil-mc.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/feature/evil/autoload/evil-mc.el b/modules/feature/evil/autoload/evil-mc.el index 5e76a5d8e..af1b58de7 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-mc-make-pattern (if bang (regexp-quote pattern) pattern) + nil) + (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"))) From 7ed9c5196fb8a10ba87f301f3ae974b4c317e0f7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 13:00:42 +0200 Subject: [PATCH 09/48] Add doom/copy-backtrace command --- core/autoload/debug.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 5a096b816..0e531594c 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -120,6 +120,19 @@ branch and commit." (or (vc-git-working-revision doom-core-dir) "n/a"))) +;;;###autoload +(defun doom/copy-backtrace () + "Copy the contents of the *Backtrace* window to clipboard." + (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 From b60c83f6d118b0ecbad89463ee666e6c76836c2b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 13:29:43 +0200 Subject: [PATCH 10/48] Add gz to evil-collection-key-blacklist --- modules/config/default/+bindings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index ec627fb9b..ab7db32b3 100644 --- a/modules/config/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -838,5 +838,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)) From 3db462ba54b0598de0af1bf6048c4b15767f65d4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Jul 2018 23:35:52 +0200 Subject: [PATCH 11/48] Add regexp support to :mc ex command --- modules/feature/evil/autoload/evil-mc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/feature/evil/autoload/evil-mc.el b/modules/feature/evil/autoload/evil-mc.el index af1b58de7..c874a7b48 100644 --- a/modules/feature/evil/autoload/evil-mc.el +++ b/modules/feature/evil/autoload/evil-mc.el @@ -55,8 +55,8 @@ cursor at the final match. If BANG, then treat PATTERN as literal." (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) + (cons (evil-ex-make-search-pattern + (if bang (regexp-quote pattern) pattern)) (list beg end type))) (save-excursion (evil-with-restriction beg end From bb6e9b0a4f800e2c9465a63e83e18e1ad5155f81 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 02:56:46 +0200 Subject: [PATCH 12/48] Remove counsel-more-chars removal hacks Fixes wrong-number-of-args error caused by new counsel-more-chars implementation upstream. These hacks removed the hard-coded minimum input length requirement for counsel-ag and its ilk. The recent counsel update made those requirements customizable through counsel-more-chars-alist. --- modules/completion/ivy/autoload/ivy.el | 44 ++------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) 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)))) From 4323886b1bf10bb2ccedd4c0ce8846a740b53681 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 04:08:17 +0200 Subject: [PATCH 13/48] Use ivy fallback display function for swiper et co As they don't work well with ivy-posframe. --- modules/completion/ivy/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 92b8222529a2da7ebe6f9dc7f5075763759a1fa0 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Fri, 13 Jul 2018 15:51:22 -0700 Subject: [PATCH 14/48] %* doesn't behave as expected %* is unaffected by SHIFT, so using it results in Emacs loading a buffer named "run" on startup. In order to preserve running all supported commands directly with the bin/doom script, change the magic string in doom.cmd to one that is unused ("runemacs") --- bin/doom.cmd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 7d9e6179b..8097a37bd 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -3,9 +3,8 @@ @ECHO OFF PUSHD "%~dp0" >NUL -IF "%1"=="run" ( - SHIFT - start runemacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" +IF "%1"=="runemacs" ( + start runemacs --quick --no-splash -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( emacs --quick --script .\doom -- %* ) From b7eeaa4525065eb38eb3cbac91f96605276eb43d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 19:33:47 +0200 Subject: [PATCH 15/48] Improve docstring for doom/copy-backtrace --- core/autoload/debug.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 0e531594c..82154d74f 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -122,7 +122,8 @@ branch and commit." ;;;###autoload (defun doom/copy-backtrace () - "Copy the contents of the *Backtrace* window to clipboard." + "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 From 71dd7ff0f489eb6f2f9acd271d817287f0b68ab7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 19:38:29 +0200 Subject: [PATCH 16/48] Helpfully removes this totally helpful comment How helpful! --- modules/emacs/term/config.el | 1 - 1 file changed, 1 deletion(-) 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)) From 8406f1e6a49edef8e73e10c4acd67cbb60e5c016 Mon Sep 17 00:00:00 2001 From: xeijin Date: Sat, 14 Jul 2018 19:21:16 +0100 Subject: [PATCH 17/48] Double quote doom binary location This allows 'make quickstart' to work on Windows when using GNU make (appreciate Windows isn't officially supported) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 6efd9d4573237c31579b20c3b2138a1a9c7f568d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 20:18:02 +0200 Subject: [PATCH 18/48] Allow set-repl-handler! to accept multiple modes As first argument. --- modules/feature/eval/autoload/settings.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/feature/eval/autoload/settings.el b/modules/feature/eval/autoload/settings.el index 443678f7d..c8505b6ec 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 mode +eval-repls) command))) ;; FIXME obsolete :repl ;;;###autoload From e97fd7558c6d06ab07efe7e79d1d1a5751a13de0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 21:33:13 +0200 Subject: [PATCH 19/48] Allow file template :trigger to be a function --- modules/feature/file-templates/autoload.el | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) 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 () From a76c08093079824f6b8a596391e9ac389964df3f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 21:43:12 +0200 Subject: [PATCH 20/48] lang/haskell: improve REPL support #752 --- modules/lang/haskell/autoload.el | 15 +++++++++++++++ modules/lang/haskell/config.el | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 modules/lang/haskell/autoload.el 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..56ccf58fd 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -11,6 +11,6 @@ :hook (haskell-mode . hindent-mode)) (after! haskell-mode - (set-repl-handler! 'haskell-mode #'switch-to-haskell) + (set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell-repl-buffer) (add-to-list 'completion-ignored-extensions ".hi")) From 80c4abc8bfdd1d3180b22bcc2b9776184575d206 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 21:43:47 +0200 Subject: [PATCH 21/48] Enable haskell-interactive-mode in haskell-mode #752 --- modules/lang/haskell/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 56ccf58fd..5147081e4 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -11,6 +11,7 @@ :hook (haskell-mode . hindent-mode)) (after! haskell-mode + (add-hook 'haskell-mode-hook #'haskell-interactive-mode) (set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell-repl-buffer) (add-to-list 'completion-ignored-extensions ".hi")) From e4db3f00205ff0331108352bb189ea4b3865e049 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 21:44:06 +0200 Subject: [PATCH 22/48] Insert module file template in haskell files #752 Use file-template module instead of hook so it only gets triggered in a valid project. --- modules/lang/haskell/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 5147081e4..a03d99a3b 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -12,6 +12,7 @@ (after! haskell-mode (add-hook 'haskell-mode-hook #'haskell-interactive-mode) + (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")) From 4448f2d920b9e44781fe0e5d9ea255ddbf074bca Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 14 Jul 2018 22:29:52 +0200 Subject: [PATCH 23/48] Remove redundant .cask/ entry in gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) 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 From b38cbcd060bf94acd30601949d1b00c7f2d40d0e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 15 Jul 2018 00:59:38 +0200 Subject: [PATCH 24/48] Fix void-function (setf alist) error --- modules/feature/eval/autoload/settings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/feature/eval/autoload/settings.el b/modules/feature/eval/autoload/settings.el index c8505b6ec..0f9dd1dfb 100644 --- a/modules/feature/eval/autoload/settings.el +++ b/modules/feature/eval/autoload/settings.el @@ -13,7 +13,7 @@ "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 mode +eval-repls) command))) + (setf (alist-get mode +eval-repls) command))) ;; FIXME obsolete :repl ;;;###autoload From b21ccd104b4ac3c1c3803e2a2a1d7464ebf7fcf9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 15 Jul 2018 01:01:56 +0200 Subject: [PATCH 25/48] lang/swift: defer set-repl-handler! call --- modules/lang/swift/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 69c8ef4141ba3ead9765aedc87d3dbd1c81a32e9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 15 Jul 2018 20:44:11 +0200 Subject: [PATCH 26/48] Fix void-function haskell-interactive-mode --- modules/lang/haskell/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index a03d99a3b..3c2159f6c 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -11,7 +11,7 @@ :hook (haskell-mode . hindent-mode)) (after! haskell-mode - (add-hook 'haskell-mode-hook #'haskell-interactive-mode) + (add-hook 'haskell-mode-hook #'interactive-haskell-mode) (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")) From c31bb6a7448ee6ffcad11a1ae993c571b9cd0d28 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 15 Jul 2018 20:44:47 +0200 Subject: [PATCH 27/48] Add haskell-mode-jump-to-def-or-tag lookup handler --- modules/lang/haskell/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 3c2159f6c..dd5b6d1b4 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -12,6 +12,7 @@ (after! haskell-mode (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")) From f8581c3206e3530c4c472ecdbf26ea15ce6a5dac Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 12:28:41 +0200 Subject: [PATCH 28/48] Added hlint support for intero users --- modules/lang/haskell/+intero.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 5dc501743..a99308af9 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -13,4 +13,7 @@ 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) + (add-hook! 'intero-mode + (flycheck-add-next-checker 'intero '(warning . haskell-hlint))))) From ab6e18d61b69e33b89cad7550b96eaedbd4f05da Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 12:50:20 +0200 Subject: [PATCH 29/48] Checks for hlint for dante/intero users --- modules/lang/haskell/doctor.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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"))) + + From 53df5178a3e79e84fec3dc7f942ce2e1ff4ca18a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 16 Jul 2018 14:06:08 +0200 Subject: [PATCH 30/48] Fix wrong-type-argument: commandp error when opening some REPLs --- modules/feature/eval/autoload/repl.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)) From 39419dee17d81fb326aa392cb493839e3d2cb14a Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 15:49:11 +0200 Subject: [PATCH 31/48] Added company backend for nixos-options --- modules/lang/nix/config.el | 7 +++++++ modules/lang/nix/packages.el | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 modules/lang/nix/config.el diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el new file mode 100644 index 000000000..fc69d6727 --- /dev/null +++ b/modules/lang/nix/config.el @@ -0,0 +1,7 @@ +;;; config.el --- description -*- lexical-binding: t; -*- + +(def-package! company-nixos-options + :when (featurep! :completion company) + :after nix-mode + :config + (set-company-backend! 'nix-mode 'company-nixos-options)) diff --git a/modules/lang/nix/packages.el b/modules/lang/nix/packages.el index 7cbed49e6..0049acfcb 100644 --- a/modules/lang/nix/packages.el +++ b/modules/lang/nix/packages.el @@ -2,3 +2,6 @@ ;;; lang/nix/packages.el (package! nix-mode) + +(when (featurep! :completion company) + (package! company-nixos-options)) From d3c24e51f18cdfc5497a3ca46885344f582c3a82 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 17:09:28 +0200 Subject: [PATCH 32/48] Add support for nix-update --- modules/lang/nix/config.el | 4 ++++ modules/lang/nix/packages.el | 1 + 2 files changed, 5 insertions(+) diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el index fc69d6727..060a04e38 100644 --- a/modules/lang/nix/config.el +++ b/modules/lang/nix/config.el @@ -5,3 +5,7 @@ :after nix-mode :config (set-company-backend! 'nix-mode 'company-nixos-options)) + +(def-package! nix-update + :after nix-mode + :commands (nix-update-fetch)) diff --git a/modules/lang/nix/packages.el b/modules/lang/nix/packages.el index 0049acfcb..6cd491c8b 100644 --- a/modules/lang/nix/packages.el +++ b/modules/lang/nix/packages.el @@ -2,6 +2,7 @@ ;;; lang/nix/packages.el (package! nix-mode) +(package! nix-update :recipe (:fetcher github :repo "jwiegley/nix-update-el")) (when (featurep! :completion company) (package! company-nixos-options)) From bdbe942fb9b039bb3e29af556d898d8f7dea88e3 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 17:10:18 +0200 Subject: [PATCH 33/48] Make available nix-repl-show --- modules/lang/nix/config.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el index 060a04e38..3cb5d4078 100644 --- a/modules/lang/nix/config.el +++ b/modules/lang/nix/config.el @@ -9,3 +9,7 @@ (def-package! nix-update :after nix-mode :commands (nix-update-fetch)) + +(def-package! nix-repl + :after nix-mode + :commands (nix-repl-show)) From 1dac12c9c0a79d300db950502c1b6fbf8eb1039d Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 17:10:57 +0200 Subject: [PATCH 34/48] Add bindings for nix-mode --- modules/lang/nix/config.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el index 3cb5d4078..4af40dc4c 100644 --- a/modules/lang/nix/config.el +++ b/modules/lang/nix/config.el @@ -13,3 +13,14 @@ (def-package! nix-repl :after nix-mode :commands (nix-repl-show)) + +(def-package! nix-mode + :config + (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)) From 8ed5ea56d92db6b20e3b4918b1e29132921ef4f1 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 17:13:53 +0200 Subject: [PATCH 35/48] Added doctor check for nixfmt --- modules/lang/nix/doctor.el | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 modules/lang/nix/doctor.el diff --git a/modules/lang/nix/doctor.el b/modules/lang/nix/doctor.el new file mode 100644 index 000000000..440ef31b0 --- /dev/null +++ b/modules/lang/nix/doctor.el @@ -0,0 +1,6 @@ +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; lang/nix/doctor.el + +(unless (executable-find "nixfmt") + (warn! "Couldn't find nixfmt. nix-format-buffer won't work")) + From 6b236929857c7dd2c9536fb091b410963fd4c4a5 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Mon, 16 Jul 2018 17:15:05 +0200 Subject: [PATCH 36/48] Whoops! this is available on melpa after all --- modules/lang/nix/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/nix/packages.el b/modules/lang/nix/packages.el index 6cd491c8b..2ffe1aab7 100644 --- a/modules/lang/nix/packages.el +++ b/modules/lang/nix/packages.el @@ -2,7 +2,7 @@ ;;; lang/nix/packages.el (package! nix-mode) -(package! nix-update :recipe (:fetcher github :repo "jwiegley/nix-update-el")) +(package! nix-update) (when (featurep! :completion company) (package! company-nixos-options)) From bc5621adb678ee1a40b7c1abede650e4928e2d8a Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Mon, 16 Jul 2018 16:35:05 -0700 Subject: [PATCH 37/48] Add ability to pass additional args to 'doom run' --- bin/doom.cmd | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 8097a37bd..132691e4b 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -1,10 +1,22 @@ :: Forward the ./doom script to Emacs @ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + PUSHD "%~dp0" >NUL -IF "%1"=="runemacs" ( - start runemacs --quick --no-splash -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 -- %* ) From ef4d5827a1c710af01619f6c5ca4915dd8af017d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 16 Jul 2018 18:12:50 +0200 Subject: [PATCH 38/48] Fix gss/gsS (evil-snipe + evil-easymotion) --- modules/config/default/+bindings.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index ab7db32b3..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))) From 0a4cdf8202de2e7c7e03d9c6d60872730d0ced2f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 02:27:39 +0200 Subject: [PATCH 39/48] Make haskell-hlint setup DRY --- modules/lang/haskell/+dante.el | 6 +----- modules/lang/haskell/+intero.el | 5 +---- modules/lang/haskell/config.el | 8 +++++++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/lang/haskell/+dante.el b/modules/lang/haskell/+dante.el index 2eb5645f5..51a9e3be4 100644 --- a/modules/lang/haskell/+dante.el +++ b/modules/lang/haskell/+dante.el @@ -2,8 +2,4 @@ ;;;###if (featurep! +dante) (def-package! dante - :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))))) + :hook (haskell-mode . dante-mode)) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index a99308af9..5dc501743 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -13,7 +13,4 @@ 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) - (when (featurep! :feature syntax-checker) - (add-hook! 'intero-mode - (flycheck-add-next-checker 'intero '(warning . haskell-hlint))))) + (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index dd5b6d1b4..3facd2086 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -15,5 +15,11 @@ (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")) + (add-to-list 'completion-ignored-extensions ".hi") + + (when (featurep! :feature syntax-checker) + (after! flycheck + (dolist (checker (delq nil (list (if (featurep! +intero) 'intero) + (if (featurep! +dante) 'haskell-dante)))) + (flycheck-add-next-checker checker '(warning . haskell-hlint)))))) From 48af60bb38362a7955607e08f8e5c09ad84944fc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 03:20:58 +0200 Subject: [PATCH 40/48] Remove redundant :mode from c-mode file template --- modules/feature/file-templates/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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") From 0aa351842cd3498b8fcd8b1a7448932f8c825fc9 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Tue, 17 Jul 2018 09:56:52 +0200 Subject: [PATCH 41/48] clean-up + add helm-nixos-options --- modules/lang/nix/config.el | 25 ++++++++++++++----------- modules/lang/nix/packages.el | 4 ++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el index 4af40dc4c..48c02ed82 100644 --- a/modules/lang/nix/config.el +++ b/modules/lang/nix/config.el @@ -1,21 +1,16 @@ ;;; config.el --- description -*- lexical-binding: t; -*- -(def-package! company-nixos-options - :when (featurep! :completion company) - :after nix-mode - :config - (set-company-backend! 'nix-mode 'company-nixos-options)) - (def-package! nix-update - :after nix-mode :commands (nix-update-fetch)) (def-package! nix-repl - :after nix-mode :commands (nix-repl-show)) -(def-package! nix-mode - :config +(def-package! helm-nixos-options + :when (featurep! :completion helm) + :commands (helm-nixos-options)) + +(after! nix-mode (map! :map nix-mode-map :localleader :n "f" #'nix-update-fetch @@ -23,4 +18,12 @@ :n "r" #'nix-repl-show :n "s" #'nix-shell :n "b" #'nix-build - :n "u" #'nix-unpack)) + :n "u" #'nix-unpack) + + (when (featurep! :completion helm) + (map! :map nix-mode-map + :localleader + :n "o" #'helm-nixos-options)) + + (when (featurep! :completion company) + (set-company-backend! 'nix-mode 'company-nixos-options))) diff --git a/modules/lang/nix/packages.el b/modules/lang/nix/packages.el index 2ffe1aab7..47ebff527 100644 --- a/modules/lang/nix/packages.el +++ b/modules/lang/nix/packages.el @@ -2,7 +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)) From bd5d305e06408413b567171732d1f1d09b90a796 Mon Sep 17 00:00:00 2001 From: Patrick Elliott Date: Tue, 17 Jul 2018 10:03:17 +0200 Subject: [PATCH 42/48] Added doc check for nix package manager --- modules/lang/nix/doctor.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/lang/nix/doctor.el b/modules/lang/nix/doctor.el index 440ef31b0..93f4de0c3 100644 --- a/modules/lang/nix/doctor.el +++ b/modules/lang/nix/doctor.el @@ -1,6 +1,9 @@ ;; -*- lexical-binding: t; no-byte-compile: t; -*- ;;; lang/nix/doctor.el -(unless (executable-find "nixfmt") - (warn! "Couldn't find nixfmt. nix-format-buffer won't work")) +(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.")) From 7a81f46b39d02e412750ad8ef8d987f4ec4e00c5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 13:23:33 +0200 Subject: [PATCH 43/48] Refactor lang/nix + Move set-company-backend! out of conditional (it is an autodef, meaning it will simply no-op if the company module is disabled) + Removed helm-nixos-options config, because `helm-nixos-options` is already autoloaded by the package + Simplify map! usage + Move nix-mode to the top, as it is the focal package of this module --- modules/lang/nix/config.el | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/lang/nix/config.el b/modules/lang/nix/config.el index 48c02ed82..b03095541 100644 --- a/modules/lang/nix/config.el +++ b/modules/lang/nix/config.el @@ -1,16 +1,8 @@ -;;; config.el --- description -*- lexical-binding: t; -*- - -(def-package! nix-update - :commands (nix-update-fetch)) - -(def-package! nix-repl - :commands (nix-repl-show)) - -(def-package! helm-nixos-options - :when (featurep! :completion helm) - :commands (helm-nixos-options)) +;;; 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 @@ -18,12 +10,12 @@ :n "r" #'nix-repl-show :n "s" #'nix-shell :n "b" #'nix-build - :n "u" #'nix-unpack) + :n "u" #'nix-unpack + (:when (featurep! :completion helm) + :n "o" #'helm-nixos-options))) - (when (featurep! :completion helm) - (map! :map nix-mode-map - :localleader - :n "o" #'helm-nixos-options)) +(def-package! nix-update + :commands (nix-update-fetch)) - (when (featurep! :completion company) - (set-company-backend! 'nix-mode 'company-nixos-options))) +(def-package! nix-repl + :commands (nix-repl-show)) From c33de42dce6546400700b6bd50e619cba0d3b4b9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 13:59:17 +0200 Subject: [PATCH 44/48] Don't use uname in doom/info on windows --- core/autoload/debug.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 82154d74f..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)))) From 6d0b27477460604f1b9015887af190cb16240a60 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 15:00:54 +0200 Subject: [PATCH 45/48] Simplify magit-todos-mode startup --- modules/tools/magit/config.el | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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)) From bb1171b64be037fcbf2e23298b9168ce5002cde4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 20:57:32 +0200 Subject: [PATCH 46/48] lang/python/autoload.el -> autoload/python.el --- modules/lang/python/{autoload.el => autoload/python.el} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename modules/lang/python/{autoload.el => autoload/python.el} (65%) 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 () From e8d4b74c29a9298ea8106c080f8ad34f3156c659 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 22:06:16 +0200 Subject: [PATCH 47/48] lang/python: refactor conda integration Removes the +python-conda-home variable and guesses conda-anaconda-home at startup. --- modules/lang/python/+conda.el | 38 ++++++++++++++++++--------- modules/lang/python/autoload/conda.el | 31 ++++++++++++---------- 2 files changed, 42 insertions(+), 27 deletions(-) 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. From 2968374081bd75b20224b1f49c189bde2eee8c4b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 17 Jul 2018 23:47:57 +0200 Subject: [PATCH 48/48] lang/haskell: fix haskell-hlint checker Causing "not a valid syntax checker" errors because it haskell-hlint was defined too soon. --- modules/lang/haskell/+dante.el | 5 ++++- modules/lang/haskell/+intero.el | 4 +++- modules/lang/haskell/config.el | 8 +------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/lang/haskell/+dante.el b/modules/lang/haskell/+dante.el index 51a9e3be4..5c7dd96f6 100644 --- a/modules/lang/haskell/+dante.el +++ b/modules/lang/haskell/+dante.el @@ -2,4 +2,7 @@ ;;;###if (featurep! +dante) (def-package! dante - :hook (haskell-mode . dante-mode)) + :hook (haskell-mode . dante-mode) + :config + (when (featurep! :feature syntax-checker) + (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/config.el b/modules/lang/haskell/config.el index 3facd2086..dd5b6d1b4 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -15,11 +15,5 @@ (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") - - (when (featurep! :feature syntax-checker) - (after! flycheck - (dolist (checker (delq nil (list (if (featurep! +intero) 'intero) - (if (featurep! +dante) 'haskell-dante)))) - (flycheck-add-next-checker checker '(warning . haskell-hlint)))))) + (add-to-list 'completion-ignored-extensions ".hi"))