General, minor refactor & reformatting

This commit is contained in:
Henrik Lissner 2020-03-27 01:25:30 -04:00
parent 2ecd100c38
commit 169f9a6121
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
22 changed files with 161 additions and 177 deletions

View file

@ -128,7 +128,8 @@ installed."
'builtin) 'builtin)
((assq package package-alist) ((assq package package-alist)
'elpa) 'elpa)
('other))) ((locate-library (symbol-name package))
'other)))
;;;###autoload ;;;###autoload
(defun doom-package-different-recipe-p (name) (defun doom-package-different-recipe-p (name)

View file

@ -34,8 +34,9 @@ all themes. It will apply to all themes once they are loaded."
(defmacro custom-set-faces! (&rest specs) (defmacro custom-set-faces! (&rest specs)
"Apply a list of face SPECS as user customizations. "Apply a list of face SPECS as user customizations.
This is a drop-in replacement for `custom-set-face' that allows for a simplified This is a convenience macro alternative to `custom-set-face' which allows for a
face format." simplified face format, and takes care of load order issues, so you can use
doom-themes' API without worry."
(declare (indent defun)) (declare (indent defun))
`(custom-theme-set-faces! 'user ,@specs)) `(custom-theme-set-faces! 'user ,@specs))

View file

@ -65,10 +65,10 @@
(defun +spell-inhibit-duplicate-detection-maybe-h () (defun +spell-inhibit-duplicate-detection-maybe-h ()
"Don't mark duplicates when style/grammar linters are present. "Don't mark duplicates when style/grammar linters are present.
e.g. proselint and langtool." e.g. proselint and langtool."
(when (or (and (bound-and-true-p flycheck-mode) (and (or (and (bound-and-true-p flycheck-mode)
(executable-find "proselint")) (executable-find "proselint"))
(featurep 'langtool)) (featurep 'langtool))
(setq-local flyspell-mark-duplications-flag nil)))) (setq-local flyspell-mark-duplications-flag nil))))
;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are ;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are
;; used in their respective major modes. ;; used in their respective major modes.

View file

@ -10,8 +10,8 @@
(setq flycheck-emacs-lisp-load-path 'inherit) (setq flycheck-emacs-lisp-load-path 'inherit)
;; Check only when saving or opening files. Newline & idle checks are a mote ;; Check only when saving or opening files. Newline & idle checks are a mote
;; excessive, especially when that can easily catch code in an incomplete ;; excessive and can catch code in an incomplete state, producing false
;; state, so we removed them. ;; positives, so we removed them.
(setq flycheck-check-syntax-automatically '(save mode-enabled)) (setq flycheck-check-syntax-automatically '(save mode-enabled))
;; Display errors a little quicker (default is 0.9s) ;; Display errors a little quicker (default is 0.9s)
@ -41,7 +41,7 @@
(use-package! flycheck-popup-tip (use-package! flycheck-popup-tip
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup :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 :config
(setq flycheck-popup-tip-error-prefix "") (setq flycheck-popup-tip-error-prefix "")
(after! evil (after! evil
@ -58,8 +58,7 @@
(use-package! flycheck-posframe (use-package! flycheck-posframe
:when (featurep! +childframe) :when (featurep! +childframe)
:defer t :hook (flycheck-mode . +syntax-init-popups-h)
:init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h)
:config :config
(setq flycheck-posframe-warning-prefix "" (setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· " flycheck-posframe-info-prefix "··· "

View file

@ -4,19 +4,16 @@
:commands company-complete-common company-manual-begin company-grab-line :commands company-complete-common company-manual-begin company-grab-line
:after-call pre-command-hook after-find-file :after-call pre-command-hook after-find-file
:init :init
(setq company-minimum-prefix-length 2 (setq company-idle-delay 0.25
company-minimum-prefix-length 2
company-tooltip-limit 14 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-tooltip-align-annotations t
company-require-match 'never company-require-match 'never
company-global-modes company-global-modes
'(not erc-mode message-mode help-mode gud-mode eshell-mode) '(not erc-mode message-mode help-mode gud-mode eshell-mode)
company-backends '(company-capf) company-backends '(company-capf)
company-frontends company-frontends '(company-pseudo-tooltip-frontend
'(company-pseudo-tooltip-frontend company-echo-metadata-frontend))
company-echo-metadata-frontend))
:config :config
(when (featurep! :editor evil) (when (featurep! :editor evil)
(add-hook 'company-mode-hook #'evil-normalize-keymaps) (add-hook 'company-mode-hook #'evil-normalize-keymaps)

View file

@ -297,8 +297,8 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; no highlighting visited files; slows down the filtering ;; no highlighting visited files; slows down the filtering
(ivy-set-display-transformer #'counsel-projectile-find-file nil) (ivy-set-display-transformer #'counsel-projectile-find-file nil)
(if (featurep! +prescient) (when (featurep! +prescient)
(setq counsel-projectile-sort-files t))) (setq counsel-projectile-sort-files t)))
(use-package! wgrep (use-package! wgrep

View file

@ -553,10 +553,10 @@
:desc "Find recent project files" "r" #'projectile-recentf :desc "Find recent project files" "r" #'projectile-recentf
:desc "Run project" "R" #'projectile-run-project :desc "Run project" "R" #'projectile-run-project
:desc "Save project files" "s" #'projectile-save-project-buffers :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 "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)
;;; <leader> q --- quit/session ;;; <leader> q --- quit/session
(:prefix-map ("q" . "quit/session") (:prefix-map ("q" . "quit/session")

View file

@ -1,19 +1,19 @@
;;; config/default/config.el -*- lexical-binding: t; -*- ;;; config/default/config.el -*- lexical-binding: t; -*-
(defvar +default-minibuffer-maps (defvar +default-minibuffer-maps
`(minibuffer-local-map (append '(minibuffer-local-map
minibuffer-local-ns-map minibuffer-local-ns-map
minibuffer-local-completion-map minibuffer-local-completion-map
minibuffer-local-must-match-map minibuffer-local-must-match-map
minibuffer-local-isearch-map minibuffer-local-isearch-map
read-expression-map read-expression-map)
,@(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)
'(ivy-minibuffer-map '(ivy-minibuffer-map
ivy-switch-buffer-map)) ivy-switch-buffer-map))
((featurep! :completion helm) ((featurep! :completion helm)
'(helm-map '(helm-map
helm-ag-map helm-ag-map
helm-read-file-map)))) helm-read-file-map))))
"A list of all the keymaps used for the minibuffer.") "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 ;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt
;; for the key passphrase. ;; for the key passphrase.
(setq epa-pinentry-mode 'loopback) (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 (setq-default
epa-file-encrypt-to epa-file-encrypt-to
(or (default-value '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-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill)
"s-v" #'yank "s-v" #'yank
"s-s" #'save-buffer "s-s" #'save-buffer
"s-x" #'execute-extended-command
:v "s-x" #'kill-region :v "s-x" #'kill-region
;; Buffer-local font scaling ;; Buffer-local font scaling
"s-+" #'doom/reset-font-size "s-+" #'doom/reset-font-size

View file

@ -33,28 +33,24 @@ This is ignored by ccls.")
;;; Packages ;;; Packages
(use-package! cc-mode (use-package! cc-mode
:commands (c-mode c++-mode objc-mode java-mode)
:mode ("\\.mm\\'" . objc-mode) :mode ("\\.mm\\'" . objc-mode)
:init ;; Use `c-mode'/`c++-mode'/`objc-mode' depending on heuristics
;; Activate `c-mode', `c++-mode' or `objc-mode' depending on heuristics :mode ("\\.h\\'" . +cc-c-c++-objc-mode)
(add-to-list 'auto-mode-alist '("\\.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
;; Ensure find-file-at-point works in C modes, must be added before irony ;; local-vars hooks to ensure these only run in their respective major modes,
;; and/or lsp hooks are run. ;; and not their derived modes.
(add-hook! '(c-mode-local-vars-hook :hook ((after-c-mode after-c++-mode after-objc-mode) . +cc-init-ffap-integration-h)
c++-mode-local-vars-hook ;;; Improve fontification in C/C++ (also see `modern-cpp-font-lock')
objc-mode-local-vars-hook) :hook (c-mode-common . rainbow-delimiters-mode)
#'+cc-init-ffap-integration-h) :hook ((c-mode c++-mode) . +cc-fontify-constants-h)
:config :config
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
(set-docsets! 'c-mode "C") (set-docsets! 'c-mode "C")
(set-docsets! 'c++-mode "C++" "Boost") (set-docsets! 'c++-mode "C++" "Boost")
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
(set-rotate-patterns! 'c++-mode (set-rotate-patterns! 'c++-mode
:symbols '(("public" "protected" "private") :symbols '(("public" "protected" "private")
("class" "struct"))) ("class" "struct")))
(set-pretty-symbols! '(c-mode c++-mode) (set-pretty-symbols! '(c-mode c++-mode)
;; Functional ;; Functional
;; :def "void " ;; :def "void "
@ -71,10 +67,6 @@ This is ignored by ccls.")
:return "return" :return "return"
:yield "#require") :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 ;; Custom style, based off of linux
(setq c-basic-offset tab-width (setq c-basic-offset tab-width
c-backspace-function #'delete-backward-char) c-backspace-function #'delete-backward-char)
@ -122,23 +114,21 @@ This is ignored by ccls.")
(use-package! irony (use-package! irony
:unless (featurep! +lsp) :unless (featurep! +lsp)
:commands (irony-install-server irony-mode) :commands irony-install-server
: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"))
;; Initialize compilation database, if present. Otherwise, fall back on ;; Initialize compilation database, if present. Otherwise, fall back on
;; `+cc-default-compiler-options'. ;; `+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 (use-package! irony-eldoc
:hook (irony-mode . irony-eldoc)) :hook (irony-mode . irony-eldoc))
@ -149,19 +139,15 @@ This is ignored by ccls.")
(use-package! company-irony (use-package! company-irony
:when (featurep! :completion company) :when (featurep! :completion company)
:init :init (set-company-backend! 'irony-mode '(:separate company-irony-c-headers company-irony))
(set-company-backend! 'irony-mode :config (require 'company-irony-c-headers)))
'(:separate company-irony-c-headers company-irony))
:config
(require 'company-irony-c-headers)))
;; ;;
;; Major modes ;; Major modes
(use-package! cmake-mode (after! cmake-mode
:defer t (set-docsets! 'cmake-mode "CMake"))
:config (set-docsets! 'cmake-mode "CMake"))
(use-package! company-cmake ; for `cmake-mode' (use-package! company-cmake ; for `cmake-mode'
:when (featurep! :completion company) :when (featurep! :completion company)
@ -184,19 +170,17 @@ This is ignored by ccls.")
(use-package! rtags (use-package! rtags
:unless (featurep! +lsp) :unless (featurep! +lsp)
:commands rtags-executable-find ;; Only initialize rtags-mode if rtags and rdm are available.
:preface :hook ((after-c-mode after-c++-mode after-objc-mode) . +cc-init-rtags-maybe-h)
(setq rtags-install-path (concat doom-etc-dir "rtags/")) :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))))
:config :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 (setq rtags-autostart-diagnostics t
rtags-use-bookmarks nil rtags-use-bookmarks nil
rtags-completions-enabled nil rtags-completions-enabled nil
@ -221,11 +205,13 @@ This is ignored by ccls.")
:definition #'rtags-find-symbol-at-point :definition #'rtags-find-symbol-at-point
:references #'rtags-find-references-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 ;; Use rtags-imenu instead of imenu/counsel-imenu
(define-key! (c-mode-map c++-mode-map) [remap imenu] #'+cc/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-jump-hook #'better-jumper-set-jump)
(add-hook 'rtags-after-find-file-hook #'recenter)) (add-hook 'rtags-after-find-file-hook #'recenter))

View file

@ -72,11 +72,11 @@
(setq company-coq-disabled-features '(hello company-defaults)) (setq company-coq-disabled-features '(hello company-defaults))
(if (featurep! :completion company) (if (featurep! :completion company)
(map! :map coq-mode-map [remap company-complete-common] (define-key coq-mode-map [remap company-complete-common]
#'company-indent-or-complete-common) #'company-indent-or-complete-common)
;; `company-coq''s company defaults impose idle-completion on folks, so ;; `company-coq''s company defaults impose idle-completion on folks, so
;; we'll set up company ourselves. ;; we'll set up company ourselves. See
;; See https://github.com/cpitclaudel/company-coq/issues/42 ;; https://github.com/cpitclaudel/company-coq/issues/42
(add-to-list 'company-coq-disabled-features 'company)) (add-to-list 'company-coq-disabled-features 'company))
(map! :map coq-mode-map (map! :map coq-mode-map

View file

@ -8,3 +8,8 @@
(sp-point-after-word-p id action context)) (sp-point-after-word-p id action context))
((eq action 'autoskip) ((eq action 'autoskip)
(/= (char-before) 32))))) (/= (char-before) 32)))))
;;;###autoload
(defun +csharp-kill-omnisharp-server-h ()
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
(omnisharp-stop-server)))

View file

@ -1,12 +1,13 @@
;;; lang/csharp/config.el -*- lexical-binding: t; -*- ;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(after! csharp-mode (use-package! csharp-mode
(add-hook 'csharp-mode-hook #'rainbow-delimiters-mode) :hook (csharp-mode . rainbow-delimiters-mode)
:config
(set-electric! 'csharp-mode :chars '(?\n ?\})) (set-electric! 'csharp-mode :chars '(?\n ?\}))
(set-rotate-patterns! 'csharp-mode (set-rotate-patterns! 'csharp-mode
:symbols '(("public" "protected" "private") :symbols '(("public" "protected" "private")
("class" "struct"))) ("class" "struct")))
(sp-local-pair 'csharp-mode "<" ">" (sp-local-pair 'csharp-mode "<" ">"
:when '(+csharp-sp-point-in-type-p) :when '(+csharp-sp-point-in-type-p)
:post-handlers '(("| " "SPC"))) :post-handlers '(("| " "SPC")))
@ -17,25 +18,22 @@
(use-package! omnisharp (use-package! omnisharp
:unless (featurep! +lsp) :unless (featurep! +lsp)
:hook (csharp-mode-local-vars . omnisharp-mode)
:commands omnisharp-install-server :commands omnisharp-install-server
:hook (csharp-mode-local-vars . omnisharp-mode)
:preface :preface
(setq omnisharp-auto-complete-want-documentation nil (setq omnisharp-auto-complete-want-documentation nil
omnisharp-cache-directory (concat doom-etc-dir "omnisharp")) omnisharp-cache-directory (concat doom-etc-dir "omnisharp"))
:config :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-company-backend! 'omnisharp-mode 'company-omnisharp)
(set-lookup-handlers! 'omnisharp-mode (set-lookup-handlers! 'omnisharp-mode
:definition #'omnisharp-go-to-definition :definition #'omnisharp-go-to-definition
:references #'omnisharp-find-usages :references #'omnisharp-find-usages
:documentation #'omnisharp-current-type-documentation) :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! :localleader
:map omnisharp-mode-map :map omnisharp-mode-map
"b" #'omnisharp-recompile "b" #'omnisharp-recompile
@ -60,11 +58,11 @@
"b" #'omnisharp-unit-test-buffer))) "b" #'omnisharp-unit-test-buffer)))
;;;###package shader-mode ;; Unity shaders
(when (featurep! +unity) (use-package! shader-mode
;; Unity shaders :when (featurep! +unity)
(add-to-list 'auto-mode-alist '("\\.shader\\'" . shader-mode)) :mode "\\.shader\\'"
:config
(def-project-mode! +csharp-unity-mode (def-project-mode! +csharp-unity-mode
:modes '(csharp-mode shader-mode) :modes '(csharp-mode shader-mode)
:files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper"))) :files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper")))

View file

@ -2,9 +2,7 @@
;;; lang/csharp/packages.el ;;; lang/csharp/packages.el
(package! csharp-mode :pin "57bd21bda4") (package! csharp-mode :pin "57bd21bda4")
(unless (featurep! +lsp) (unless (featurep! +lsp)
(package! omnisharp :pin "e658a18a76")) (package! omnisharp :pin "e658a18a76"))
(when (featurep! +unity) (when (featurep! +unity)
(package! shader-mode :pin "d7dc8d0d6f")) (package! shader-mode :pin "d7dc8d0d6f"))

View file

@ -37,31 +37,30 @@
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))) (sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p)))
(when (featurep! +lsp) (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) (use-package! flycheck-credo
:config (flycheck-credo-setup))) :when (featurep! :checkers syntax)
:after elixir-mode
:config (flycheck-credo-setup))
(use-package! alchemist (use-package! alchemist
:hook (elixir-mode . alchemist-mode) :hook (elixir-mode . alchemist-mode)
:init :config
(after! elixir-mode (set-lookup-handlers! 'alchemist-mode
(set-lookup-handlers! 'elixir-mode :definition #'alchemist-goto-definition-at-point
:definition #'alchemist-goto-definition-at-point :documentation #'alchemist-help-search-at-point)
:documentation #'alchemist-help-search-at-point) (set-eval-handler! 'alchemist-mode #'alchemist-eval-region)
(set-eval-handler! 'elixir-mode #'alchemist-eval-region) (set-repl-handler! 'alchemist-mode #'alchemist-iex-project-run))
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run)))
(use-package! alchemist-company (use-package! alchemist-company
:when (featurep! :completion company) :when (featurep! :completion company)
:commands alchemist-company :commands alchemist-company
:init
(after! elixir-mode
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet)))
:config :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 ;; Alchemist doesn't use hook symbols to add these backends, so we have to use
;; the entire closure to get rid of it. ;; the entire closure to get rid of it.
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company))))) (let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))

View file

@ -44,7 +44,7 @@
(:prefix ("ri" . "imports") (:prefix ("ri" . "imports")
"a" #'go-import-add "a" #'go-import-add
"r" #'go-remove-unused-imports) "r" #'go-remove-unused-imports)
(:prefix ( "b" . "build") (:prefix ("b" . "build")
:desc "go run ." "r" (λ! (compile "go run .")) :desc "go run ." "r" (λ! (compile "go run ."))
:desc "go build" "b" (λ! (compile "go build")) :desc "go build" "b" (λ! (compile "go build"))
:desc "go clean" "c" (λ! (compile "go clean"))) :desc "go clean" "c" (λ! (compile "go clean")))

View file

@ -58,11 +58,7 @@
mode-name "JS2") mode-name "JS2")
(set-electric! 'js2-mode :chars '(?\} ?\) ?. ?:)) (set-electric! 'js2-mode :chars '(?\} ?\) ?. ?:))
(set-repl-handler! 'js2-mode #'+javascript/open-repl) (set-repl-handler! 'js2-mode #'+javascript/open-repl))
(map! :map js2-mode-map
:localleader
"S" #'+javascript/skewer-this-buffer))
(use-package! rjsx-mode (use-package! rjsx-mode
@ -84,10 +80,10 @@
;; jshint doesn't know how to deal with jsx ;; jshint doesn't know how to deal with jsx
(push 'javascript-jshint flycheck-disabled-checkers))) (push 'javascript-jshint flycheck-disabled-checkers)))
;; `rjsx-electric-gt' relies on js2's parser to tell it when the cursor is in ;; HACK `rjsx-electric-gt' relies on js2's parser to tell it when the cursor
;; a self-closing tag, so that it can insert a matching ending tag at point. ;; is in a self-closing tag, so that it can insert a matching ending tag
;; However, the parser doesn't run immediately, so a fast typist can outrun ;; at point. The parser doesn't run immediately however, so a fast typist
;; it, causing tags to stay unclosed, so we force it to parse. ;; can outrun it, causing tags to stay unclosed, so force it to parse:
(defadvice! +javascript-reparse-a (n) (defadvice! +javascript-reparse-a (n)
;; if n != 1, rjsx-electric-gt calls rjsx-maybe-reparse itself ;; if n != 1, rjsx-electric-gt calls rjsx-maybe-reparse itself
:before #'rjsx-electric-gt :before #'rjsx-electric-gt
@ -95,7 +91,7 @@
(use-package! typescript-mode (use-package! typescript-mode
:defer t :hook (typescript-mode . rainbow-delimiters-mode)
:init :init
;; REVIEW Fix #2252. This is overwritten if the :lang web module is enabled. ;; REVIEW Fix #2252. This is overwritten if the :lang web module is enabled.
;; We associate TSX files with `web-mode' by default instead because ;; We associate TSX files with `web-mode' by default instead because
@ -104,9 +100,6 @@
(unless (featurep! :lang web) (unless (featurep! :lang web)
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)))
:config :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 (set-electric! 'typescript-mode
:chars '(?\} ?\)) :words '("||" "&&")) :chars '(?\} ?\)) :words '("||" "&&"))
(set-docsets! 'typescript-mode "TypeScript" "AngularTS") (set-docsets! 'typescript-mode "TypeScript" "AngularTS")
@ -125,7 +118,10 @@
:not "!" :not "!"
:and "&&" :or "||" :and "&&" :or "||"
:for "for" :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 ;;;###package coffee-mode
@ -254,6 +250,7 @@ to tide."
(map! :localleader (map! :localleader
(:after js2-mode (:after js2-mode
:map js2-mode-map :map js2-mode-map
"S" #'+javascript/skewer-this-buffer
:prefix ("s" . "skewer")) :prefix ("s" . "skewer"))
:prefix "s" :prefix "s"
(:after skewer-mode (:after skewer-mode
@ -278,13 +275,12 @@ to tide."
(use-package! npm-mode (use-package! npm-mode
:hook ((js-mode typescript-mode) . npm-mode) :hook ((js-mode typescript-mode) . npm-mode)
:config :config
(map! (:localleader (map! :localleader
:map npm-mode-keymap (:map npm-mode-keymap
"n" npm-mode-command-keymap) "n" npm-mode-command-keymap)
(:after js2-mode (:after js2-mode
:map js2-mode-map :map js2-mode-map
:localleader :prefix ("n" . "npm"))))
(:prefix ("n" . "npm")))))
;; ;;

View file

@ -39,6 +39,7 @@ If no viewers are found, `latex-preview-pane' is used.")
;; automatically insert braces after sub/superscript in math mode ;; automatically insert braces after sub/superscript in math mode
TeX-electric-sub-and-superscript t) TeX-electric-sub-and-superscript t)
(after! tex (after! tex
;; fontify common latex commands ;; fontify common latex commands
(load! "+fontification") (load! "+fontification")
@ -120,9 +121,9 @@ If no viewers are found, `latex-preview-pane' is used.")
(use-package! cdlatex (use-package! cdlatex
:defer t
:when (featurep! +cdlatex) :when (featurep! +cdlatex)
:hook (LaTeX-mode . cdlatex-mode) :hook (LaTeX-mode . cdlatex-mode)
:hook (org-mode . org-cdlatex-mode)
:config :config
;; Use \( ... \) instead of $ ... $ ;; Use \( ... \) instead of $ ... $
(setq cdlatex-use-dollar-to-ensure-math nil) (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 (map! :map cdlatex-mode-map
;; smartparens takes care of inserting closing delimiters, and if you ;; smartparens takes care of inserting closing delimiters, and if you
;; don't use smartparens you probably won't want these also. ;; don't use smartparens you probably won't want these also.
:g "$" nil "$" nil
:g "(" nil "(" nil
:g "{" nil "{" nil
:g "[" nil "[" nil
:g "|" nil "|" nil
:g "<" nil "<" nil
;; TAB is used for cdlatex's snippets and navigation. But we have ;; TAB is used for cdlatex's snippets and navigation. But we have
;; yasnippet for that. ;; yasnippet for that.
(:when (featurep! :editor snippets) (:when (featurep! :editor snippets)
:g "TAB" nil) "TAB" nil)
;; AUCTeX takes care of auto-inserting {} on _^ if you want, with ;; AUCTeX takes care of auto-inserting {} on _^ if you want, with
;; `TeX-electric-sub-and-superscript' ;; `TeX-electric-sub-and-superscript'
:g "^" nil "^" nil
:g "_" nil "_" nil
;; AUCTeX already provides this with `LaTeX-insert-item' ;; 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 ;; Nicely indent lines that have wrapped when visual line mode is activated

View file

@ -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 ;; underlying faces like the `org-todo' face does, so we define our own
;; intermediary faces that extend from org-todo. ;; intermediary faces that extend from org-todo.
(with-no-warnings (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-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 (setq org-todo-keywords
'((sequence '((sequence
"TODO(t)" ; A task that needs doing & is ready to do "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))) (apply orig-fn args)))
;; Automatic indent detection in org files is meaningless ;; 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 (set-pretty-symbols! 'org-mode
:name "#+NAME:" :name "#+NAME:"

View file

@ -14,7 +14,7 @@
:mode "\\.inc\\'" :mode "\\.inc\\'"
:config :config
;; Disable HTML compatibility in php-mode. `web-mode' has superior support for ;; 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) (setq php-template-compatibility nil)
(set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM") (set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM")
@ -54,7 +54,6 @@
:config :config
(set-lookup-handlers! 'php-mode (set-lookup-handlers! 'php-mode
:definition #'phpactor-goto-definition) :definition #'phpactor-goto-definition)
(map! :localleader (map! :localleader
:map php-mode-map :map php-mode-map
:prefix ("r" . "refactor") :prefix ("r" . "refactor")

View file

@ -1,7 +1,7 @@
;;; term/vterm/config.el -*- lexical-binding: t; -*- ;;; term/vterm/config.el -*- lexical-binding: t; -*-
(use-package! vterm (use-package! vterm
:when (boundp 'module-file-suffix) :when (bound-and-true-p module-file-suffix)
:commands (vterm vterm-mode) :commands (vterm vterm-mode)
:preface (setq vterm-install t) :preface (setq vterm-install t)
:config :config

View file

@ -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 | | [[../../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 ** 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 ** Plugins
+ [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]] + [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]]

View file

@ -41,15 +41,17 @@
;; after eob. On Emacs 27 this no longer happens. ;; after eob. On Emacs 27 this no longer happens.
(unless EMACS27+ (unless EMACS27+
(defun +doom--line-range-fn () (defun +doom--line-range-fn ()
(cons (line-beginning-position) (let ((bol (line-beginning-position))
(cond ((let ((eol (line-end-position))) (eol (line-end-position))
(and (= eol (point-max)) (pmax (point-max)))
(/= eol (line-beginning-position)))) (cons bol
(1- (line-end-position))) (cond ((and (= eol pmax)
((or (eobp) (/= eol bol))
(= (line-end-position 2) (point-max))) (1- eol))
(line-end-position)) ((or (eobp)
((line-beginning-position 2))))) (= eol pmax))
eol)
((line-beginning-position 2))))))
(setq hl-line-range-function #'+doom--line-range-fn)) (setq hl-line-range-function #'+doom--line-range-fn))
;; Because fringes can't be given a buffer-local face, they can look odd, so ;; Because fringes can't be given a buffer-local face, they can look odd, so