Major refactor & optimization of how modules load their packages

Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
This commit is contained in:
Henrik Lissner 2018-05-25 00:46:11 +02:00
parent 6a140209b8
commit 09cb4f6716
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
93 changed files with 644 additions and 846 deletions

View file

@ -2,9 +2,8 @@
;;;###autoload ;;;###autoload
(defun +impatient-mode/toggle () (defun +impatient-mode/toggle ()
"TODO" "Toggle `impatient-mode' in the current buffer."
(interactive) (interactive)
(require 'simple-httpd)
(unless (process-status "httpd") (unless (process-status "httpd")
(httpd-start)) (httpd-start))
(impatient-mode) (impatient-mode)

View file

@ -1,6 +0,0 @@
;;; collab/impatient-mode/config.el -*- lexical-binding: t; -*-
;; Show off code as you write it
(def-package! impatient-mode
:commands impatient-mode)

View file

@ -24,8 +24,7 @@ MODES should be one major-mode symbol or a list of them."
;; ;;
(def-package! company (def-package! company
:commands (company-mode global-company-mode company-complete :commands (company-complete-common company-manual-begin company-grab-line)
company-complete-common company-manual-begin company-grab-line)
:init :init
(setq company-idle-delay nil (setq company-idle-delay nil
company-tooltip-limit 14 company-tooltip-limit 14
@ -48,7 +47,8 @@ MODES should be one major-mode symbol or a list of them."
(def-package! company (def-package! company
:when (featurep! +auto) :when (featurep! +auto)
:defer pre-command-hook :defer 2
:after-call pre-command-hook
:config (setq company-idle-delay 0.2)) :config (setq company-idle-delay 0.2))
@ -73,27 +73,12 @@ MODES should be one major-mode symbol or a list of them."
(def-package! company-dict (def-package! company-dict
:commands company-dict :defer t
:config :config
(defun +company|enable-project-dicts (mode &rest _) (defun +company|enable-project-dicts (mode &rest _)
"Enable per-project dictionaries." "Enable per-project dictionaries."
(if (symbol-value mode) (if (symbol-value mode)
(cl-pushnew mode company-dict-minor-mode-list :test #'eq) (add-to-list 'company-dict-minor-mode-list mode #'eq)
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list)))) (setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))
(add-hook 'doom-project-hook #'+company|enable-project-dicts)) (add-hook 'doom-project-hook #'+company|enable-project-dicts))
;;
;; Included with company.el
;;
(autoload 'company-capf "company-capf")
(autoload 'company-dabbrev "company-dabbrev")
(autoload 'company-dabbrev-code "company-dabbrev-code")
(autoload 'company-elisp "company-elisp")
(autoload 'company-etags "company-etags")
(autoload 'company-files "company-files")
(autoload 'company-gtags "company-gtags")
(autoload 'company-ispell "company-ispell")
(autoload 'company-yasnippet "company-yasnippet")

View file

@ -11,7 +11,8 @@
;; ;;
(def-package! helm-mode (def-package! helm-mode
:defer (pre-command-hook . 1) :defer 1
:after-call pre-command-hook
:config :config
(helm-mode +1) (helm-mode +1)
;; helm is too heavy for find-file-at-point ;; helm is too heavy for find-file-at-point

View file

@ -116,7 +116,7 @@ If ARG (universal argument), open selection in other-window."
"\\):?\\s-*\\(.+\\)") "\\):?\\s-*\\(.+\\)")
x) x)
(error (error
(message! (red "Error matching task in file: (%s) %s" (print! (red "Error matching task in file: (%s) %s"
(error-message-string ex) (error-message-string ex)
(car (split-string x ":")))) (car (split-string x ":"))))
nil)) nil))

View file

@ -24,7 +24,8 @@ immediately runs it on the current candidate (ending the ivy session)."
;; ;;
(def-package! ivy (def-package! ivy
:defer (pre-command-hook . 1) :defer 1
:after-call pre-command-hook
:config :config
(setq ivy-height 12 (setq ivy-height 12
ivy-do-completion-in-region nil ivy-do-completion-in-region nil
@ -184,7 +185,7 @@ immediately runs it on the current candidate (ending the ivy session)."
(def-package! wgrep (def-package! wgrep
:commands (wgrep-setup wgrep-change-to-wgrep-mode) :commands wgrep-change-to-wgrep-mode
:config (setq wgrep-auto-save-buffer t)) :config (setq wgrep-auto-save-buffer t))

View file

@ -35,6 +35,15 @@
(sp-pair "'" nil :unless unless-list) (sp-pair "'" nil :unless unless-list)
(sp-pair "\"" nil :unless unless-list)) (sp-pair "\"" nil :unless unless-list))
;; Major-mode specific fixes
(sp-local-pair 'ruby-mode "{" "}"
:pre-handlers '(:rem sp-ruby-prehandler)
:post-handlers '(:rem sp-ruby-posthandler))
;; sp's default rules for these modes are obnoxious, so disable them
(provide 'smartparens-latex)
(provide 'smartparens-elixir)
(provide 'smartparens-lua)
;; Expand {|} => { | } ;; Expand {|} => { | }
;; Expand {|} => { ;; Expand {|} => {
;; | ;; |

View file

@ -3,7 +3,8 @@
(def-package! realgud (def-package! realgud
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb) :commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
:config :config
(set! :popup "^\\*\\(?trepanjs:\\(?:g\\|zsh\\|bash\\)db\\)" '((size . 20))) (set! :popup "^\\*\\(?trepanjs:\\(?:g\\|zsh\\|bash\\)db\\)"
'((size . 20)))
;; TODO Temporary Ex commands for the debugger ;; TODO Temporary Ex commands for the debugger
;; (def-tmp-excmd! doom:def-debug-on doom:def-debug-off ;; (def-tmp-excmd! doom:def-debug-on doom:def-debug-off

View file

@ -10,12 +10,7 @@
;; ;;
(def-package! quickrun (def-package! quickrun
:commands (quickrun :defer t
quickrun-region
quickrun-with-arg
quickrun-shell
quickrun-compile-only
quickrun-replace-region)
:init :init
(unless (boundp 'display-line-numbers) (unless (boundp 'display-line-numbers)
(add-hook 'quickrun--mode-hook #'nlinum-mode)) (add-hook 'quickrun--mode-hook #'nlinum-mode))

View file

@ -1,6 +1,21 @@
;; feature/evil/autoload/evil.el -*- lexical-binding: t; -*- ;; feature/evil/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil) ;;;###if (featurep! :feature evil)
;;;###autoload
(def-setting! :evil-state (modes state)
"Set the initialize STATE of MODE using `evil-set-initial-state'."
(let ((unquoted-modes (doom-unquote modes)))
(if (listp unquoted-modes)
`(progn
,@(cl-loop for mode in unquoted-modes
collect `(evil-set-initial-state ',mode ,state)))
`(evil-set-initial-state ,modes ,state))))
;;
;; Commands
;;
;;;###autoload ;;;###autoload
(defun +evil/visual-indent () (defun +evil/visual-indent ()
"vnoremap < <gv" "vnoremap < <gv"
@ -80,6 +95,11 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
;;;###autoload ;;;###autoload
(defun +evil/window-move-down () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'down)) (defun +evil/window-move-down () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'down))
;;
;; Evil commands/operators
;;
;;;###autoload (autoload '+evil:apply-macro "feature/evil/autoload/evil" nil t) ;;;###autoload (autoload '+evil:apply-macro "feature/evil/autoload/evil" nil t)
(evil-define-operator +evil:apply-macro (beg end) (evil-define-operator +evil:apply-macro (beg end)
"Apply macro to each line." "Apply macro to each line."

View file

@ -3,27 +3,10 @@
;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module ;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module
;; strives to make Emacs a much better vim than vim was. ;; strives to make Emacs a much better vim than vim was.
(def-setting! :evil-state (modes state)
"Set the initialize STATE of MODE using `evil-set-initial-state'."
(let ((unquoted-modes (doom-unquote modes)))
(if (listp unquoted-modes)
`(progn
,@(cl-loop for mode in unquoted-modes
collect `(evil-set-initial-state ',mode ,state)))
`(evil-set-initial-state ,modes ,state))))
;;
;; evil-mode
;;
(autoload 'goto-last-change "goto-chg")
(autoload 'goto-last-change-reverse "goto-chg")
(def-package! evil-collection (def-package! evil-collection
:when (featurep! +everywhere) :when (featurep! +everywhere)
:defer pre-command-hook :defer 1
:after-call post-command-hook
:preface :preface
;; must be set before evil/evil-collcetion is loaded ;; must be set before evil/evil-collcetion is loaded
(setq evil-want-integration nil (setq evil-want-integration nil
@ -235,7 +218,7 @@
evil-escape-excluded-major-modes '(neotree-mode) evil-escape-excluded-major-modes '(neotree-mode)
evil-escape-key-sequence "jk" evil-escape-key-sequence "jk"
evil-escape-delay 0.25) evil-escape-delay 0.25)
(add-hook 'pre-command-hook 'evil-escape-pre-command-hook) (add-hook 'pre-command-hook #'evil-escape-pre-command-hook)
(map! :irvo "C-g" #'evil-escape) (map! :irvo "C-g" #'evil-escape)
:config :config
;; no `evil-escape' in minibuffer ;; no `evil-escape' in minibuffer
@ -325,7 +308,7 @@ the new algorithm is confusing, like in python or ruby."
(def-package! evil-snipe (def-package! evil-snipe
:commands (evil-snipe-mode evil-snipe-override-mode :commands (evil-snipe-mode evil-snipe-override-mode
evil-snipe-local-mode evil-snipe-override-local-mode) evil-snipe-local-mode evil-snipe-override-local-mode)
:defer pre-command-hook :after-call pre-command-hook
:init :init
(setq evil-snipe-smart-case t (setq evil-snipe-smart-case t
evil-snipe-scope 'line evil-snipe-scope 'line
@ -385,19 +368,6 @@ the new algorithm is confusing, like in python or ruby."
(push ">" evil-args-closers))) (push ">" evil-args-closers)))
(def-package! evil-indent-plus
:commands (evil-indent-plus-i-indent
evil-indent-plus-a-indent
evil-indent-plus-i-indent-up
evil-indent-plus-a-indent-up
evil-indent-plus-i-indent-up-down
evil-indent-plus-a-indent-up-down))
(def-package! evil-textobj-anyblock
:commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block))
;; ;;
;; Multiple cursors compatibility (for the plugins that use it) ;; Multiple cursors compatibility (for the plugins that use it)
;; ;;

View file

@ -0,0 +1,11 @@
;;; feature/lookup/autoload/devdocs.el -*- lexical-binding: t; -*-
;;;###if (featurep! +devdocs)
;;;###autoload
(def-setting! :devdocs (modes docset)
"Map major MODES (one major-mode symbol or a list of them) to a devdocs
DOCSET (a string).
See `devdocs-alist' for the defaults. "
`(dolist (mode ',modes)
(push (cons mode ,docset) devdocs-alist)))

View file

@ -0,0 +1,40 @@
;;; feature/lookup/autoload/docsets.el -*- lexical-binding: t; -*-
;;;###if (featurep! +docsets)
;;;###autoload
(def-setting! :docset (modes &rest docsets)
"Registers a list of DOCSETS (strings) for MODES (either one major mode
symbol or a list of them).
If MODES is a minor mode, you can use :add or :remove as the first element of
DOCSETS, to instruct it to append (or remove) those from the docsets already set
by a major-mode, if any.
Used by `+lookup/in-docsets' and `+lookup/documentation'."
(let* ((modes (doom-unquote modes))
(ivy-p (featurep! :completion ivy))
(hook-sym (intern (format "+lookup|%s-docsets--%s"
(cond ((eq ',(car docsets) :add) 'add)
((eq ',(car docsets) :remove) 'remove)
('set))
(string-join docsets "-"))))
(var-sym (if ivy-p 'counsel-dash-docsets 'helm-dash-docsets)))
`(progn
(defun ,hook-sym ()
(make-variable-buffer-local ',var-sym)
,(cond ((eq ',(car docsets) :add)
`(setq ,var-sym (append ,var-sym (list ,@(cdr docsets)))))
((eq ',(car docsets) :remove)
`(setq ,var-sym
(cl-loop with to-delete = (list ,@(cdr docsets))
for docset in ,var-sym
unless (member docset to-delete)
collect docset)))
(`(setq ,var-sym (list ,@docsets)))))
(add-hook! ,modes #',hook-sym))))
;;;###autoload
(autoload 'helm-dash-installed-docsets "helm-dash")
;;;###autoload
(autoload 'helm-dash-docset-installed-p "helm-dash")

View file

@ -122,33 +122,29 @@ ones."
;; ;;
(def-package! dumb-jump (def-package! dumb-jump
:commands (dumb-jump-go dumb-jump-quick-look :commands dumb-jump-result-follow
dumb-jump-back dumb-jump-result-follow)
:config :config
(setq dumb-jump-default-project doom-emacs-dir (setq dumb-jump-default-project doom-emacs-dir
dumb-jump-aggressive nil dumb-jump-aggressive nil
dumb-jump-selector dumb-jump-selector
(cond ((featurep! :completion ivy) 'ivy) (cond ((featurep! :completion ivy) 'ivy)
((featurep! :completion helm) 'helm) ((featurep! :completion helm) 'helm)
(t 'popup)))) ('popup))))
;; ;;
;; xref ;; xref
;; ;;
(def-package! xref ;; By default, `etags--xref-backend' is the default xref backend. No need. We'll
:commands (xref-backend-identifier-at-point xref-find-definitions xref-find-references) ;; set these up ourselves in other modules.
:config
;; By default, `etags--xref-backend' is the default xref backend. No need.
;; We'll set these up ourselves in other modules.
(setq-default xref-backend-functions '(t)) (setq-default xref-backend-functions '(t))
;; ...however, it breaks `projectile-find-tag', unless we put it back. ;; ...however, it breaks `projectile-find-tag', unless we put it back.
(defun +lookup*projectile-find-tag (orig-fn) (defun +lookup*projectile-find-tag (orig-fn)
(let ((xref-backend-functions '(etags--xref-backend t))) (let ((xref-backend-functions '(etags--xref-backend t)))
(funcall orig-fn))) (funcall orig-fn)))
(advice-add #'projectile-find-tag :around #'+lookup*projectile-find-tag)) (advice-add #'projectile-find-tag :around #'+lookup*projectile-find-tag)
(def-package! ivy-xref (def-package! ivy-xref
@ -168,41 +164,9 @@ ones."
;; ;;
(when (featurep! +docsets) (when (featurep! +docsets)
(def-setting! :docset (modes &rest docsets)
"Registers a list of DOCSETS (strings) for MODES (either one major mode
symbol or a list of them).
If MODES is a minor mode, you can use :add or :remove as the first element of
DOCSETS, to instruct it to append (or remove) those from the docsets already set
by a major-mode, if any.
Used by `+lookup/in-docsets' and `+lookup/documentation'."
(let* ((modes (doom-unquote modes))
(ivy-p (featurep! :completion ivy))
(hook-sym (intern (format "+lookup|%s-docsets--%s"
(cond ((eq ',(car docsets) :add) 'add)
((eq ',(car docsets) :remove) 'remove)
('set))
(string-join docsets "-"))))
(var-sym (if ivy-p 'counsel-dash-docsets 'helm-dash-docsets)))
`(progn
(defun ,hook-sym ()
(make-variable-buffer-local ',var-sym)
,(cond ((eq ',(car docsets) :add)
`(setq ,var-sym (append ,var-sym (list ,@(cdr docsets)))))
((eq ',(car docsets) :remove)
`(setq ,var-sym
(cl-loop with to-delete = (list ,@(cdr docsets))
for docset in ,var-sym
unless (member docset to-delete)
collect docset)))
(`(setq ,var-sym (list ,@docsets)))))
(add-hook! ,modes #',hook-sym))))
;; Both packages depend on helm-dash ;; Both packages depend on helm-dash
(def-package! helm-dash (def-package! helm-dash
:commands (helm-dash helm-dash-install-docset helm-dash-at-point :defer t
helm-dash-docset-installed-p helm-dash-installed-docsets)
:init :init
(setq helm-dash-enable-debugging doom-debug-mode (setq helm-dash-enable-debugging doom-debug-mode
helm-dash-browser-func #'eww) helm-dash-browser-func #'eww)
@ -214,7 +178,7 @@ Used by `+lookup/in-docsets' and `+lookup/documentation'."
(def-package! counsel-dash (def-package! counsel-dash
:when (featurep! :completion ivy) :when (featurep! :completion ivy)
:commands (counsel-dash counsel-dash-install-docset) :commands counsel-dash-install-docset
:config (setq counsel-dash-min-length 2))) :config (setq counsel-dash-min-length 2)))
@ -223,20 +187,11 @@ Used by `+lookup/in-docsets' and `+lookup/documentation'."
;; ;;
(when (featurep! +devdocs) (when (featurep! +devdocs)
(def-setting! :devdocs (modes docset) (after! devdocs-lookup
"Map major MODES (one major-mode symbol or a list of them) to a devdocs (unless (assoc "SCSS" devdocs-subjects)
DOCSET (a string).
See `devdocs-alist' for the defaults. "
`(dolist (mode ',modes)
(push (cons mode ,docset) devdocs-alist)))
(def-package! devdocs-lookup
:commands (devdocs-setup devdocs-lookup)
:config
(setq devdocs-subjects (setq devdocs-subjects
(append '(("SCSS" "scss") (append '(("SCSS" "scss")
("GFM" "markdown") ("GFM" "markdown")
("Typescript" "typescript")) ("Typescript" "typescript"))
devdocs-subjects)))) devdocs-subjects)))))

View file

@ -1,9 +1,16 @@
;;; feature/snippets/config.el -*- lexical-binding: t; -*- ;;; feature/snippets/config.el -*- lexical-binding: t; -*-
(defvar +snippets-dir (expand-file-name "snippets/" doom-private-dir)
"Directory where `yasnippet' will search for your private snippets.")
;;
;; Plugins
;;
(def-package! yasnippet (def-package! yasnippet
:commands (yas-minor-mode yas-minor-mode-on yas-expand yas-expand-snippet :commands (yas-minor-mode-on yas-expand yas-expand-snippet yas-lookup-snippet
yas-lookup-snippet yas-insert-snippet yas-new-snippet yas-insert-snippet yas-new-snippet yas-visit-snippet-file)
yas-visit-snippet-file snippet-mode)
:preface :preface
(defvar yas-minor-mode-map (defvar yas-minor-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
@ -23,28 +30,25 @@
(setq yas-verbosity (if doom-debug-mode 3 0) (setq yas-verbosity (if doom-debug-mode 3 0)
yas-also-auto-indent-first-line t yas-also-auto-indent-first-line t
yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions) yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)
;; Allow nested snippets yas-triggers-in-field t) ; Allow nested snippets
yas-triggers-in-field t)
(cl-pushnew (expand-file-name "snippets/" doom-private-dir) yas-snippet-dirs (add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq)
:test #'string=)
(defun +snippets|enable-project-modes (mode &rest _) (defun +snippets|enable-project-modes (mode &rest _)
"Enable snippets for project modes." "Automatically enable snippet libraries for project minor modes defined with
`def-project-mode!'."
(if (symbol-value mode) (if (symbol-value mode)
(yas-activate-extra-mode mode) (yas-activate-extra-mode mode)
(yas-deactivate-extra-mode mode))) (yas-deactivate-extra-mode mode)))
(add-hook 'doom-project-hook #'+snippets|enable-project-modes) (add-hook 'doom-project-hook #'+snippets|enable-project-modes)
;; fix an error caused by smartparens interfering with yasnippet bindings
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay)
;; Exit snippets on ESC from normal mode ;; Exit snippets on ESC from normal mode
(add-hook 'doom-escape-hook #'yas-abort-snippet)) (add-hook 'doom-escape-hook #'yas-abort-snippet)
(after! smartparens
;; fix an error caused by smartparens interfering with yasnippet bindings
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay)))
(def-package! auto-yasnippet (after! auto-yasnippet
:commands (aya-create aya-expand aya-open-line aya-persist-snippet)
:config
(setq aya-persist-snippets-dir (concat doom-local-dir "auto-snippets/"))) (setq aya-persist-snippets-dir (concat doom-local-dir "auto-snippets/")))

View file

@ -1,7 +0,0 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; feature/snippets/doctor.el
(require 'yasnippet)
(unless (ignore-errors (yas-reload-all)
(yas--get-snippet-tables))
(warn! "Couldn't find any snippets in any of these directories: %s" yas-snippet-dirs))

View file

@ -8,7 +8,7 @@ Since spellchecking can be slow in some buffers, this can be disabled with:
(setq-hook! 'LaTeX-mode-hook +spellcheck-immediately nil)") (setq-hook! 'LaTeX-mode-hook +spellcheck-immediately nil)")
(def-package! flyspell ; built-in (def-package! flyspell ; built-in
:commands flyspell-mode :defer t
:init :init
(add-hook 'flyspell-mode-hook #'+spellcheck|immediately) (add-hook 'flyspell-mode-hook #'+spellcheck|immediately)
:config :config

View file

@ -1,11 +1,11 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; feature/spellcheck/packages.el ;;; feature/spellcheck/packages.el
(package! flyspell-correct) (when (package! flyspell-correct)
(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)
(package! flyspell-correct-ivy)) (package! flyspell-correct-ivy))
((featurep! :completion helm) ((featurep! :completion helm)
(package! flyspell-correct-helm)) (package! flyspell-correct-helm))
(t (t
(package! flyspell-correct-popup))) (package! flyspell-correct-popup))))

View file

@ -1,18 +1,11 @@
;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*- ;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*-
;; Since Doom doesn't use `package-initialize', pkg-info won't get autoloaded
;; when `flycheck-version' needs it, so we need this:
(autoload 'pkg-info-version-info "pkg-info")
(def-package! flycheck (def-package! flycheck
:commands (flycheck-mode flycheck-list-errors flycheck-buffer) :commands (flycheck-list-errors flycheck-buffer)
:config :config
;; Emacs feels snappier without checks on newline ;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)) (setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
;; Popup
(add-hook 'flycheck-mode-hook #'+syntax-checker-popup-mode)
(after! evil (after! evil
(defun +syntax-checkers|flycheck-buffer () (defun +syntax-checkers|flycheck-buffer ()
"Flycheck buffer on ESC in normal mode." "Flycheck buffer on ESC in normal mode."
@ -20,21 +13,16 @@
(ignore-errors (flycheck-buffer)) (ignore-errors (flycheck-buffer))
nil)) nil))
(add-hook 'doom-escape-hook #'+syntax-checkers|flycheck-buffer t) (add-hook 'doom-escape-hook #'+syntax-checkers|flycheck-buffer t)
(add-hook 'evil-insert-state-exit-hook #'+syntax-checkers|flycheck-buffer) (add-hook 'evil-insert-state-exit-hook #'+syntax-checkers|flycheck-buffer)))
;; With the option of flychecking the buffer on escape or leaving insert
;; mode, we don't need auto-flychecking on idle-change (which can feel slow,
;; esp on computers without SSDs).
(delq 'idle-change flycheck-check-syntax-automatically)))
(def-package! flycheck-popup-tip (def-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-checker-popup-mode))
(def-package! flycheck-posframe (def-package! flycheck-posframe
:when EMACS26+ :when (and EMACS26+ (featurep! +childframe))
:when (featurep! +childframe)
:commands flycheck-posframe-show-posframe :commands flycheck-posframe-show-posframe
:config :config
(setq flycheck-posframe-warning-prefix "" (setq flycheck-posframe-warning-prefix ""

View file

@ -1,10 +1,5 @@
;;; feature/version-control/+git.el -*- lexical-binding: t; -*- ;;; feature/version-control/+git.el -*- lexical-binding: t; -*-
;; These don't need `def-package!' blocks because they've already been set up by
;; `doom-initialize'.
(autoload 'gitconfig-mode "gitconfig-mode" nil t)
(autoload 'gitignore-mode "gitignore-mode" nil t)
(when (featurep! :feature evil) (when (featurep! :feature evil)
(add-hook 'git-commit-mode-hook #'evil-insert-state)) (add-hook 'git-commit-mode-hook #'evil-insert-state))
@ -59,7 +54,7 @@
(def-package! git-timemachine (def-package! git-timemachine
:commands (git-timemachine git-timemachine-toggle) :defer t
:config :config
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of ;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
;; showing revision details in the minibuffer, show them in ;; showing revision details in the minibuffer, show them in
@ -67,10 +62,6 @@
(setq git-timemachine-show-minibuffer-details t) (setq git-timemachine-show-minibuffer-details t)
(advice-add #'git-timemachine--show-minibuffer-details :override #'+vcs*update-header-line) (advice-add #'git-timemachine--show-minibuffer-details :override #'+vcs*update-header-line)
(after! evil
;; Force evil to rehash keybindings for the current state ;; Force evil to rehash keybindings for the current state
(add-hook 'git-timemachine-mode-hook #'evil-force-normal-state)) (add-hook 'git-timemachine-mode-hook #'evil-force-normal-state)))
(def-package! git-link
:commands (git-link git-link-commit git-link-homepage))

View file

@ -27,7 +27,7 @@ new project directory.")
stored in `persp-save-dir'.") stored in `persp-save-dir'.")
(defun +workspaces-restore-last-session (&rest _) (defun +workspaces-restore-last-session (&rest _)
(add-hook 'emacs-startup-hook #'+workspace/load-session 'append)) (add-hook 'doom-post-init-hook #'+workspace/load-session 'append))
(map-put command-switch-alist '"--restore" #'+workspaces-restore-last-session) (map-put command-switch-alist '"--restore" #'+workspaces-restore-last-session)

View file

@ -2,6 +2,7 @@
;;; feature/workspaces/test/autoload-workspaces.el ;;; feature/workspaces/test/autoload-workspaces.el
(require! :feature workspaces) (require! :feature workspaces)
(doom|init-custom-hooks)
(defmacro with-workspace!! (buffer-args &rest body) (defmacro with-workspace!! (buffer-args &rest body)
(declare (indent defun)) (declare (indent defun))

View file

@ -0,0 +1,4 @@
;;; lang/assembly/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(map-put auto-mode-alist "\\.hax\\'" 'haxor-mode)

View file

@ -1,8 +0,0 @@
;;; lang/assembly/config.el -*- lexical-binding: t; -*-
(def-package! mips-mode :mode "\\.mips$")
(def-package! haxor-mode :mode "\\.hax$")
(def-package! nasm-mode :commands nasm-mode)

View file

@ -89,13 +89,6 @@ compilation dbs."
nconc (list "-I" path))) nconc (list "-I" path)))
(doom-project-root))))) (doom-project-root)))))
;;;###autoload
(defun +cc|init-rtags ()
"Start an rtags server in c-mode and c++-mode buffers."
(when (and (memq major-mode '(c-mode c++-mode))
(rtags-executable-find "rtags"))
(rtags-start-process-unless-running)))
;;;###autoload ;;;###autoload
(defun +cc|cleanup-rtags () (defun +cc|cleanup-rtags ()
"Kill rtags server(s) if there are no C/C++ buffers open." "Kill rtags server(s) if there are no C/C++ buffers open."

View file

@ -101,8 +101,8 @@ compilation database is present in the project.")
(label . 0)))) (label . 0))))
;;; Keybindings ;;; Keybindings
;; Completely disable electric keys because it interferes with smartparens and ;; Disable electric keys because it interferes with smartparens and custom
;; custom bindings. We'll do this ourselves. ;; bindings. We'll do it ourselves (mostly).
(setq c-tab-always-indent nil (setq c-tab-always-indent nil
c-electric-flag nil) c-electric-flag nil)
(dolist (key '("#" "}" "/" "*" ";" "," ":" "(" ")" "\177")) (dolist (key '("#" "}" "/" "*" ";" "," ":" "(" ")" "\177"))
@ -129,6 +129,7 @@ compilation database is present in the project.")
(def-package! irony (def-package! irony
:when (featurep! +irony)
:commands (irony-install-server irony-mode) :commands (irony-install-server irony-mode)
:preface :preface
(setq irony-server-install-prefix (concat doom-etc-dir "irony-server/")) (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
@ -172,23 +173,13 @@ compilation database is present in the project.")
;; ;;
(def-package! cmake-mode (def-package! cmake-mode
:mode "/CMakeLists\\.txt$" :defer t
:mode "\\.cmake\\$"
:config :config
(set! :company-backend 'cmake-mode '(company-cmake company-yasnippet))) (set! :company-backend 'cmake-mode '(company-cmake company-yasnippet)))
(def-package! cuda-mode :mode "\\.cuh?$") (def-package! opencl-mode :mode "\\.cl\\'")
(def-package! opencl-mode :mode "\\.cl$") (def-package! demangle-mode :hook llvm-mode)
(def-package! demangle-mode
:hook llvm-mode)
(def-package! glsl-mode
:mode "\\.glsl$"
:mode "\\.vert$"
:mode "\\.frag$"
:mode "\\.geom$")
;; ;;
@ -213,7 +204,12 @@ compilation database is present in the project.")
(def-package! rtags (def-package! rtags
:commands rtags-executable-find :commands rtags-executable-find
:init :init
(add-hook! (c-mode c++-mode) #'+cc|init-rtags) (defun +cc|init-rtags ()
"Start an rtags server in c-mode and c++-mode buffers."
(when (and (memq major-mode '(c-mode c++-mode))
(rtags-executable-find "rtags"))
(rtags-start-process-unless-running)))
(add-hook 'c-mode-common-hook #'+cc|init-rtags)
:config :config
(setq rtags-autostart-diagnostics t (setq rtags-autostart-diagnostics t
rtags-use-bookmarks nil rtags-use-bookmarks nil

View file

@ -7,9 +7,9 @@
(warn! "Couldn't find the rtag client and/or server programs %s. Disabling rtags support" bins))) (warn! "Couldn't find the rtag client and/or server programs %s. Disabling rtags support" bins)))
;; irony server ;; irony server
(require 'irony) (when (require 'irony nil t)
(unless (file-directory-p irony-server-install-prefix) (unless (file-directory-p irony-server-install-prefix)
(warn! "Irony server isn't installed. Run M-x irony-install-server")) (warn! "Irony server isn't installed. Run M-x irony-install-server")))
(when (featurep! :completion company) (when (featurep! :completion company)
;; glslangValidator ;; glslangValidator

View file

@ -1,13 +1,7 @@
;;; lang/clojure/config.el -*- lexical-binding: t; -*- ;;; lang/clojure/config.el -*- lexical-binding: t; -*-
(def-package! clojure-mode ;; `clojure-mode'
:mode "\\.clj$" (add-hook 'clojure-mode #'rainbow-delimiters-mode)
:mode "\\.edn$"
:mode "\\(?:build\\|profile\\)\\.boot$"
:mode ("\\.cljs$" . clojurescript-mode)
:mode ("\\.cljc$" . clojurec-mode)
:config
(add-hook 'clojure-mode #'rainbow-delimiters-mode))
(def-package! clj-refactor (def-package! clj-refactor

View file

@ -1,8 +1,7 @@
;;; lang/crystal/config.el -*- lexical-binding: t; -*- ;;; lang/crystal/config.el -*- lexical-binding: t; -*-
(def-package! crystal-mode (def-package! crystal-mode
:mode "\\.cr$" :defer t
:interpreter "crystal"
:config :config
(set! :lookup 'crystal-mode (set! :lookup 'crystal-mode
:definition #'crystal-def-jump :definition #'crystal-def-jump
@ -19,5 +18,4 @@
:config (add-hook 'crystal-mode-hook #'flycheck-mode)) :config (add-hook 'crystal-mode-hook #'flycheck-mode))
(def-package! inf-crystal (def-package! inf-crystal :commands crystal-switch-to-inf)
:commands (inf-crystal crystal-switch-to-inf))

View file

@ -1,17 +1,16 @@
;;; lang/csharp/config.el -*- lexical-binding: t; -*- ;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(def-package! csharp-mode :mode "\\.cs$") (add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode)) ; unity shaders
(def-package! shader-mode :mode "\\.shader$") ; unity shaders
(def-package! omnisharp (def-package! omnisharp
:after csharp-mode :hook (csharp-mode . omnisharp-mode)
:commands omnisharp-install-server
:preface :preface
(setq omnisharp-auto-complete-want-documentation nil (setq omnisharp-auto-complete-want-documentation nil
omnisharp-cache-directory (concat doom-cache-dir "omnisharp")) omnisharp-cache-directory (concat doom-cache-dir "omnisharp"))
:config :config
(add-hook! csharp-mode #'(flycheck-mode omnisharp-mode)) (add-hook 'csharp-mode-hook #'flycheck-mode)
(defun +csharp|cleanup-omnisharp-server () (defun +csharp|cleanup-omnisharp-server ()
"Clean up the omnisharp server once you kill the last csharp-mode buffer." "Clean up the omnisharp server once you kill the last csharp-mode buffer."

View file

@ -1,47 +1,30 @@
;;; lang/data/config.el -*- lexical-binding: t; -*- ;;; lang/data/config.el -*- lexical-binding: t; -*-
(push '("/sxhkdrc" . conf-mode) auto-mode-alist) ;; Built in plugins
(dolist (spec '(("/sxhkdrc\\'" . conf-mode)
("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode)
("\\.plist\\'" . nxml-mode)))
(map-put auto-mode-alist (car spec) (cdr spec)))
(set! :company-backend 'nxml-mode '(company-nxml company-yasnippet))
(def-package! dockerfile-mode ;;
:mode "/Dockerfile$") ;; Third-party plugins
;;
(def-package! graphql-mode (def-package! graphql-mode
:mode "\\.g\\(?:raph\\)?ql$") :mode "\\.gql\\'")
(def-package! hexl ; For ROM hacking or debugging
:mode ("\\.hex$" . hexl-mode)
:mode ("\\.nes$" . hexl-mode))
(def-package! json-mode (def-package! json-mode
:mode "\\.js\\(?:on\\|[hl]int\\(rc\\)?\\)$" :mode "\\.js\\(?:on\\|[hl]int\\(rc\\)?\\)\\'"
:config :config
(when (featurep! :feature syntax-checker) (when (featurep! :feature syntax-checker)
(add-hook 'json-mode-hook #'flycheck-mode)) (add-hook 'json-mode-hook #'flycheck-mode))
(set! :electric 'json-mode :chars '(?\n ?: ?{ ?}))) (set! :electric 'json-mode :chars '(?\n ?: ?{ ?})))
(def-package! nxml-mode
:mode "\\.plist$"
:config
(set! :company-backend 'nxml-mode '(company-nxml company-yasnippet)))
(def-package! toml-mode
:mode "\\.toml$")
(def-package! vimrc-mode (def-package! vimrc-mode
:mode "/\\.?g?vimrc$" :mode "\\.?vimperatorrc\\'")
:mode "\\.vimp?$"
:mode "\\.?vimperatorrc$")
(def-package! yaml-mode
:mode "\\.ya?ml$")
;; ;;

View file

@ -1,13 +1,10 @@
;;; lang/elixir/config.el -*- lexical-binding: t; -*- ;;; lang/elixir/config.el -*- lexical-binding: t; -*-
(def-package! elixir-mode (def-package! elixir-mode
:mode "\\.exs?\\'" :defer t
:mode "\\.elixir2\\'"
:init
;; sp's default elixir rules are obnoxious, so disable them
(provide 'smartparens-elixir)
:config :config
;; ...and only complete the basics ;; ...and only complete the basics
(after! smartparens
(sp-with-modes 'elixir-mode (sp-with-modes 'elixir-mode
(sp-local-pair "do" "end" (sp-local-pair "do" "end"
:when '(("RET" "<evil-ret>")) :when '(("RET" "<evil-ret>"))
@ -15,7 +12,7 @@
:skip-match 'sp-elixir-skip-def-p :skip-match 'sp-elixir-skip-def-p
:post-handlers '("||\n[i]")) :post-handlers '("||\n[i]"))
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p)) (sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
(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)))))
(def-package! alchemist (def-package! alchemist
@ -30,13 +27,13 @@
(def-package! alchemist-company (def-package! alchemist-company
:when (featurep! :completion company) :when (featurep! :completion company)
:after elixir-mode :commands alchemist-company
:init
(set! :company-backend 'elixir-mode '(alchemist-company company-yasnippet))
:config :config
;; 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)))))
(remove-hook 'alchemist-mode-hook fn) (remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn)) (remove-hook 'alchemist-iex-mode-hook fn)))
(set! :company-backend 'elixir-mode '(alchemist-company company-yasnippet)))

View file

@ -1,13 +1,12 @@
;;; lang/elm/config.el -*- lexical-binding: t; -*- ;;; lang/elm/config.el -*- lexical-binding: t; -*-
(def-package! elm-mode ;; `elm-mode'
:mode "\\.elm$" (setq elm-format-on-save t)
:config
(load "elm-mode-autoloads" nil t)
(add-hook! 'elm-mode-hook #'(flycheck-mode rainbow-delimiters-mode)) (add-hook! 'elm-mode-hook #'(flycheck-mode rainbow-delimiters-mode))
(set! :company-backend 'elm-mode '(company-elm))
(set! :company-backend 'elm-mode 'company-elm)
(set! :repl 'elm-mode #'run-elm-interactive) (set! :repl 'elm-mode #'run-elm-interactive)
(setq elm-format-on-save t))
(def-package! flycheck-elm (def-package! flycheck-elm

View file

@ -1,5 +1,13 @@
;;; lang/emacs-lisp/autoload.el -*- lexical-binding: t; -*- ;;; lang/emacs-lisp/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(autoload 'overseer-test "overseer" nil t)
;;
;; Library
;;
;;;###autoload ;;;###autoload
(defun +emacs-lisp/repl () (defun +emacs-lisp/repl ()
"Open the Emacs Lisp REPL (`ielm')." "Open the Emacs Lisp REPL (`ielm')."

View file

@ -67,27 +67,17 @@
;; Plugins ;; Plugins
;; ;;
(def-package! auto-compile ;; `auto-compile'
:commands auto-compile-on-save-mode
:config
(setq auto-compile-display-buffer nil (setq auto-compile-display-buffer nil
auto-compile-use-mode-line nil)) auto-compile-use-mode-line nil)
(def-package! highlight-quoted ;; `slime'
:commands highlight-quoted-mode)
(def-package! slime
:defer t
:config
(setq inferior-lisp-program "clisp") (setq inferior-lisp-program "clisp")
(require 'slime-fuzzy)) (after! slime (require 'slime-fuzzy))
(def-package! macrostep (after! macrostep
:commands macrostep-expand
:config
(map! :map macrostep-keymap (map! :map macrostep-keymap
:n "RET" #'macrostep-expand :n "RET" #'macrostep-expand
:n "e" #'macrostep-expand :n "e" #'macrostep-expand
@ -104,6 +94,7 @@
:n "q" #'macrostep-collapse-all :n "q" #'macrostep-collapse-all
:n "C" #'macrostep-collapse-all) :n "C" #'macrostep-collapse-all)
;; `evil-normalize-keymaps' seems to be required for macrostep or it won't ;; `evil-normalize-keymaps' seems to be required for macrostep or it won't
;; apply for the very first invocation ;; apply for the very first invocation
(add-hook 'macrostep-mode-hook #'evil-normalize-keymaps)) (add-hook 'macrostep-mode-hook #'evil-normalize-keymaps))
@ -111,18 +102,14 @@
(def-package! flycheck-cask (def-package! flycheck-cask
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:commands flycheck-cask-setup :defer t
:init :init
(add-hook! 'emacs-lisp-mode-hook (add-hook! 'emacs-lisp-mode-hook
(add-hook 'flycheck-mode-hook #'flycheck-cask-setup nil t))) (add-hook 'flycheck-mode-hook #'flycheck-cask-setup nil t)))
(def-package! overseer
:commands overseer-test)
;;
;; ;;
;; Project modes
;; ;;
(def-project-mode! +emacs-lisp-ert-mode (def-project-mode! +emacs-lisp-ert-mode

View file

@ -1,20 +1,19 @@
;;; private/erlang/config.el -*- lexical-binding: t; -*- ;;; private/erlang/config.el -*- lexical-binding: t; -*-
(def-package! erlang (dolist (regexp '("\\.erlang$"
;; customizations
:mode "\\.erlang$"
;; rebar files ;; rebar files
:mode "/rebar\\.config\\(?:\\.script\\)?$" "/rebar\\.config\\(?:\\.script\\)?$"
;; erlang configs ;; erlang configs
:mode "/\\(?:app\\|sys\\)\\.config$") "/\\(?:app\\|sys\\)\\.config$"))
(map-put auto-mode-alist regexp 'erlang-mode))
(def-package! flycheck-rebar3 (def-package! flycheck-rebar3
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after erlang :after flycheck
:config :config (flycheck-rebar3-setup))
(flycheck-rebar3-setup))
;; Completion via Ivy
(def-package! ivy-erlang-complete (def-package! ivy-erlang-complete
:when (featurep! :completion ivy) :when (featurep! :completion ivy)
:hook (erlang-mode . ivy-erlang-complete-init) :hook (erlang-mode . ivy-erlang-complete-init)
@ -23,7 +22,6 @@
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse nil t))) (add-hook 'after-save-hook #'ivy-erlang-complete-reparse nil t)))
;; Completion via Company
(def-package! company-erlang (def-package! company-erlang
:when (featurep! :completion company) :when (featurep! :completion company)
:hook (erlang-mode . company-erlang-init)) :hook (erlang-mode . company-erlang-init))

View file

@ -79,6 +79,6 @@
:n "cn" #'ess-noweb-next-chunk)))) :n "cn" #'ess-noweb-next-chunk))))
(def-package! ess-smart-equals ;; `ess-smart-equals-mode'
:hook ((ess-mode . ess-smart-equals-mode) (add-hook! (ess-mode inferior-ess)
(inferior-ess-mode . ess-smart-equals-mode))) #'ess-smart-equals-mode)

View file

@ -4,10 +4,7 @@
;; Plugins ;; Plugins
;; ;;
(def-package! go-mode (after! go-mode
:mode "\\.go$"
:interpreter "go"
:config
(set! :env "GOPATH" "GOROOT") (set! :env "GOPATH" "GOROOT")
(set! :repl 'go-mode #'gorepl-run) (set! :repl 'go-mode #'gorepl-run)
(set! :lookup 'go-mode (set! :lookup 'go-mode
@ -15,11 +12,12 @@
:references #'go-guru-referrers :references #'go-guru-referrers
:documentation #'godoc-at-point) :documentation #'godoc-at-point)
(when (executable-find "goimports") (when-let* ((goimports (executable-find "goimports")))
(setq gofmt-command "goimports")) (setq gofmt-command goimports))
(setq gofmt-show-errors nil) ; Leave it to flycheck (setq gofmt-show-errors nil) ; Leave it to flycheck
(add-hook 'go-mode-hook #'flycheck-mode)
(add-hook! 'go-mode-hook #'(flycheck-mode go-eldoc-setup))
(add-hook! go-mode (add-hook! go-mode
(add-hook 'before-save-hook #'gofmt-before-save nil t)) (add-hook 'before-save-hook #'gofmt-before-save nil t))
@ -70,25 +68,13 @@
:v "r" #'go-play-region)) :v "r" #'go-play-region))
(def-package! go-eldoc
:hook (go-mode . go-eldoc-setup))
(def-package! go-guru
:commands (go-guru-describe go-guru-freevars go-guru-implements go-guru-peers
go-guru-referrers go-guru-definition go-guru-pointsto
go-guru-callstack go-guru-whicherrs go-guru-callers go-guru-callees
go-guru-expand-region))
(def-package! gorepl-mode (def-package! gorepl-mode
:commands (gorepl-run gorepl-run-load-current-file)) :commands gorepl-run-load-current-file)
(def-package! company-go (def-package! company-go
:when (featurep! :completion company) :when (featurep! :completion company)
:init (setq command-go-gocode-command "gocode")
:after go-mode :after go-mode
:config :config
(setq company-go-show-annotation t) (set! :company-backend 'go-mode 'company-go)
(set! :company-backend 'go-mode '(company-go))) (setq company-go-show-annotation t))

View file

@ -8,18 +8,7 @@
;; Common plugins ;; Common plugins
;; ;;
(def-package! haskell-mode (after! haskell-mode
:mode "\\.hs$"
:mode ("\\.ghci$" . ghci-script-mode)
:mode ("\\.cabal$" . haskell-cabal-mode)
:interpreter (("runghc" . haskell-mode)
("runhaskell" . haskell-mode))
:config
(load "haskell-mode-autoloads" nil t)
(set! :repl 'haskell-mode #'switch-to-haskell) (set! :repl 'haskell-mode #'switch-to-haskell)
(push ".hi" completion-ignored-extensions) (add-to-list 'completion-ignored-extensions ".hi"))
(autoload 'switch-to-haskell "inf-haskell" nil t)
(after! inf-haskell
(map! :map inferior-haskell-mode-map "ESC ESC" #'+popup/close)))

View file

@ -1,8 +1,8 @@
;;; lang/hy/config.el -*- lexical-binding: t; -*- ;;; lang/hy/config.el -*- lexical-binding: t; -*-
(def-package! hy-mode (def-package! hy-mode
:mode "\\.hy$" :mode "\\.hy\\'"
:interpreter "hy" :interpreter "hy"
:config :config
(set! :repl 'hy-mode #'hy-shell-start-or-switch-to-shell) (set! :repl 'hy-mode #'hy-shell-start-or-switch-to-shell)
(set! :company-backend 'hy-mode '(company-hy))) (set! :company-backend 'hy-mode 'company-hy))

View file

@ -3,8 +3,8 @@
(add-hook 'java-mode-hook #'rainbow-delimiters-mode) (add-hook 'java-mode-hook #'rainbow-delimiters-mode)
(cond ((featurep! +meghanada) (load! +meghanada)) (cond ((featurep! +meghanada) (load! +meghanada))
;; TODO lang/java +eclim ;; TODO lang/java +lsp (lsp-java?)
;; ((featurep! +eclim) (load! +eclim)) ;; ((featurep! +lsp) (load! +lsp))
) )

View file

@ -22,6 +22,7 @@
(add-hook! 'js2-mode-hook #'(flycheck-mode rainbow-delimiters-mode)) (add-hook! 'js2-mode-hook #'(flycheck-mode rainbow-delimiters-mode))
(set! :electric 'js2-mode :chars '(?\} ?\) ?. ?:)) (set! :electric 'js2-mode :chars '(?\} ?\) ?. ?:))
(set! :repl 'js2-mode #'+javascript/repl)
;; Conform switch-case indentation to js2 normal indent ;; Conform switch-case indentation to js2 normal indent
(defvaralias 'js-switch-indent-offset 'js2-basic-offset) (defvaralias 'js-switch-indent-offset 'js2-basic-offset)
@ -34,16 +35,7 @@
:n "S" #'+javascript/skewer-this-buffer)) :n "S" #'+javascript/skewer-this-buffer))
(def-package! typescript-mode
:commands typescript-mode
:config
(add-hook! 'typescript-mode-hook #'(flycheck-mode rainbow-delimiters-mode))
(set! :electric 'typescript-mode
:chars '(?\} ?\)) :words '("||" "&&")))
(def-package! rjsx-mode (def-package! rjsx-mode
:commands rjsx-mode
:mode "components/.+\\.js$" :mode "components/.+\\.js$"
:init :init
(defun +javascript-jsx-file-p () (defun +javascript-jsx-file-p ()
@ -54,8 +46,7 @@
magic-mode-regexp-match-limit t) magic-mode-regexp-match-limit t)
(progn (goto-char (match-beginning 1)) (progn (goto-char (match-beginning 1))
(not (sp-point-in-string-or-comment))))) (not (sp-point-in-string-or-comment)))))
(map-put magic-mode-alist #'+javascript-jsx-file-p 'rjsx-mode)
(push '(+javascript-jsx-file-p . rjsx-mode) magic-mode-alist)
:config :config
(set! :electric 'rjsx-mode :chars '(?\} ?\) ?. ?>)) (set! :electric 'rjsx-mode :chars '(?\} ?\) ?. ?>))
(add-hook! 'rjsx-mode-hook (add-hook! 'rjsx-mode-hook
@ -67,14 +58,19 @@
;; However, the parser doesn't run immediately, so a fast typist can outrun ;; However, the parser doesn't run immediately, so a fast typist can outrun
;; it, causing issues, so force it to parse. ;; it, causing issues, so force it to parse.
(defun +javascript|reparse (n) (defun +javascript|reparse (n)
;; if n != 1, then rjsx-maybe-reparse will be run elsewhere ;; if n != 1, rjsx-electric-gt calls rjsx-maybe-reparse itself
(if (= n 1) (rjsx-maybe-reparse))) (if (= n 1) (rjsx-maybe-reparse)))
(advice-add #'rjsx-electric-gt :before #'+javascript|reparse)) (advice-add #'rjsx-electric-gt :before #'+javascript|reparse))
(def-package! coffee-mode (after! typescript-mode
:defer t ; file extensions registered by autoloads file (add-hook! 'typescript-mode-hook #'(flycheck-mode rainbow-delimiters-mode))
:init (setq coffee-indent-like-python-mode t)) (set! :electric 'typescript-mode
:chars '(?\} ?\)) :words '("||" "&&")))
;; `coffee-mode'
(setq coffee-indent-like-python-mode t)
;; ;;
@ -86,6 +82,7 @@
:hook (typescript-mode . tide-setup) :hook (typescript-mode . tide-setup)
:init :init
(defun +javascript|init-tide-in-web-mode () (defun +javascript|init-tide-in-web-mode ()
"Enable `tide-mode' if in a *.tsx file."
(when (string= (file-name-extension (or buffer-file-name "")) "tsx") (when (string= (file-name-extension (or buffer-file-name "")) "tsx")
(tide-setup))) (tide-setup)))
(add-hook 'web-mode-hook #'+javascript|init-tide-in-web-mode) (add-hook 'web-mode-hook #'+javascript|init-tide-in-web-mode)
@ -156,12 +153,6 @@
:init (set! :lookup 'js2-mode :xref-backend #'xref-js2-xref-backend)) :init (set! :lookup 'js2-mode :xref-backend #'xref-js2-xref-backend))
(def-package! nodejs-repl
:commands nodejs-repl
:init
(set! :repl 'js2-mode #'+javascript/repl))
(def-package! js2-refactor (def-package! js2-refactor
:commands :commands
(js2r-extract-function js2r-extract-method js2r-introduce-parameter (js2r-extract-function js2r-extract-method js2r-introduce-parameter
@ -174,51 +165,38 @@
js2r-debug-this js2r-forward-slurp js2r-forward-barf)) js2r-debug-this js2r-forward-slurp js2r-forward-barf))
(def-package! web-beautify
:commands web-beautify-js
:init
(map! :map* (json-mode js2-mode-map) :n "gQ" #'web-beautify-js))
(def-package! eslintd-fix (def-package! eslintd-fix
:commands (eslintd-fix-mode eslintd-fix) :commands eslintd-fix
:config :config
(defun +javascript|set-flycheck-executable-to-eslint () (defun +javascript|set-flycheck-executable-to-eslint ()
(setq flycheck-javascript-eslint-executable eslintd-fix-executable)) (setq flycheck-javascript-eslint-executable eslintd-fix-executable))
(add-hook 'eslintd-fix-mode-hook #'+javascript|set-flycheck-executable-to-eslint)) (add-hook 'eslintd-fix-mode-hook #'+javascript|set-flycheck-executable-to-eslint))
(def-package! skewer-mode ;; `skewer-mode'
:commands (skewer-mode run-skewer) (map! (:after skewer-mode
:config :map skewer-mode-map
(map! :map skewer-mode-map
:localleader :localleader
:n "sE" #'skewer-eval-last-expression :n "sE" #'skewer-eval-last-expression
:n "se" #'skewer-eval-defun :n "se" #'skewer-eval-defun
:n "sf" #'skewer-load-buffer)) :n "sf" #'skewer-load-buffer)
(:after skewer-css
(def-package! skewer-css ; in skewer-mode :map skewer-css-mode-map
:commands skewer-css-mode
:config
(map! :map skewer-css-mode-map
:localleader :localleader
:n "se" #'skewer-css-eval-current-declaration :n "se" #'skewer-css-eval-current-declaration
:n "sr" #'skewer-css-eval-current-rule :n "sr" #'skewer-css-eval-current-rule
:n "sb" #'skewer-css-eval-buffer :n "sb" #'skewer-css-eval-buffer
:n "sc" #'skewer-css-clear-all)) :n "sc" #'skewer-css-clear-all)
(:after skewer-html
(def-package! skewer-html ; in skewer-mode :map skewer-html-mode-map
:commands skewer-html-mode
:config
(map! :map skewer-html-mode-map
:localleader :localleader
:n "se" #'skewer-html-eval-tag)) :n "se" #'skewer-html-eval-tag))
(def-package! skewer-repl ;; `web-beautify'
:commands skewer-repl) (map! :map* (json-mode-map js2-mode-map) :n "gQ" #'web-beautify-js)
;; ;;
@ -226,7 +204,7 @@
;; ;;
(def-project-mode! +javascript-screeps-mode (def-project-mode! +javascript-screeps-mode
:match "/screeps\\(-ai\\)?/.+$" :match "/screeps\\(?:-ai\\)?/.+$"
:modes (+javascript-npm-mode) :modes (+javascript-npm-mode)
:add-hooks (+javascript|init-screeps-mode) :add-hooks (+javascript|init-screeps-mode)
:on-load (load! +screeps)) :on-load (load! +screeps))

View file

@ -1,7 +1,6 @@
;;; lang/julia/config.el -*- lexical-binding: t; -*- ;;; lang/julia/config.el -*- lexical-binding: t; -*-
(use-package julia-mode (use-package julia-mode
:mode "\\.jl$"
:interpreter "julia" :interpreter "julia"
:config :config
(set! :repl 'julia-mode #'+julia/repl) (set! :repl 'julia-mode #'+julia/repl)

View file

@ -18,9 +18,6 @@
"Sets the directory where AUCTeX will search for PDFs associated to BibTeX references." "Sets the directory where AUCTeX will search for PDFs associated to BibTeX references."
`(setq +latex-bibtex-dir ,dir)) `(setq +latex-bibtex-dir ,dir))
;; sp's default latex rules are obnoxious, so disable them
(provide 'smartparens-latex)
;; ;;
;; Plugins ;; Plugins

View file

@ -1,8 +1,7 @@
;;; lang/ledger/config.el -*- lexical-binding: t; -*- ;;; lang/ledger/config.el -*- lexical-binding: t; -*-
(def-package! ledger-mode ;; `ledger-mode'
:mode "\\.ledger$" (setq ledger-clear-whole-transactions 1)
:config (setq ledger-clear-whole-transactions 1))
(def-package! evil-ledger (def-package! evil-ledger
@ -12,4 +11,5 @@
(def-package! flycheck-ledger (def-package! flycheck-ledger
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:init (add-hook 'ledger-mode-hook #'flycheck-mode)) :after ledger-mode
:config (add-hook 'ledger-mode-hook #'flycheck-mode))

View file

@ -1,18 +1,12 @@
;;; lang/lua/config.el -*- lexical-binding: t; -*- ;;; lang/lua/config.el -*- lexical-binding: t; -*-
(def-package! lua-mode (after! lua-mode
:mode "\\.lua$"
:interpreter "lua"
:init
;; sp's default lua rules are obnoxious, so disable them. Use snippets
;; instead!
(provide 'smartparens-lua)
:config
(add-hook 'lua-mode-hook #'flycheck-mode) (add-hook 'lua-mode-hook #'flycheck-mode)
(set! :lookup 'lua-mode :documentation 'lua-search-documentation) (set! :lookup 'lua-mode :documentation 'lua-search-documentation)
(set! :electric 'lua-mode :words '("else" "end")) (set! :electric 'lua-mode :words '("else" "end"))
(set! :repl 'lua-mode #'+lua/repl) (set! :repl 'lua-mode #'+lua/repl)
(set! :company-backend 'lua-mode '(company-lua company-yasnippet))
(def-menu! +lua/build-menu (def-menu! +lua/build-menu
"Build/compilation commands for `lua-mode' buffers." "Build/compilation commands for `lua-mode' buffers."
@ -24,15 +18,8 @@
:n "b" #'+lua/build-menu)) :n "b" #'+lua/build-menu))
(def-package! company-lua (after! moonscript
:after (:all company lua-mode) (defvaralias 'moonscript-indent-offset 'tab-width))
:config
(set! :company-backend 'lua-mode '(company-lua company-yasnippet)))
(def-package! moonscript
:mode ("\\.moon$" . moonscript-mode)
:config (defvaralias 'moonscript-indent-offset 'tab-width))
;; ;;

View file

@ -1,9 +1,7 @@
;;; lang/markdown/config.el -*- lexical-binding: t; -*- ;;; lang/markdown/config.el -*- lexical-binding: t; -*-
(def-package! markdown-mode (def-package! markdown-mode
:mode "/README$" :mode ("/README\\(?:\\.\\(?:markdown\\|md\\)\\)?\\'" . gfm-mode)
:mode ("/README\\.md$" . gfm-mode)
:mode "\\.m\\(?:d\\|arkdown\\)$"
:init :init
(setq markdown-enable-wiki-links t (setq markdown-enable-wiki-links t
markdown-enable-math t markdown-enable-math t

View file

@ -1,32 +1,20 @@
;;; lang/nim/config.el -*- lexical-binding: t; -*- ;;; lang/nim/config.el -*- lexical-binding: t; -*-
(def-package! nim-mode (after! nim-mode
:mode "\\.nim\\'"
:mode ("\\.nim\\(ble\\|s\\)\\'" . nimscript-mode)
:config
(load "nim-mode-autoloads" nil t)
;; NOTE nim-mode autoloads sets up xref
(defun +nim|init-nimsuggest-mode () (defun +nim|init-nimsuggest-mode ()
"Conditionally load `nimsuggest-mode', instead of clumsily erroring out if "Conditionally load `nimsuggest-mode', instead of clumsily erroring out if
nimsuggest isn't installed." nimsuggest isn't installed."
(when (executable-find "nimsuggest") (when (file-executable-p nimsuggest-path)
(nimsuggest-mode))) (nimsuggest-mode)))
(add-hook 'nim-mode-hook #'+nim|init-nimsuggest-mode) (add-hook 'nim-mode-hook #'+nim|init-nimsuggest-mode)
(map! :map nim-mode-map (map! :map nim-mode-map
:localleader :localleader
:n "b" #'+nim/build-menu) :n "b" #'nim-compile))
(def-menu! +nim/build-menu
"Building commands for `nim-mode' buffers."
'(("Build & run" :exec nim-compile))
:prompt "Build"))
(def-package! flycheck-nim (def-package! flycheck-nim
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after nim-mode :after nim-mode
:config :config (add-hook 'nimsuggest-mode-hook #'flycheck-mode))
(add-hook 'nimsuggest-mode-hook #'flycheck-mode))

View file

@ -1,4 +0,0 @@
;;; lang/nix/config.el -*- lexical-binding: t; -*-
(def-package! nix-mode
:mode "\\.nix$")

View file

@ -1,9 +1,13 @@
;;; lang/ocaml/config.el -*- lexical-binding: t; -*- ;;; lang/ocaml/config.el -*- lexical-binding: t; -*-
(def-package! tuareg (def-package! tuareg
:mode ("\\.ml[4ilpy]?$" . tuareg-mode)) :mode ("\\.ml[4ilpy]?\\'" . tuareg-mode))
(def-package! merlin (def-package! merlin
:after tuareg :after tuareg
:hook (tuareg-mode . merlin-mode)) :hook (tuareg-mode . merlin-mode)
:config
(set! :company-backend 'tuareg-mode 'merlin-compand-backend)
(after! company
(remove-hook 'company-backends 'merlin-compand-backend)))

View file

@ -16,12 +16,8 @@
;; Plugins ;; Plugins
;; ;;
(def-package! toc-org ;; `toc-org'
:commands toc-org-enable (setq toc-org-hrefify-default "org")
:config (setq toc-org-hrefify-default "org"))
(def-package! org-bullets
:commands org-bullets-mode)
(def-package! evil-org (def-package! evil-org
:when (featurep! :feature evil) :when (featurep! :feature evil)

View file

@ -1,7 +1,7 @@
;;; lang/plantuml/config.el -*- lexical-binding: t; -*- ;;; lang/plantuml/config.el -*- lexical-binding: t; -*-
(def-package! plantuml-mode (def-package! plantuml-mode
:mode "\\.p\\(?:lant\\)?uml$" :defer t
:init :init
(setq plantuml-jar-path (concat doom-etc-dir "plantuml.jar") (setq plantuml-jar-path (concat doom-etc-dir "plantuml.jar")
org-plantuml-jar-path plantuml-jar-path) org-plantuml-jar-path plantuml-jar-path)

View file

@ -1,16 +1,18 @@
;;; lang/purescript/config.el -*- lexical-binding: t; -*- ;;; lang/purescript/config.el -*- lexical-binding: t; -*-
(def-package! purescript-mode (after! purescript-mode
:mode "\\.purs$"
:config
(add-hook! 'purescript-mode-hook (add-hook! 'purescript-mode-hook
#'(flycheck-mode purescript-indentation-mode rainbow-delimiters-mode))) #'(flycheck-mode
purescript-indentation-mode
rainbow-delimiters-mode)))
;; (def-package! flycheck-purescript ;; (def-package! flycheck-purescript
;; :after purescript-mode ;; :after purescript-mode
;; :config ;; :config
;; (add-hook 'flycheck-mode-hook #'flycheck-purescript-setup)) ;; (add-hook 'flycheck-mode-hook #'flycheck-purescript-setup))
(def-package! psc-ide (def-package! psc-ide
:hook (purescript-mode . psc-ide-mode)) :hook (purescript-mode . psc-ide-mode))

View file

@ -16,7 +16,7 @@ is loaded.")
;; ;;
(def-package! python (def-package! python
:commands python-mode :defer t
:init :init
(setq python-environment-directory doom-cache-dir (setq python-environment-directory doom-cache-dir
python-indent-guess-indent-offset-verbose nil python-indent-guess-indent-offset-verbose nil
@ -73,7 +73,6 @@ environment variables."
(def-package! anaconda-mode (def-package! anaconda-mode
:after python
:hook python-mode :hook python-mode
:init :init
(setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/") (setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")

View file

@ -1,8 +1,7 @@
;;; lang/rest/config.el -*- lexical-binding: t; -*- ;;; lang/rest/config.el -*- lexical-binding: t; -*-
(def-package! restclient (def-package! restclient
:commands restclient-mode :mode ("\\.http\\'" . restclient-mode)
:mode ("\\.http$" . restclient-mode)
:config :config
(set! :popup "^\\*HTTP Response" '((size . 0.4)) '((quit . other))) (set! :popup "^\\*HTTP Response" '((size . 0.4)) '((quit . other)))
(map! :mode restclient-mode (map! :mode restclient-mode
@ -16,4 +15,4 @@
(def-package! company-restclient (def-package! company-restclient
:when (featurep! :completion company) :when (featurep! :completion company)
:after restclient :after restclient
:config (set! :company-backend 'restclient-mode '(company-restclient))) :config (set! :company-backend 'restclient-mode 'company-restclient))

View file

@ -12,15 +12,12 @@
;; ;;
(def-package! ruby-mode (def-package! ruby-mode
:mode "\\.rb$" :mode "\\.\\(?:pry\\|irb\\)rc\\'"
:mode "\\.rake$"
:mode "\\.gemspec$"
:mode "\\.\\(?:pry\\|irb\\)rc$"
:mode "/\\(?:Gem\\|Cap\\|Vagrant\\|Rake\\|Pod\\|Puppet\\|Berks\\)file$"
:interpreter "ruby"
:config :config
(set! :company-backend 'ruby-mode '(company-dabbrev-code)) (set! :company-backend 'ruby-mode 'company-dabbrev-code)
(set! :electric 'ruby-mode :words '("else" "end" "elseif")) (set! :electric 'ruby-mode :words '("else" "end" "elseif"))
(set! :env "RBENV_ROOT")
(set! :repl 'ruby-mode #'inf-ruby) ; `inf-ruby'
(setq ruby-deep-indent-paren t) (setq ruby-deep-indent-paren t)
;; Don't interfere with my custom RET behavior ;; Don't interfere with my custom RET behavior
(define-key ruby-mode-map [?\n] nil) (define-key ruby-mode-map [?\n] nil)
@ -74,10 +71,8 @@ environment variables."
(def-package! rspec-mode (def-package! rspec-mode
:mode ("/\\.rspec$" . text-mode) :mode ("/\\.rspec\\'" . text-mode)
:init :init
(associate! rspec-mode :match "/\\.rspec$")
(associate! rspec-mode :modes (ruby-mode yaml-mode) :files ("/spec/"))
(defvar rspec-mode-verifiable-map (make-sparse-keymap)) (defvar rspec-mode-verifiable-map (make-sparse-keymap))
(defvar evilmi-ruby-match-tags (defvar evilmi-ruby-match-tags
'((("unless" "if") ("elsif" "else") "end") '((("unless" "if") ("elsif" "else") "end")
@ -96,18 +91,12 @@ environment variables."
:n "v" #'rspec-verify)) :n "v" #'rspec-verify))
(def-package! inf-ruby
:commands (inf-ruby inf-ruby-console-auto)
:init (set! :repl 'ruby-mode 'inf-ruby))
(def-package! company-inf-ruby (def-package! company-inf-ruby
:when (featurep! :completion company) :when (featurep! :completion company)
:after inf-ruby :after inf-ruby
:config (set! :company-backend 'inf-ruby-mode '(company-inf-ruby))) :config (set! :company-backend 'inf-ruby-mode 'company-inf-ruby))
(def-package! rake ;; `rake'
:commands (rake rake-find-task rake-rerun) (setq rake-completion-system 'default)
:config (setq rake-completion-system 'default))

View file

@ -1,12 +1,6 @@
;;; lang/rust/config.el -*- lexical-binding: t; -*- ;;; lang/rust/config.el -*- lexical-binding: t; -*-
;; (after! rust-mode
;; Plugins
;;
(def-package! rust-mode
:mode "\\.rs$"
:config
(set! :env "RUST_SRC_PATH") (set! :env "RUST_SRC_PATH")
(set! :docset 'rust-mode "Rust") (set! :docset 'rust-mode "Rust")
(setq rust-indent-method-chain t) (setq rust-indent-method-chain t)
@ -14,6 +8,7 @@
(map! :map rust-mode-map (map! :map rust-mode-map
:localleader :localleader
:n "b" #'+rust/build-menu) :n "b" #'+rust/build-menu)
(def-menu! +rust/build-menu (def-menu! +rust/build-menu
"TODO" "TODO"
'(("cargo run" :exec "cargo run --color always") '(("cargo run" :exec "cargo run --color always")
@ -40,6 +35,5 @@
(def-package! flycheck-rust (def-package! flycheck-rust
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after rust-mode :after rust-mode
:hook (flycheck-mode . flycheck-rust-setup) :config (add-hook! 'rust-mode-hook #'(flycheck-mode flycheck-rust-setup)))
:init (add-hook 'rust-mode-hook #'flycheck-mode))

View file

@ -1,26 +1,24 @@
;;; lang/scala/config.el -*- lexical-binding: t; -*- ;;; lang/scala/config.el -*- lexical-binding: t; -*-
(def-package! scala-mode (after! scala-mode
:mode "\\.s\\(?:cala\\|bt\\)$" (setq scala-indent:align-parameters t)
:config (setq scala-indent:align-parameters t)) (add-to-list 'dtrt-indent-hook-mapping-list '(scala-mode c/c++/java scala-indent:step)))
(def-package! sbt-mode :after scala-mode) (after! ensime
(def-package! ensime
:commands (ensime ensime-scala-mode-hook)
:hook (scala-mode . ensime-mode)
:config
(set! :company-backend 'scala-mode '(ensime-company company-yasnippet))
(setq ensime-startup-snapshot-notification nil (setq ensime-startup-snapshot-notification nil
ensime-startup-notification nil ensime-startup-notification nil
ensime-eldoc-hints 'all ensime-eldoc-hints 'all
;; let DOOM handle company setup ;; let DOOM handle company setup
ensime-completion-style nil) ensime-completion-style nil)
(set! :company-backend 'scala-mode '(ensime-company company-yasnippet))
;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu' ;; Fix void-variable imenu-auto-rescan error caused by `ensime--setup-imenu'
;; trying to make imenu variables buffer local before imenu is loaded. ;; trying to make imenu variables buffer local before imenu is loaded.
(require 'imenu)) (require 'imenu))
(def-package! sbt-mode
:after scala-mode
:config (set! :repl 'scala-mode #'run-scala))

View file

@ -12,21 +12,19 @@
;; ;;
(def-package! sh-script ; built-in (def-package! sh-script ; built-in
:mode ("\\.zsh$" . sh-mode) :mode ("\\.zunit\\'" . sh-mode)
:mode ("\\.zunit$" . sh-mode) :mode ("/bspwmrc\\'" . sh-mode)
:mode ("/bspwmrc$" . sh-mode)
:init
(add-hook! sh-mode #'(flycheck-mode highlight-numbers-mode))
:config :config
(add-hook! sh-mode #'(flycheck-mode highlight-numbers-mode))
(set! :electric 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) (set! :electric 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
(set! :repl 'sh-mode #'+sh/repl) (set! :repl 'sh-mode #'+sh/repl)
(setq sh-indent-after-continuation 'always) (setq sh-indent-after-continuation 'always)
;; recognize function names with dashes in them ;; recognize function names with dashes in them
(push '((sh . ((nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1) (map-put sh-imenu-generic-expression
(nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1)))) 'sh '((nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)
sh-imenu-generic-expression) (nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1)))
;; `sh-set-shell' is chatty about setting up indentation rules ;; `sh-set-shell' is chatty about setting up indentation rules
(advice-add #'sh-set-shell :around #'doom*shut-up) (advice-add #'sh-set-shell :around #'doom*shut-up)

View file

@ -1,13 +1,14 @@
;;; lang/swift/config.el -*- lexical-binding: t; -*- ;;; lang/swift/config.el -*- lexical-binding: t; -*-
;; TODO Set up emacs task runners for fruitstrap ;; `swift-mode'
(set! :repl 'swift-mode #'run-swift)
(def-package! swift-mode
:mode "\\.swift$" (def-package! flycheck-swift
:config :when (featurep! :feature syntax-checker)
(add-hook 'swift-mode-hook #'flycheck-mode) :after swift-mode
(set! :repl 'swift-mode #'swift-mode-run-repl) ; TODO test this :init (add-hook 'swift-mode-hook #'flycheck-mode)
(push 'swift flycheck-checkers)) :config (flycheck-swift-setup))
(def-package! company-sourcekit (def-package! company-sourcekit

View file

@ -5,3 +5,6 @@
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-sourcekit)) (package! company-sourcekit))
(when (featurep! :feature syntax-checker)
(package! flycheck-swift))

View file

@ -1,10 +1,5 @@
;;; lang/web/+css.el -*- lexical-binding: t; -*- ;;; lang/web/+css.el -*- lexical-binding: t; -*-
;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(add-hook! (css-mode sass-mode stylus-mode)
#'(yas-minor-mode-on flycheck-mode highlight-numbers-mode))
;; An improved newline+continue comment function ;; An improved newline+continue comment function
(setq-hook! css-mode comment-indent-function #'+css/comment-indent-new-line) (setq-hook! css-mode comment-indent-function #'+css/comment-indent-new-line)
@ -13,29 +8,36 @@
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))))) (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))))
(map! :map* (css-mode-map scss-mode-map less-css-mode-map) (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
:n "M-R" #'+css/web-refresh-browser :localleader
(:localleader :n "rb" #'+css/toggle-inline-or-block)
:n "rb" #'+css/toggle-inline-or-block))
;; ;;
;; Packages ;; Packages
;; ;;
;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(add-hook! (css-mode sass-mode stylus-mode)
#'(yas-minor-mode-on
flycheck-mode
highlight-numbers-mode
rainbow-mode))
(def-package! counsel-css (def-package! counsel-css
:when (featurep! :completion ivy) :when (featurep! :completion ivy)
:commands (counsel-css counsel-css-imenu-setup) :commands counsel-css
:hook (css-mode . counsel-css-imenu-setup) :hook (css-mode . counsel-css-imenu-setup)
:init :init
(map! :map* (css-mode-map scss-mode-map less-css-mode-map) (map! :map* (css-mode-map scss-mode-map less-css-mode-map)
:localleader :n ";" #'counsel-css)) :localleader :n ";" #'counsel-css))
(def-package! rainbow-mode (def-package! css-mode ; built-in
:hook (css-mode sass-mode)) :defer t
:config
;; contains both css-mode & scss-mode
(after! css-mode ; contains both css-mode & scss-mode
(set! :docset 'css-mode "CSS") (set! :docset 'css-mode "CSS")
(set! :docset 'scss-mode "Sass") (set! :docset 'scss-mode "Sass")
(unless EMACS26+ (unless EMACS26+
@ -45,7 +47,7 @@
(def-package! sass-mode (def-package! sass-mode
:commands sass-mode :defer t
:config :config
(set! :docset 'sass-mode "Sass") (set! :docset 'sass-mode "Sass")
(set! :company-backend 'sass-mode 'company-css) (set! :company-backend 'sass-mode 'company-css)

View file

@ -14,7 +14,6 @@
:mode "wp-content/themes/.+/.+\\.php$" :mode "wp-content/themes/.+/.+\\.php$"
:mode "templates/.+\\.php$" :mode "templates/.+\\.php$"
:config :config
(set! :company-backend 'web-mode '(company-web-html company-yasnippet))
(setq web-mode-enable-html-entities-fontification t (setq web-mode-enable-html-entities-fontification t
web-mode-enable-auto-quoting nil) web-mode-enable-auto-quoting nil)
@ -91,10 +90,7 @@
:nv "[T" #'web-mode-element-parent)) :nv "[T" #'web-mode-element-parent))
(def-package! company-web ;;
:when (featurep! :completion company) (set! :company-backend 'pug-mode 'company-web-jade)
:after web-mode) (set! :company-backend 'web-mode 'company-web-html)
(set! :company-backend 'slim-mode 'company-web-slim)
;; `pug-mode'
(set! :company-backend 'pug-mode '(company-yasnippet))

View file

@ -13,9 +13,9 @@
(package! haml-mode) (package! haml-mode)
(package! pug-mode) (package! pug-mode)
(package! slim-mode) (package! slim-mode)
(package! web-mode) (when (package! web-mode)
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-web)) (package! company-web)))
;; +css.el ;; +css.el
(package! less-css-mode) (package! less-css-mode)

View file

@ -3,7 +3,8 @@
;; Handles whitespace (tabs/spaces) settings externally. This way projects can ;; Handles whitespace (tabs/spaces) settings externally. This way projects can
;; specify their own formatting rules. ;; specify their own formatting rules.
(def-package! editorconfig (def-package! editorconfig
:hook (doom-init . editorconfig-mode) :defer 2
:after-call doom-before-switch-buffer
:config :config
;; Register missing indent variables ;; Register missing indent variables
(setq editorconfig-indentation-alist (setq editorconfig-indentation-alist
@ -49,9 +50,7 @@ extension, try to guess one."
;; editorconfig to ignore indentation there. I prefer dynamic indentation ;; editorconfig to ignore indentation there. I prefer dynamic indentation
;; support built into Emacs. ;; support built into Emacs.
(dolist (mode '(emacs-lisp-mode lisp-mode)) (dolist (mode '(emacs-lisp-mode lisp-mode))
(map-delete editorconfig-indentation-alist mode))) (map-delete editorconfig-indentation-alist mode))
(def-package! editorconfig-conf-mode
:mode "\\.?editorconfig$")
;;
(editorconfig-mode +1))

View file

@ -1,9 +1,29 @@
;;; tools/ein/autoload.el -*- lexical-binding: t; -*- ;;; tools/ein/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(def-setting! :ein-notebook-dir (dir)
"Set the default directory from where to open Jupyter notebooks."
`(setq ein:jupyter-default-notebook-directory ,dir))
;;
;; Library
;;
(defun +ein--collect-ein-buffer-links ()
(let ((end (window-end))
points)
(save-excursion
(goto-char (window-start))
(while (re-search-forward "~?/.+\\|\s\\[" end t)
(push (+ (match-beginning 0) 1) points))
(nreverse points))))
;;;###autoload ;;;###autoload
(defun +ein/ace-link-ein () (defun +ein/ace-link-ein ()
"Ace jump to links in ein notebooklist." "Ace jump to links in ein notebooklist."
(interactive) (interactive)
(require 'avy)
(let ((res (avy-with +ein/ace-link-ein (let ((res (avy-with +ein/ace-link-ein
(avy--process (avy--process
(+ein--collect-ein-buffer-links) (+ein--collect-ein-buffer-links)
@ -13,14 +33,4 @@
(goto-char (1+ res)) (goto-char (1+ res))
(widget-button-press (point))))) (widget-button-press (point)))))
;;;###autoload
(defun +ein--collect-ein-buffer-links ()
(interactive)
(let ((end (window-end))
points)
(save-excursion
(goto-char (window-start))
(while (re-search-forward "~?/.+\\|\s\\[" end t)
(push (+ (match-beginning 0) 1) points))
(nreverse points))))

View file

@ -3,47 +3,49 @@
(defvar +ein-notebook-dir "~/" (defvar +ein-notebook-dir "~/"
"Default directory from where Jupyter notebooks are to be opened.") "Default directory from where Jupyter notebooks are to be opened.")
(def-setting! :ein-notebook-dir (dir)
"Set the default directory from where to open Jupyter notebooks."
`(setq +ein-notebook-dir ,dir))
;;
;; Plugins
;;
(def-package! ein (def-package! ein
:commands (ein:notebooklist-open ein:notebooklist-login ein:jupyter-server-start) :defer t
:init :init
(push (lambda (buf) (string-match-p "^\\*ein: .*" (buffer-name buf)))
doom-real-buffer-functions)
(set! :popup "\\*ein: .*" :ignore) (set! :popup "\\*ein: .*" :ignore)
(set! :popup "\\*ein:tb .*" '((side . bottom) (size . 0.3)) '((quit . t) (transient) (select))) (set! :popup "\\*ein:tb .*"
(set! :popup "\\*ein:notebooklist *" '((side . left) (size . 50)) '((select))) '((side . bottom) (size . 0.3))
;; Ace-link on notebook list buffers '((quit . t) (transient) (select)))
(add-hook! 'ein:notebooklist-mode-hook (set! :popup "\\*ein:notebooklist *"
(map! :map ein:notebooklist-mode-map '((side . left) (size . 50))
"o" #'+ein/ace-link-ein)) '((select)))
;; Ein uses request to store http cookies. Store them in the cache dir.
(setq request-storage-directory (concat doom-cache-dir "/request"))
;; Auto complete with company ;; Auto complete with company
(when (featurep! :completion company) (when (featurep! :completion company)
(setq ein:completion-backend 'ein:use-company-backend) (setq ein:completion-backend 'ein:use-company-backend)
(set! :company-backend (set! :company-backend '(ein:notebook-multilang-mode
'(ein:notebook-multilang-mode
ein:notebook-python-mode ein:notebook-python-mode
ein:notebook-plain-mode) ein:notebook-plain-mode)
'ein:company-backend)) 'ein:company-backend))
:config :config
;; Manually load the autoloads of EIN. This takes time... (setq ein:jupyter-server-args '("--no-browser")
(load "ein-loaddefs.el" nil t t)
(setq
;; Slice images into rows so that we can navigate buffers with images more easily
ein:slice-image t
ein:jupyter-default-notebook-directory +ein-notebook-dir
ein:jupyter-default-server-command "jupyter"
ein:jupyter-server-args '("--no-browser")
ein:notebook-modes ein:notebook-modes
'(ein:notebook-multilang-mode ein:notebook-python-mode ein:notebook-plain-mode)) '(ein:notebook-multilang-mode ein:notebook-python-mode ein:notebook-plain-mode)
;; Avy is required for showing links in the notebook list with ace-link. ;; Slice images into rows; easier to navigate around images
(require 'avy) ein:slice-image t)
(unless ein:jupyter-default-notebook-directory
(setq ein:jupyter-default-notebook-directory "~/"))
(defun +ein-buffer-p (buf)
(string-match-p "^\\*ein: .*" (buffer-name buf)))
(add-to-list 'doom-real-buffer-functions #'+ein-buffer-p nil #'eq)
;; Ace-link on notebook list buffers
(map! :after ein-notebooklist
:map ein:notebooklist-mode-map
"o" #'+ein/ace-link-ein)
;; add hydra ;; add hydra
(defhydra +ein/hydra (:hint t :color red) (defhydra +ein/hydra (:hint t :color red)
" "

View file

@ -8,16 +8,6 @@
(defvar-local doom-electric-indent-words '() (defvar-local doom-electric-indent-words '()
"TODO") "TODO")
(setq-default electric-indent-chars '(?\n ?\^?))
(defun +electric-indent|char (_c)
(when (and (eolp) doom-electric-indent-words)
(save-excursion
(backward-word)
(looking-at-p
(concat "\\<" (regexp-opt doom-electric-indent-words))))))
(push #'+electric-indent|char electric-indent-functions)
(def-setting! :electric (modes &rest plist) (def-setting! :electric (modes &rest plist)
"Declare :words (list of strings) or :chars (lists of chars) in MODES that "Declare :words (list of strings) or :chars (lists of chars) in MODES that
trigger electric indentation." trigger electric indentation."
@ -34,3 +24,15 @@ trigger electric indentation."
,@(if words `((setq doom-electric-indent-words ',words)))) ,@(if words `((setq doom-electric-indent-words ',words))))
(add-hook! ,modes #',fn-name)))))) (add-hook! ,modes #',fn-name))))))
;;
(after! electric
(setq-default electric-indent-chars '(?\n ?\^?))
(defun +electric-indent|char (_c)
(when (and (eolp) doom-electric-indent-words)
(save-excursion
(backward-word)
(looking-at-p
(concat "\\<" (regexp-opt doom-electric-indent-words))))))
(add-to-list 'electric-indent-functions #'+electric-indent|char))

View file

@ -1,7 +1,5 @@
;;; tools/eshell/config.el -*- lexical-binding: t; -*- ;;; tools/eshell/config.el -*- lexical-binding: t; -*-
;; This is highly experimental. I don't use eshell often, so this may need work.
;; see: ;; see:
;; + `+eshell/open': open in current buffer ;; + `+eshell/open': open in current buffer
;; + `+eshell/open-popup': open in a popup ;; + `+eshell/open-popup': open in a popup
@ -9,7 +7,7 @@
;; workspaces) ;; workspaces)
(def-package! eshell ; built-in (def-package! eshell ; built-in
:commands eshell-mode :defer t
:init :init
(setq eshell-directory-name (setq eshell-directory-name
(let ((dir (concat doom-private-dir "eshell"))) (let ((dir (concat doom-private-dir "eshell")))

View file

@ -4,9 +4,7 @@
;; errors. If that happens, try `+gist/kill-cache'. You may have to restart ;; errors. If that happens, try `+gist/kill-cache'. You may have to restart
;; Emacs. ;; Emacs.
(def-package! gist (after! gist
:commands (gist-list gist-region-or-buffer-private gist-region-or-buffer)
:config
(set! :evil-state 'gist-list-mode 'normal) (set! :evil-state 'gist-list-mode 'normal)
(defun +gist*list-render (orig-fn &rest args) (defun +gist*list-render (orig-fn &rest args)

View file

@ -1,13 +1,10 @@
;;; tools/imenu/config.el -*- lexical-binding: t; -*- ;;; tools/imenu/config.el -*- lexical-binding: t; -*-
(def-package! imenu-anywhere ;; `imenu-anywhere'
:commands (ido-imenu-anywhere ivy-imenu-anywhere helm-imenu-anywhere) (setq imenu-anywhere-delimiter ": ")
:config (setq imenu-anywhere-delimiter ": "))
(def-package! imenu-list (after! imenu-list
:commands (imenu-list-minor-mode imenu-list-smart-toggle)
:config
(setq imenu-list-idle-update-delay 0.5) (setq imenu-list-idle-update-delay 0.5)
(set! :popup "^\\*Ilist" (set! :popup "^\\*Ilist"

View file

@ -2,8 +2,6 @@
(def-package! magit (def-package! magit
:defer t :defer t
:init
(load "magit-autoloads" nil t)
:config :config
(setq magit-completing-read-function (setq magit-completing-read-function
(if (featurep! :completion ivy) (if (featurep! :completion ivy)
@ -18,13 +16,11 @@
(map! :map magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit)) (map! :map magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit))
(def-package! magit-blame (def-package! magit-blame :after git-timemachine)
:commands magit-blame
:after git-timemachine)
(def-package! magithub (def-package! magithub
:commands (magithub-clone magithub-feature-autoinject) :commands magithub-feature-autoinject
:after magit :after magit
:preface :preface
(setq magithub-dir (concat doom-etc-dir "magithub/")) (setq magithub-dir (concat doom-etc-dir "magithub/"))
@ -32,7 +28,6 @@
(setq magithub-clone-default-directory "~/" (setq magithub-clone-default-directory "~/"
magithub-preferred-remote-method 'clone_url) magithub-preferred-remote-method 'clone_url)
:config :config
(load "magithub-autoloads" nil t)
(magithub-feature-autoinject t)) (magithub-feature-autoinject t))

View file

@ -11,17 +11,18 @@
;; Plugins ;; Plugins
;; ;;
(def-package! password-store ;; `password-store'
(setq password-store-password-length 12)
;; `pass'
(def-package! pass
:defer t :defer t
:config :config
(setq password-store-password-length 12))
(def-package! pass
:commands pass
:config
(set! :evil-state 'pass-mode 'emacs) (set! :evil-state 'pass-mode 'emacs)
(set! :popup "^\\*Password-Store" '((side . left) (size . 0.25)) '((quit))) (set! :popup "^\\*Password-Store"
'((side . left) (size . 0.25))
'((quit)))
(map! :map pass-mode-map (map! :map pass-mode-map
"j" #'pass-next-entry "j" #'pass-next-entry
"k" #'pass-prev-entry "k" #'pass-prev-entry
@ -30,12 +31,6 @@
"C-k" #'pass-next-directory)) "C-k" #'pass-next-directory))
(def-package! helm-pass
:when (featurep! :completion helm)
:commands helm-pass)
;; Is built into Emacs 26+ ;; Is built into Emacs 26+
(def-package! auth-source-pass (when (and EMACS26+ (featurep! +auth))
:when (featurep! +auth) (auth-source-pass-enable))
:config (auth-source-pass-enable))

View file

@ -4,7 +4,7 @@
(package! pass) (package! pass)
(package! password-store) (package! password-store)
(when (featurep! +auth) (when (and EMACS26+ (featurep! +auth))
(package! auth-source-pass)) (package! auth-source-pass))
(when (featurep! :completion helm) (when (featurep! :completion helm)

View file

@ -1,8 +1,7 @@
;;; tools/pdf/config.el -*- lexical-binding: t; -*- ;;; tools/pdf/config.el -*- lexical-binding: t; -*-
(def-package! pdf-tools (def-package! pdf-tools
:mode ("\\.pdf$" . pdf-view-mode) :mode ("\\.pdf\\'" . pdf-view-mode)
:init (load "pdf-tools-autoloads" nil t)
:config :config
(unless noninteractive (unless noninteractive
(pdf-tools-install)) (pdf-tools-install))

View file

@ -1,5 +1,11 @@
;;; tools/prodigy/autoload.el -*- lexical-binding: t; -*- ;;; tools/prodigy/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(def-setting! :service (&rest plist)
"TODO"
`(after! prodigy
(prodigy-define-service ,@plist)))
;;;###autoload ;;;###autoload
(defun +prodigy/create () (defun +prodigy/create ()
"Interactively create a new prodigy service." "Interactively create a new prodigy service."
@ -32,3 +38,17 @@
(file-directory-p (plist-get service :project))) (file-directory-p (plist-get service :project)))
collect service into services collect service into services
finally do (setq prodigy-service services))) finally do (setq prodigy-service services)))
;;;###autoload
(defun +prodigy*services (orig-fn &rest args)
"Adds a new :project property to prodigy services, which hides the service
unless invoked from the relevant project."
(let ((project-root (downcase (doom-project-root)))
(services (apply orig-fn args)))
(if current-prefix-arg
services
(cl-remove-if-not (lambda (service)
(let ((project (plist-get service :project)))
(or (not project)
(file-in-directory-p project-root project))))
services))))

View file

@ -1,38 +1,13 @@
;;; tools/prodigy/config.el -*- lexical-binding: t; -*- ;;; tools/prodigy/config.el -*- lexical-binding: t; -*-
(def-setting! :service (&rest plist) (after! prodigy
"TODO"
`(after! prodigy
(prodigy-define-service ,@plist)))
;;
;; Plugins
;;
(def-package! prodigy
:commands (prodigy prodigy-view-mode prodigy-add-filter)
:config
(set! :evil-state 'prodigy-mode 'emacs) (set! :evil-state 'prodigy-mode 'emacs)
;; Make services, etc persistent between Emacs sessions ;; Make services, etc persistent between Emacs sessions
(doom-cache-persist (doom-cache-persist
:prodigy '(prodigy-services prodigy-tags prodigy-filters)) :prodigy '(prodigy-services prodigy-tags prodigy-filters))
(defun +prodigy*services (orig-fn &rest args)
"Adds a new :project property to prodigy services, which hides the service
unless invoked from the relevant project."
(let ((project-root (downcase (doom-project-root)))
(services (apply orig-fn args)))
(if current-prefix-arg
services
(cl-remove-if-not (lambda (service)
(let ((project (plist-get service :project)))
(or (not project)
(file-in-directory-p project-root project))))
services))))
(advice-add #'prodigy-services :around #'+prodigy*services) (advice-add #'prodigy-services :around #'+prodigy*services)
;; Keybindings
(map! :map prodigy-mode-map "d" #'+prodigy/delete)) (map! :map prodigy-mode-map "d" #'+prodigy/delete))

View file

@ -4,9 +4,6 @@
;; Plugins ;; Plugins
;; ;;
(def-package! rainbow-mode)
(def-package! kurecolor (def-package! kurecolor
:after rainbow-mode :after rainbow-mode
:config :config

View file

@ -0,0 +1,17 @@
;;; tools/rotate-text/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(def-setting! :rotate (modes &rest plist)
"Declare :symbols, :words or :patterns (all lists of strings) that
`rotate-text' will cycle through."
(declare (indent 1))
(let* ((modes (doom-enlist (doom-unquote modes)))
(fn-name (intern (format "doom--rotate-%s" (mapconcat #'symbol-name modes "-")))))
`(progn
(defun ,fn-name ()
(require 'rotate-text)
(let ((plist (list ,@plist)))
(setq rotate-text-local-symbols (plist-get plist :symbols)
rotate-text-local-words (plist-get plist :words)
rotate-text-local-patterns (plist-get plist :patterns))))
(add-hook! ,modes #',fn-name))))

View file

@ -1,22 +1,4 @@
;;; tools/rotate-text/config.el -*- lexical-binding: t; -*- ;;; tools/rotate-text/config.el -*- lexical-binding: t; -*-
(def-package! rotate-text (after! rotate-text
:commands (rotate-text rotate-text-backward) (add-to-list 'rotate-text-words '("true" "false")))
:config
(push '("true" "false") rotate-text-words))
(def-setting! :rotate (modes &rest plist)
"Declare :symbols, :words or :patterns (all lists of strings) that
`rotate-text' will cycle through."
(declare (indent 1))
(let* ((modes (doom-enlist (doom-unquote modes)))
(fn-name (intern (format "doom--rotate-%s" (mapconcat #'symbol-name modes "-")))))
`(progn
(defun ,fn-name ()
(let ((plist (list ,@plist)))
(setq rotate-text-local-symbols (plist-get plist :symbols)
rotate-text-local-words (plist-get plist :words)
rotate-text-local-patterns (plist-get plist :patterns))))
(add-hook! ,modes #',fn-name))))

View file

@ -1,8 +1,14 @@
;;; tools/term/config.el -*- lexical-binding: t; -*- ;;; tools/term/config.el -*- lexical-binding: t; -*-
(def-package! multi-term ;; `multi-term'
:commands (multi-term multi-term-next multi-term-prev) (setq multi-term-dedicated-window-height 20
:config multi-term-switch-after-close 'PREVIOUS)
(setq multi-term-program (getenv "SHELL")
multi-term-dedicated-window-height 20 ;; `term' (built-in)
multi-term-switch-after-close 'PREVIOUS)) (after! term
(set! :env "SHELL")
;; Consider term buffers real
(defun +term-p (buf)
(eq (buffer-local-value 'major-mode buf) 'term-mode))
(add-to-list 'doom-real-buffer-functions #'+eshell-p #'eq))

View file

@ -114,6 +114,7 @@ Possible values:
(defun +doom-dashboard|init () (defun +doom-dashboard|init ()
"Initializes Doom's dashboard." "Initializes Doom's dashboard."
(unless noninteractive
(add-hook 'window-configuration-change-hook #'+doom-dashboard|resize) (add-hook 'window-configuration-change-hook #'+doom-dashboard|resize)
(add-hook 'window-size-change-functions #'+doom-dashboard|resize) (add-hook 'window-size-change-functions #'+doom-dashboard|resize)
(add-hook 'kill-buffer-query-functions #'+doom-dashboard|reload-on-kill) (add-hook 'kill-buffer-query-functions #'+doom-dashboard|reload-on-kill)
@ -123,7 +124,7 @@ Possible values:
;; `persp-mode' integration: update `default-directory' when switching ;; `persp-mode' integration: update `default-directory' when switching
(add-hook 'persp-created-functions #'+doom-dashboard|record-project) (add-hook 'persp-created-functions #'+doom-dashboard|record-project)
(add-hook 'persp-activated-functions #'+doom-dashboard|detect-project) (add-hook 'persp-activated-functions #'+doom-dashboard|detect-project)
(add-hook 'persp-before-switch-functions #'+doom-dashboard|record-project) (add-hook 'persp-before-switch-functions #'+doom-dashboard|record-project))
(+doom-dashboard-reload t)) (+doom-dashboard-reload t))
(defun +doom-dashboard|reload-on-kill () (defun +doom-dashboard|reload-on-kill ()

View file

@ -4,11 +4,7 @@
;; mode-line. ;; mode-line.
(def-package! anzu (def-package! anzu
:commands (anzu-mode global-anzu-mode :after-call isearch-mode
anzu-query-replace anzu-query-replace-regexp
anzu-query-replace-at-cursor anzu-replace-at-cursor-thing)
:init
(add-transient-hook! #'isearch-mode (require 'anzu))
:config :config
(setq anzu-cons-mode-line-p nil (setq anzu-cons-mode-line-p nil
anzu-minimum-input-length 1 anzu-minimum-input-length 1
@ -35,10 +31,7 @@
(def-package! evil-anzu (def-package! evil-anzu
:defer t :after-call (evil-ex-start-search evil-ex-start-word-search))
:init
(add-transient-hook! #'evil-ex-start-search (require 'evil-anzu))
(add-transient-hook! #'evil-ex-start-word-search (require 'evil-anzu)))
;; fish-style modeline ;; fish-style modeline

View file

@ -22,10 +22,11 @@
;; <https://github.com/hlissner/emacs-doom-theme> ;; <https://github.com/hlissner/emacs-doom-theme>
(def-package! doom-themes (def-package! doom-themes
:config :defer t
:init
(unless doom-theme (unless doom-theme
(setq doom-theme 'doom-one)) (setq doom-theme 'doom-one))
:config
;; Reload common faces when reloading doom-themes live ;; Reload common faces when reloading doom-themes live
(defun +doom*reload-common (&rest _) (load "doom-themes-common.el" nil t)) (defun +doom*reload-common (&rest _) (load "doom-themes-common.el" nil t))
(advice-add #'doom//reload-theme :before #'+doom*reload-common) (advice-add #'doom//reload-theme :before #'+doom*reload-common)
@ -41,7 +42,7 @@
(def-package! solaire-mode (def-package! solaire-mode
:commands (solaire-mode turn-on-solaire-mode solaire-mode-swap-bg) :defer t
:init :init
(defun +doom|solaire-mode-swap-bg-maybe () (defun +doom|solaire-mode-swap-bg-maybe ()
(when-let* ((rule (assq doom-theme +doom-solaire-themes))) (when-let* ((rule (assq doom-theme +doom-solaire-themes)))

View file

@ -2,7 +2,7 @@
(def-package! evil-goggles (def-package! evil-goggles
:when (featurep! :feature evil) :when (featurep! :feature evil)
:defer pre-command-hook :after-call pre-command-hook
:init :init
(setq evil-goggles-duration 0.05 (setq evil-goggles-duration 0.05
evil-goggles-pulse nil ; too slow evil-goggles-pulse nil ; too slow

View file

@ -1,7 +1,7 @@
;;; ui/nav-flash/config.el -*- lexical-binding: t; -*- ;;; ui/nav-flash/config.el -*- lexical-binding: t; -*-
(def-package! nav-flash (def-package! nav-flash
:commands nav-flash-show :defer t
:init :init
;; NOTE In :feature lookup `recenter' is hooked to a bunch of jumping ;; NOTE In :feature lookup `recenter' is hooked to a bunch of jumping
;; commands, which will trigger nav-flash. ;; commands, which will trigger nav-flash.

View file

@ -1,5 +1,73 @@
;;; ui/popup/autoload.el -*- lexical-binding: t; -*- ;;; ui/popup/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defvar +popup--display-buffer-alist nil)
;;;###autoload
(def-setting! :popup (condition &optional alist parameters)
"Register a popup rule.
CONDITION can be a regexp string or a function. See `display-buffer' for a list
of possible entries for ALIST, which tells the display system how to initialize
the popup window. PARAMETERS is an alist of window parameters. See
`+popup-window-parameters' for a list of custom parameters provided by the popup
module.
ALIST supports one custom parameter: `size', which will resolve to
`window-height' or `window-width' depending on `side'."
`(progn
(+popup-define ,condition ,alist ,parameters)
(when (bound-and-true-p +popup-mode)
(setq display-buffer-alist +popup--display-buffer-alist))
+popup--display-buffer-alist))
;;;###autoload
(def-setting! :popups (&rest rules)
"Register multiple popup rules with :popup setting (`doom--set:popup'). For
example:
(set! :popups
(\"^ \\*\" '((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
(\"^\\*\" '((slot . 1) (vslot . -1)) '((select . t))))"
`(progn
,@(cl-loop for rule in rules collect `(+popup-define ,@rule))
(when (bound-and-true-p +popup-mode)
(setq display-buffer-alist +popup--display-buffer-alist))
+popup--display-buffer-alist))
;;;###autoload
(defsubst +popup-define (condition &optional alist parameters)
"Define a popup rule.
The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
will be tested against CONDITION, which is either a) a regexp string (which is
matched against the buffer's name) or b) a function that takes no arguments and
returns a boolean.
If CONDITION is met, the buffer will be displayed in a popup window with ALIST
and window PARAMETERS. See `display-buffer-alist' for details on what ALIST may
contain and `+popup-window-parameters' for what window parameters that the popup
module supports.
ALIST also supports the `size' parameter, which will be translated to
`window-width' or `window-height' depending on `side'.
If certain attributes/parameters are omitted, the ones from
`+popup-default-alist' and `+popup-default-parameters' will be used."
(declare (indent 1))
(push (if (eq alist :ignore)
(list condition nil)
`(,condition
(+popup-buffer)
,@alist
(window-parameters ,@parameters)))
+popup--display-buffer-alist))
;;
;; Library
;;
(defvar +popup--populate-wparams (not EMACS26+)) (defvar +popup--populate-wparams (not EMACS26+))
(defvar +popup--inhibit-transient nil) (defvar +popup--inhibit-transient nil)
(defvar +popup--inhibit-select nil) (defvar +popup--inhibit-select nil)

View file

@ -1,61 +0,0 @@
;;; ui/popup/init.el -*- lexical-binding: t; -*-
(defvar +popup--display-buffer-alist nil)
(defun +popup-define (condition &optional alist parameters)
"Define a popup rule.
The buffers of new windows displayed by `pop-to-buffer' and `display-buffer'
will be tested against CONDITION, which is either a) a regexp string (which is
matched against the buffer's name) or b) a function that takes no arguments and
returns a boolean.
If CONDITION is met, the buffer will be displayed in a popup window with ALIST
and window PARAMETERS. See `display-buffer-alist' for details on what ALIST may
contain and `+popup-window-parameters' for what window parameters that the popup
module supports.
ALIST also supports the `size' parameter, which will be translated to
`window-width' or `window-height' depending on `side'.
If certain attributes/parameters are omitted, the ones from
`+popup-default-alist' and `+popup-default-parameters' will be used."
(declare (indent 1))
(push (if (eq alist :ignore)
(list condition nil)
`(,condition
(+popup-buffer)
,@alist
(window-parameters ,@parameters)))
+popup--display-buffer-alist))
;;
(def-setting! :popup (condition &optional alist parameters)
"Register a popup rule.
CONDITION can be a regexp string or a function. See `display-buffer' for a list
of possible entries for ALIST, which tells the display system how to initialize
the popup window. PARAMETERS is an alist of window parameters. See
`+popup-window-parameters' for a list of custom parameters provided by the popup
module.
ALIST supports one custom parameter: `size', which will resolve to
`window-height' or `window-width' depending on `side'."
`(progn
(+popup-define ,condition ,alist ,parameters)
(when (bound-and-true-p +popup-mode)
(setq display-buffer-alist +popup--display-buffer-alist))
+popup--display-buffer-alist))
(def-setting! :popups (&rest rules)
"Register multiple popup rules with :popup setting (`doom--set:popup'). For
example:
(set! :popups
(\"^ \\*\" '((slot . 1) (vslot . -1) (size . +popup-shrink-to-fit)))
(\"^\\*\" '((slot . 1) (vslot . -1)) '((select . t))))"
`(progn
,@(cl-loop for rule in rules collect `(+popup-define ,@rule))
(when (bound-and-true-p +popup-mode)
(setq display-buffer-alist +popup--display-buffer-alist))
+popup--display-buffer-alist))

View file

@ -0,0 +1,23 @@
;;; ui/unicode/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(add-hook 'doom-post-init-hook #'+unicode|init-fonts)
;;;###autoload
(defun +unicode|init-fonts ()
"Set up `unicode-fonts' to eventually run; accomodating the daemon, if
necessary."
(setq-default bidi-display-reordering t
doom-unicode-font nil)
(if initial-window-system
(+unicode|setup-fonts (selected-frame))
(add-hook 'after-make-frame-functions #'+unicode|setup-fonts)))
;;;###autoload
(defun +unicode|setup-fonts (&optional frame)
"Initialize `unicode-fonts', if in a GUI session."
(when (and frame (display-graphic-p frame))
(with-selected-frame frame
(require 'unicode-fonts)
;; NOTE will impact startup time on first run
(unicode-fonts-setup))))

View file

@ -1,19 +0,0 @@
;;; ui/unicode/config.el -*- lexical-binding: t; -*-
(def-package! unicode-fonts
:init
(setq-default bidi-display-reordering t
doom-unicode-font nil)
(defun +unicode|init-fonts (&optional frame)
"Initialize `unicode-fonts', if in a GUI session."
(when (and frame (display-graphic-p frame))
(with-selected-frame frame
(require 'unicode-fonts)
;; NOTE will impact startup time on first run
(unicode-fonts-setup))))
(add-hook! 'after-init-hook
(if initial-window-system
(+unicode|init-fonts (selected-frame))
(add-hook 'after-make-frame-functions #'+unicode|init-fonts))))

View file

@ -0,0 +1,4 @@
;;; ui/vi-tilde-fringe/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(add-hook! (prog-mode text-mode conf-mode) #'vi-tilde-fringe-mode)

View file

@ -1,6 +0,0 @@
;;; ui/vi-tilde-fringe/config.el -*- lexical-binding: t; -*-
;; indicators for empty lines past EOF
(def-package! vi-tilde-fringe
:hook ((prog-mode text-mode conf-mode) . vi-tilde-fringe-mode))

View file

@ -2,9 +2,7 @@
(def-package! switch-window (def-package! switch-window
:when (featurep! +switch-window) :when (featurep! +switch-window)
:commands (switch-window switch-window-then-maximize switch-window-then-split-below :defer t
switch-window-then-split-right switch-window-then-delete
switch-window-then-swap-buffer)
:init :init
(define-key global-map [remap other-window] #'switch-window) (define-key global-map [remap other-window] #'switch-window)
:config :config
@ -14,8 +12,7 @@
(def-package! ace-window (def-package! ace-window
:unless (featurep! +switch-window) :unless (featurep! +switch-window)
:commands (ace-window ace-swap-window ace-delete-window :defer t
ace-select-window ace-delete-other-windows)
:init :init
(define-key global-map [remap other-window] #'ace-window) (define-key global-map [remap other-window] #'ace-window)
:config :config