diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 9d6d7eed0..349f34805 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -128,7 +128,8 @@ installed." 'builtin) ((assq package package-alist) 'elpa) - ('other))) + ((locate-library (symbol-name package)) + 'other))) ;;;###autoload (defun doom-package-different-recipe-p (name) diff --git a/core/autoload/themes.el b/core/autoload/themes.el index 2fb84ef3f..a78336cdf 100644 --- a/core/autoload/themes.el +++ b/core/autoload/themes.el @@ -34,8 +34,9 @@ all themes. It will apply to all themes once they are loaded." (defmacro custom-set-faces! (&rest specs) "Apply a list of face SPECS as user customizations. -This is a drop-in replacement for `custom-set-face' that allows for a simplified -face format." +This is a convenience macro alternative to `custom-set-face' which allows for a +simplified face format, and takes care of load order issues, so you can use +doom-themes' API without worry." (declare (indent defun)) `(custom-theme-set-faces! 'user ,@specs)) diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index 760c3f1ef..7936b24cd 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -65,10 +65,10 @@ (defun +spell-inhibit-duplicate-detection-maybe-h () "Don't mark duplicates when style/grammar linters are present. e.g. proselint and langtool." - (when (or (and (bound-and-true-p flycheck-mode) - (executable-find "proselint")) - (featurep 'langtool)) - (setq-local flyspell-mark-duplications-flag nil)))) + (and (or (and (bound-and-true-p flycheck-mode) + (executable-find "proselint")) + (featurep 'langtool)) + (setq-local flyspell-mark-duplications-flag nil)))) ;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are ;; used in their respective major modes. diff --git a/modules/checkers/syntax/config.el b/modules/checkers/syntax/config.el index 268fe2bc9..6d82bb0f5 100644 --- a/modules/checkers/syntax/config.el +++ b/modules/checkers/syntax/config.el @@ -10,8 +10,8 @@ (setq flycheck-emacs-lisp-load-path 'inherit) ;; Check only when saving or opening files. Newline & idle checks are a mote - ;; excessive, especially when that can easily catch code in an incomplete - ;; state, so we removed them. + ;; excessive and can catch code in an incomplete state, producing false + ;; positives, so we removed them. (setq flycheck-check-syntax-automatically '(save mode-enabled)) ;; Display errors a little quicker (default is 0.9s) @@ -41,7 +41,7 @@ (use-package! flycheck-popup-tip :commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup - :init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h) + :hook (flycheck-mode . +syntax-init-popups-h) :config (setq flycheck-popup-tip-error-prefix "✕ ") (after! evil @@ -58,8 +58,7 @@ (use-package! flycheck-posframe :when (featurep! +childframe) - :defer t - :init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h) + :hook (flycheck-mode . +syntax-init-popups-h) :config (setq flycheck-posframe-warning-prefix "⚠ " flycheck-posframe-info-prefix "··· " diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index dddf2309b..e5a34ea1e 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -4,19 +4,16 @@ :commands company-complete-common company-manual-begin company-grab-line :after-call pre-command-hook after-find-file :init - (setq company-minimum-prefix-length 2 + (setq company-idle-delay 0.25 + company-minimum-prefix-length 2 company-tooltip-limit 14 - company-dabbrev-downcase nil - company-dabbrev-ignore-case nil - company-dabbrev-code-other-buffers t company-tooltip-align-annotations t company-require-match 'never company-global-modes '(not erc-mode message-mode help-mode gud-mode eshell-mode) - company-backends '(company-capf) - company-frontends - '(company-pseudo-tooltip-frontend - company-echo-metadata-frontend)) + company-backends '(company-capf) + company-frontends '(company-pseudo-tooltip-frontend + company-echo-metadata-frontend)) :config (when (featurep! :editor evil) (add-hook 'company-mode-hook #'evil-normalize-keymaps) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index fd262e1d0..c8fe85553 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -297,8 +297,8 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." ;; no highlighting visited files; slows down the filtering (ivy-set-display-transformer #'counsel-projectile-find-file nil) - (if (featurep! +prescient) - (setq counsel-projectile-sort-files t))) + (when (featurep! +prescient) + (setq counsel-projectile-sort-files t))) (use-package! wgrep diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 542105924..79802177f 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -553,10 +553,10 @@ :desc "Find recent project files" "r" #'projectile-recentf :desc "Run project" "R" #'projectile-run-project :desc "Save project files" "s" #'projectile-save-project-buffers - :desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer - :desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer :desc "List project tasks" "t" #'magit-todos-list - :desc "Test project" "T" #'projectile-test-project) + :desc "Test project" "T" #'projectile-test-project + :desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer + :desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer) ;;; q --- quit/session (:prefix-map ("q" . "quit/session") diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 91af1f621..b4362a49a 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -1,19 +1,19 @@ ;;; config/default/config.el -*- lexical-binding: t; -*- (defvar +default-minibuffer-maps - `(minibuffer-local-map - minibuffer-local-ns-map - minibuffer-local-completion-map - minibuffer-local-must-match-map - minibuffer-local-isearch-map - read-expression-map - ,@(cond ((featurep! :completion ivy) - '(ivy-minibuffer-map - ivy-switch-buffer-map)) - ((featurep! :completion helm) - '(helm-map - helm-ag-map - helm-read-file-map)))) + (append '(minibuffer-local-map + minibuffer-local-ns-map + minibuffer-local-completion-map + minibuffer-local-must-match-map + minibuffer-local-isearch-map + read-expression-map) + (cond ((featurep! :completion ivy) + '(ivy-minibuffer-map + ivy-switch-buffer-map)) + ((featurep! :completion helm) + '(helm-map + helm-ag-map + helm-read-file-map)))) "A list of all the keymaps used for the minibuffer.") @@ -32,7 +32,7 @@ ;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt ;; for the key passphrase. (setq epa-pinentry-mode 'loopback) - ;; Default to the first secret key available in your keyring. + ;; Default to the first secret key available in your keyring. (setq-default epa-file-encrypt-to (or (default-value 'epa-file-encrypt-to) @@ -254,6 +254,7 @@ "s-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill) "s-v" #'yank "s-s" #'save-buffer + "s-x" #'execute-extended-command :v "s-x" #'kill-region ;; Buffer-local font scaling "s-+" #'doom/reset-font-size diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 9430e6a77..438085637 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -33,28 +33,24 @@ This is ignored by ccls.") ;;; Packages (use-package! cc-mode - :commands (c-mode c++-mode objc-mode java-mode) :mode ("\\.mm\\'" . objc-mode) - :init - ;; Activate `c-mode', `c++-mode' or `objc-mode' depending on heuristics - (add-to-list 'auto-mode-alist '("\\.h\\'" . +cc-c-c++-objc-mode)) - - ;; Ensure find-file-at-point works in C modes, must be added before irony - ;; and/or lsp hooks are run. - (add-hook! '(c-mode-local-vars-hook - c++-mode-local-vars-hook - objc-mode-local-vars-hook) - #'+cc-init-ffap-integration-h) - + ;; Use `c-mode'/`c++-mode'/`objc-mode' depending on heuristics + :mode ("\\.h\\'" . +cc-c-c++-objc-mode) + ;; Ensure find-file-at-point recognize system libraries in C modes. It must be + ;; set up before the likes of irony/lsp are initialized. Also, we use + ;; local-vars hooks to ensure these only run in their respective major modes, + ;; and not their derived modes. + :hook ((after-c-mode after-c++-mode after-objc-mode) . +cc-init-ffap-integration-h) + ;;; Improve fontification in C/C++ (also see `modern-cpp-font-lock') + :hook (c-mode-common . rainbow-delimiters-mode) + :hook ((c-mode c++-mode) . +cc-fontify-constants-h) :config - (set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{)) (set-docsets! 'c-mode "C") (set-docsets! 'c++-mode "C++" "Boost") - + (set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{)) (set-rotate-patterns! 'c++-mode :symbols '(("public" "protected" "private") ("class" "struct"))) - (set-pretty-symbols! '(c-mode c++-mode) ;; Functional ;; :def "void " @@ -71,10 +67,6 @@ This is ignored by ccls.") :return "return" :yield "#require") - ;;; Better fontification (also see `modern-cpp-font-lock') - (add-hook 'c-mode-common-hook #'rainbow-delimiters-mode) - (add-hook! '(c-mode-hook c++-mode-hook) #'+cc-fontify-constants-h) - ;; Custom style, based off of linux (setq c-basic-offset tab-width c-backspace-function #'delete-backward-char) @@ -122,23 +114,21 @@ This is ignored by ccls.") (use-package! irony :unless (featurep! +lsp) - :commands (irony-install-server irony-mode) - :preface - (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/")) - :init - (add-hook! '(c-mode-local-vars-hook - c++-mode-local-vars-hook - objc-mode-local-vars-hook) - (defun +cc-init-irony-mode-h () - (if (file-directory-p irony-server-install-prefix) - (irony-mode +1) - (message "Irony server isn't installed")))) - :config - (setq irony-cdb-search-directory-list '("." "build" "build-conda")) - + :commands irony-install-server ;; Initialize compilation database, if present. Otherwise, fall back on ;; `+cc-default-compiler-options'. - (add-hook 'irony-mode-hook #'+cc-init-irony-compile-options-h) + :hook (irony-mode . +cc-init-irony-compile-options-h) + ;; Only initialize `irony-mode' if the server is available. Otherwise fail + ;; quietly and gracefully. + :hook ((after-c-mode after-c++-mode after-objc-mode) . +cc-init-irony-mode-maybe-h) + :preface (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/")) + :config + (defun +cc-init-irony-mode-maybe-h () + (if (file-directory-p irony-server-install-prefix) + (irony-mode +1) + (message "Irony server isn't installed"))) + + (setq irony-cdb-search-directory-list '("." "build" "build-conda")) (use-package! irony-eldoc :hook (irony-mode . irony-eldoc)) @@ -149,19 +139,15 @@ This is ignored by ccls.") (use-package! company-irony :when (featurep! :completion company) - :init - (set-company-backend! 'irony-mode - '(:separate company-irony-c-headers company-irony)) - :config - (require 'company-irony-c-headers))) + :init (set-company-backend! 'irony-mode '(:separate company-irony-c-headers company-irony)) + :config (require 'company-irony-c-headers))) ;; ;; Major modes -(use-package! cmake-mode - :defer t - :config (set-docsets! 'cmake-mode "CMake")) +(after! cmake-mode + (set-docsets! 'cmake-mode "CMake")) (use-package! company-cmake ; for `cmake-mode' :when (featurep! :completion company) @@ -184,19 +170,17 @@ This is ignored by ccls.") (use-package! rtags :unless (featurep! +lsp) - :commands rtags-executable-find - :preface - (setq rtags-install-path (concat doom-etc-dir "rtags/")) - :init - (add-hook! '(c-mode-local-vars-hook - c++-mode-local-vars-hook - objc-mode-local-vars-hook) - (defun +cc-init-rtags-h () - "Start an rtags server in c-mode and c++-mode buffers." - (when (and (require 'rtags nil t) - (rtags-executable-find rtags-rdm-binary-name)) - (rtags-start-process-unless-running)))) + ;; Only initialize rtags-mode if rtags and rdm are available. + :hook ((after-c-mode after-c++-mode after-objc-mode) . +cc-init-rtags-maybe-h) + :preface (setq rtags-install-path (concat doom-etc-dir "rtags/")) :config + (defun +cc-init-rtags-maybe-h () + "Start an rtags server in c-mode and c++-mode buffers. +If rtags or rdm aren't available, fail silently instead of throwing a breaking error." + (and (require 'rtags nil t) + (rtags-executable-find rtags-rdm-binary-name) + (rtags-start-process-unless-running))) + (setq rtags-autostart-diagnostics t rtags-use-bookmarks nil rtags-completions-enabled nil @@ -221,11 +205,13 @@ This is ignored by ccls.") :definition #'rtags-find-symbol-at-point :references #'rtags-find-references-at-point) - (add-hook! 'kill-emacs-hook (ignore-errors (rtags-cancel-process))) - ;; Use rtags-imenu instead of imenu/counsel-imenu (define-key! (c-mode-map c++-mode-map) [remap imenu] #'+cc/imenu) + ;; Ensure rtags cleans up after itself properly when exiting Emacs, rather + ;; than display a jarring confirmation prompt for killing it. + (add-hook! 'kill-emacs-hook (ignore-errors (rtags-cancel-process))) + (add-hook 'rtags-jump-hook #'better-jumper-set-jump) (add-hook 'rtags-after-find-file-hook #'recenter)) diff --git a/modules/lang/coq/config.el b/modules/lang/coq/config.el index 98b202787..2b66cb6e1 100644 --- a/modules/lang/coq/config.el +++ b/modules/lang/coq/config.el @@ -72,11 +72,11 @@ (setq company-coq-disabled-features '(hello company-defaults)) (if (featurep! :completion company) - (map! :map coq-mode-map [remap company-complete-common] - #'company-indent-or-complete-common) + (define-key coq-mode-map [remap company-complete-common] + #'company-indent-or-complete-common) ;; `company-coq''s company defaults impose idle-completion on folks, so - ;; we'll set up company ourselves. - ;; See https://github.com/cpitclaudel/company-coq/issues/42 + ;; we'll set up company ourselves. See + ;; https://github.com/cpitclaudel/company-coq/issues/42 (add-to-list 'company-coq-disabled-features 'company)) (map! :map coq-mode-map diff --git a/modules/lang/csharp/autoload.el b/modules/lang/csharp/autoload.el index 0cdedf0bd..ba9e5814c 100644 --- a/modules/lang/csharp/autoload.el +++ b/modules/lang/csharp/autoload.el @@ -8,3 +8,8 @@ (sp-point-after-word-p id action context)) ((eq action 'autoskip) (/= (char-before) 32))))) + +;;;###autoload +(defun +csharp-kill-omnisharp-server-h () + (unless (doom-buffers-in-mode 'csharp-mode (buffer-list)) + (omnisharp-stop-server))) diff --git a/modules/lang/csharp/config.el b/modules/lang/csharp/config.el index 02f275800..7efcff727 100644 --- a/modules/lang/csharp/config.el +++ b/modules/lang/csharp/config.el @@ -1,12 +1,13 @@ ;;; lang/csharp/config.el -*- lexical-binding: t; -*- -(after! csharp-mode - (add-hook 'csharp-mode-hook #'rainbow-delimiters-mode) - +(use-package! csharp-mode + :hook (csharp-mode . rainbow-delimiters-mode) + :config (set-electric! 'csharp-mode :chars '(?\n ?\})) (set-rotate-patterns! 'csharp-mode :symbols '(("public" "protected" "private") ("class" "struct"))) + (sp-local-pair 'csharp-mode "<" ">" :when '(+csharp-sp-point-in-type-p) :post-handlers '(("| " "SPC"))) @@ -17,25 +18,22 @@ (use-package! omnisharp :unless (featurep! +lsp) - :hook (csharp-mode-local-vars . omnisharp-mode) :commands omnisharp-install-server + :hook (csharp-mode-local-vars . omnisharp-mode) :preface (setq omnisharp-auto-complete-want-documentation nil omnisharp-cache-directory (concat doom-etc-dir "omnisharp")) :config - (defun +csharp-cleanup-omnisharp-server-h () - "Clean up the omnisharp server once you kill the last csharp-mode buffer." - (unless (doom-buffers-in-mode 'csharp-mode (buffer-list)) - (omnisharp-stop-server))) - (add-hook! 'omnisharp-mode-hook - (add-hook 'kill-buffer-hook #'+csharp-cleanup-omnisharp-server-h nil t)) - (set-company-backend! 'omnisharp-mode 'company-omnisharp) (set-lookup-handlers! 'omnisharp-mode :definition #'omnisharp-go-to-definition :references #'omnisharp-find-usages :documentation #'omnisharp-current-type-documentation) + ;; Kill the omnisharp server once the last csharp-mode buffer is killed + (add-hook! 'omnisharp-mode-hook + (add-hook 'kill-buffer-hook #'+csharp-cleanup-omnisharp-server-h nil t)) + (map! :localleader :map omnisharp-mode-map "b" #'omnisharp-recompile @@ -60,11 +58,11 @@ "b" #'omnisharp-unit-test-buffer))) -;;;###package shader-mode -(when (featurep! +unity) - ;; Unity shaders - (add-to-list 'auto-mode-alist '("\\.shader\\'" . shader-mode)) - +;; Unity shaders +(use-package! shader-mode + :when (featurep! +unity) + :mode "\\.shader\\'" + :config (def-project-mode! +csharp-unity-mode :modes '(csharp-mode shader-mode) :files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper"))) diff --git a/modules/lang/csharp/packages.el b/modules/lang/csharp/packages.el index b05b5d4c4..7f3d9eba0 100644 --- a/modules/lang/csharp/packages.el +++ b/modules/lang/csharp/packages.el @@ -2,9 +2,7 @@ ;;; lang/csharp/packages.el (package! csharp-mode :pin "57bd21bda4") - (unless (featurep! +lsp) (package! omnisharp :pin "e658a18a76")) - (when (featurep! +unity) (package! shader-mode :pin "d7dc8d0d6f")) diff --git a/modules/lang/elixir/config.el b/modules/lang/elixir/config.el index 20915990d..fee2fab64 100644 --- a/modules/lang/elixir/config.el +++ b/modules/lang/elixir/config.el @@ -37,31 +37,30 @@ (sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))) (when (featurep! +lsp) - (add-hook 'elixir-mode-local-vars-hook #'lsp!)) + (add-hook 'elixir-mode-local-vars-hook #'lsp!))) - (use-package! flycheck-credo - :when (featurep! :checkers syntax) - :config (flycheck-credo-setup))) + +(use-package! flycheck-credo + :when (featurep! :checkers syntax) + :after elixir-mode + :config (flycheck-credo-setup)) (use-package! alchemist :hook (elixir-mode . alchemist-mode) - :init - (after! elixir-mode - (set-lookup-handlers! 'elixir-mode - :definition #'alchemist-goto-definition-at-point - :documentation #'alchemist-help-search-at-point) - (set-eval-handler! 'elixir-mode #'alchemist-eval-region) - (set-repl-handler! 'elixir-mode #'alchemist-iex-project-run))) + :config + (set-lookup-handlers! 'alchemist-mode + :definition #'alchemist-goto-definition-at-point + :documentation #'alchemist-help-search-at-point) + (set-eval-handler! 'alchemist-mode #'alchemist-eval-region) + (set-repl-handler! 'alchemist-mode #'alchemist-iex-project-run)) (use-package! alchemist-company :when (featurep! :completion company) :commands alchemist-company - :init - (after! elixir-mode - (set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet))) :config + (set-company-backend! 'alchemist-mode '(alchemist-company company-yasnippet)) ;; Alchemist doesn't use hook symbols to add these backends, so we have to use ;; the entire closure to get rid of it. (let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company))))) diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index 948675616..6816369e7 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -44,7 +44,7 @@ (:prefix ("ri" . "imports") "a" #'go-import-add "r" #'go-remove-unused-imports) - (:prefix ( "b" . "build") + (:prefix ("b" . "build") :desc "go run ." "r" (λ! (compile "go run .")) :desc "go build" "b" (λ! (compile "go build")) :desc "go clean" "c" (λ! (compile "go clean"))) diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index 1d73bceba..c2fddb09b 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -58,11 +58,7 @@ mode-name "JS2") (set-electric! 'js2-mode :chars '(?\} ?\) ?. ?:)) - (set-repl-handler! 'js2-mode #'+javascript/open-repl) - - (map! :map js2-mode-map - :localleader - "S" #'+javascript/skewer-this-buffer)) + (set-repl-handler! 'js2-mode #'+javascript/open-repl)) (use-package! rjsx-mode @@ -84,10 +80,10 @@ ;; jshint doesn't know how to deal with jsx (push 'javascript-jshint flycheck-disabled-checkers))) - ;; `rjsx-electric-gt' relies on js2's parser to tell it when the cursor is in - ;; a self-closing tag, so that it can insert a matching ending tag at point. - ;; However, the parser doesn't run immediately, so a fast typist can outrun - ;; it, causing tags to stay unclosed, so we force it to parse. + ;; HACK `rjsx-electric-gt' relies on js2's parser to tell it when the cursor + ;; is in a self-closing tag, so that it can insert a matching ending tag + ;; at point. The parser doesn't run immediately however, so a fast typist + ;; can outrun it, causing tags to stay unclosed, so force it to parse: (defadvice! +javascript-reparse-a (n) ;; if n != 1, rjsx-electric-gt calls rjsx-maybe-reparse itself :before #'rjsx-electric-gt @@ -95,7 +91,7 @@ (use-package! typescript-mode - :defer t + :hook (typescript-mode . rainbow-delimiters-mode) :init ;; REVIEW Fix #2252. This is overwritten if the :lang web module is enabled. ;; We associate TSX files with `web-mode' by default instead because @@ -104,9 +100,6 @@ (unless (featurep! :lang web) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))) :config - (add-hook 'typescript-mode-hook #'rainbow-delimiters-mode) - (setq-hook! 'typescript-mode-hook - comment-line-break-function #'js2-line-break) (set-electric! 'typescript-mode :chars '(?\} ?\)) :words '("||" "&&")) (set-docsets! 'typescript-mode "TypeScript" "AngularTS") @@ -125,7 +118,10 @@ :not "!" :and "&&" :or "||" :for "for" - :return "return" :yield "import")) + :return "return" :yield "import") + ;; HACK Fixes comment continuation on newline + (setq-hook! 'typescript-mode-hook + comment-line-break-function #'js2-line-break)) ;;;###package coffee-mode @@ -254,6 +250,7 @@ to tide." (map! :localleader (:after js2-mode :map js2-mode-map + "S" #'+javascript/skewer-this-buffer :prefix ("s" . "skewer")) :prefix "s" (:after skewer-mode @@ -278,13 +275,12 @@ to tide." (use-package! npm-mode :hook ((js-mode typescript-mode) . npm-mode) :config - (map! (:localleader - :map npm-mode-keymap + (map! :localleader + (:map npm-mode-keymap "n" npm-mode-command-keymap) (:after js2-mode :map js2-mode-map - :localleader - (:prefix ("n" . "npm"))))) + :prefix ("n" . "npm")))) ;; diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index a73d5bb5a..8c22f173e 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -39,6 +39,7 @@ If no viewers are found, `latex-preview-pane' is used.") ;; automatically insert braces after sub/superscript in math mode TeX-electric-sub-and-superscript t) + (after! tex ;; fontify common latex commands (load! "+fontification") @@ -120,9 +121,9 @@ If no viewers are found, `latex-preview-pane' is used.") (use-package! cdlatex - :defer t :when (featurep! +cdlatex) :hook (LaTeX-mode . cdlatex-mode) + :hook (org-mode . org-cdlatex-mode) :config ;; Use \( ... \) instead of $ ... $ (setq cdlatex-use-dollar-to-ensure-math nil) @@ -130,22 +131,22 @@ If no viewers are found, `latex-preview-pane' is used.") (map! :map cdlatex-mode-map ;; smartparens takes care of inserting closing delimiters, and if you ;; don't use smartparens you probably won't want these also. - :g "$" nil - :g "(" nil - :g "{" nil - :g "[" nil - :g "|" nil - :g "<" nil + "$" nil + "(" nil + "{" nil + "[" nil + "|" nil + "<" nil ;; TAB is used for cdlatex's snippets and navigation. But we have ;; yasnippet for that. (:when (featurep! :editor snippets) - :g "TAB" nil) + "TAB" nil) ;; AUCTeX takes care of auto-inserting {} on _^ if you want, with ;; `TeX-electric-sub-and-superscript' - :g "^" nil - :g "_" nil + "^" nil + "_" nil ;; AUCTeX already provides this with `LaTeX-insert-item' - :g [(control return)] nil)) + [(control return)] nil)) ;; Nicely indent lines that have wrapped when visual line mode is activated diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 63f4f2b57..e5cd0e76e 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -126,9 +126,9 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default ;; underlying faces like the `org-todo' face does, so we define our own ;; intermediary faces that extend from org-todo. (with-no-warnings - (custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "") + (custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "") (custom-declare-face '+org-todo-project '((t (:inherit (bold font-lock-doc-face org-todo)))) "") - (custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) "")) + (custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) "")) (setq org-todo-keywords '((sequence "TODO(t)" ; A task that needs doing & is ready to do @@ -159,7 +159,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default (apply orig-fn args))) ;; Automatic indent detection in org files is meaningless - (cl-pushnew 'org-mode doom-detect-indentation-excluded-modes :test #'eq) + (add-to-list 'doom-detect-indentation-excluded-modes 'org-mode) (set-pretty-symbols! 'org-mode :name "#+NAME:" diff --git a/modules/lang/php/config.el b/modules/lang/php/config.el index a141306d7..5405c1ec5 100644 --- a/modules/lang/php/config.el +++ b/modules/lang/php/config.el @@ -14,7 +14,7 @@ :mode "\\.inc\\'" :config ;; Disable HTML compatibility in php-mode. `web-mode' has superior support for - ;; php+html. Use the .phtml + ;; php+html. Use the .phtml extension instead. (setq php-template-compatibility nil) (set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM") @@ -54,7 +54,6 @@ :config (set-lookup-handlers! 'php-mode :definition #'phpactor-goto-definition) - (map! :localleader :map php-mode-map :prefix ("r" . "refactor") diff --git a/modules/term/vterm/config.el b/modules/term/vterm/config.el index e9d2a61cc..18938206c 100644 --- a/modules/term/vterm/config.el +++ b/modules/term/vterm/config.el @@ -1,7 +1,7 @@ ;;; term/vterm/config.el -*- lexical-binding: t; -*- (use-package! vterm - :when (boundp 'module-file-suffix) + :when (bound-and-true-p module-file-suffix) :commands (vterm vterm-mode) :preface (setq vterm-install t) :config diff --git a/modules/tools/lsp/README.org b/modules/tools/lsp/README.org index 7ee5342fc..e83ae975b 100644 --- a/modules/tools/lsp/README.org +++ b/modules/tools/lsp/README.org @@ -52,7 +52,8 @@ As of this writing, this is the state of LSP support in Doom Emacs: | [[../../lang/web/README.org][:lang web]] | web-mode, css-mode, scss-mode, sass-mode, less-css-mode | vscode-css-languageserver-bin, vscode-html-languageserver-bin | ** Module Flags -+ =+peek= Enables the =lsp-ui-peek= navigation frontend provided by the =lsp-ui= package. ++ =+peek= Use =lsp-ui-peek= when looking up definitions and references with + functionality from the =:tools lookup= module. ** Plugins + [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]] diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index a2f43c246..ad39be7f0 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -41,15 +41,17 @@ ;; after eob. On Emacs 27 this no longer happens. (unless EMACS27+ (defun +doom--line-range-fn () - (cons (line-beginning-position) - (cond ((let ((eol (line-end-position))) - (and (= eol (point-max)) - (/= eol (line-beginning-position)))) - (1- (line-end-position))) - ((or (eobp) - (= (line-end-position 2) (point-max))) - (line-end-position)) - ((line-beginning-position 2))))) + (let ((bol (line-beginning-position)) + (eol (line-end-position)) + (pmax (point-max))) + (cons bol + (cond ((and (= eol pmax) + (/= eol bol)) + (1- eol)) + ((or (eobp) + (= eol pmax)) + eol) + ((line-beginning-position 2)))))) (setq hl-line-range-function #'+doom--line-range-fn)) ;; Because fringes can't be given a buffer-local face, they can look odd, so