General refactor for consistency & idempotency
Also updated comments
This commit is contained in:
parent
50401f6c09
commit
80adb9c1f6
17 changed files with 48 additions and 40 deletions
|
@ -1,6 +1,5 @@
|
||||||
;;; core/autoload/ui.el -*- lexical-binding: t; -*-
|
;;; core/autoload/ui.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar doom--line-number-style doom-line-numbers-style)
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/toggle-line-numbers ()
|
(defun doom/toggle-line-numbers ()
|
||||||
"Toggle line numbers.
|
"Toggle line numbers.
|
||||||
|
@ -10,6 +9,7 @@ Cycles through regular, relative and no line numbers. The order depends on what
|
||||||
|
|
||||||
Uses `display-line-numbers' in Emacs 26+ and `nlinum-mode' everywhere else."
|
Uses `display-line-numbers' in Emacs 26+ and `nlinum-mode' everywhere else."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
(defvar doom--line-number-style doom-line-numbers-style)
|
||||||
(let* ((styles '(t relative nil))
|
(let* ((styles '(t relative nil))
|
||||||
(order (cons doom-line-numbers-style (delq doom-line-numbers-style styles)))
|
(order (cons doom-line-numbers-style (delq doom-line-numbers-style styles)))
|
||||||
(queue (memq doom--line-number-style order))
|
(queue (memq doom--line-number-style order))
|
||||||
|
|
|
@ -225,7 +225,7 @@ Body forms can access the hook's arguments through the let-bound variable
|
||||||
(,mode 1)))
|
(,mode 1)))
|
||||||
,@(if (and modes (listp modes))
|
,@(if (and modes (listp modes))
|
||||||
(cl-loop for hook in (doom--resolve-hook-forms modes)
|
(cl-loop for hook in (doom--resolve-hook-forms modes)
|
||||||
collect `(add-hook ',hook ',hook-name))
|
collect `(add-hook ',hook #',hook-name))
|
||||||
`((add-hook 'after-change-major-mode-hook ',hook-name))))))
|
`((add-hook 'after-change-major-mode-hook ',hook-name))))))
|
||||||
(match
|
(match
|
||||||
`(map-put doom-auto-minor-mode-alist ,match ',mode))
|
`(map-put doom-auto-minor-mode-alist ,match ',mode))
|
||||||
|
|
|
@ -419,11 +419,17 @@ added, if the file exists."
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Module config macros
|
;; Use-package modifications
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(autoload 'use-package "use-package" nil nil 'macro)
|
(autoload 'use-package "use-package" nil nil 'macro)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Module config macros
|
||||||
|
;;
|
||||||
|
|
||||||
(defmacro doom! (&rest modules)
|
(defmacro doom! (&rest modules)
|
||||||
"Bootstraps DOOM Emacs and its modules.
|
"Bootstraps DOOM Emacs and its modules.
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,7 @@ XDG directory conventions if ~/.config/doom exists.")
|
||||||
(setq-default
|
(setq-default
|
||||||
ad-redefinition-action 'accept ; silence advised function warnings
|
ad-redefinition-action 'accept ; silence advised function warnings
|
||||||
apropos-do-all t ; make `apropos' more useful
|
apropos-do-all t ; make `apropos' more useful
|
||||||
debug-on-error (and (not noninteractive) doom-debug-mode)
|
debug-on-error doom-debug-mode
|
||||||
load-prefer-newer noninteractive
|
|
||||||
ffap-machine-p-known 'reject ; don't ping things that look like domain names
|
ffap-machine-p-known 'reject ; don't ping things that look like domain names
|
||||||
idle-update-delay 2 ; update ui less often
|
idle-update-delay 2 ; update ui less often
|
||||||
;; keep the point out of the minibuffer
|
;; keep the point out of the minibuffer
|
||||||
|
@ -83,8 +82,9 @@ XDG directory conventions if ~/.config/doom exists.")
|
||||||
auto-save-list-file-name (concat doom-cache-dir "autosave")
|
auto-save-list-file-name (concat doom-cache-dir "autosave")
|
||||||
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/")))
|
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/")))
|
||||||
custom-file (concat doom-etc-dir "custom.el")
|
custom-file (concat doom-etc-dir "custom.el")
|
||||||
pcache-directory (concat doom-cache-dir "pcache/")
|
|
||||||
mc/list-file (concat doom-etc-dir "mc-lists.el")
|
mc/list-file (concat doom-etc-dir "mc-lists.el")
|
||||||
|
pcache-directory (concat doom-cache-dir "pcache/")
|
||||||
|
request-storage-directory (concat doom-cache-dir "request")
|
||||||
server-auth-dir (concat doom-cache-dir "server/")
|
server-auth-dir (concat doom-cache-dir "server/")
|
||||||
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
|
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
|
||||||
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")
|
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")
|
||||||
|
|
|
@ -48,7 +48,7 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
ivy-use-selectable-prompt t)
|
ivy-use-selectable-prompt t)
|
||||||
|
|
||||||
(after! magit (setq magit-completing-read-function #'ivy-completing-read))
|
(after! magit (setq magit-completing-read-function #'ivy-completing-read))
|
||||||
(after! yasnippet (cl-pushnew #'+ivy-yas-prompt yas-prompt-functions :test #'eq))
|
(after! yasnippet (add-to-list 'yas-prompt-functions #'+ivy-yas-prompt #'eq))
|
||||||
|
|
||||||
(map! [remap switch-to-buffer] #'ivy-switch-buffer
|
(map! [remap switch-to-buffer] #'ivy-switch-buffer
|
||||||
[remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer
|
[remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer
|
||||||
|
@ -94,6 +94,8 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
(set! :popup "^\\*ivy-occur" '((size . 0.35)) '((transient . 0) (quit)))
|
(set! :popup "^\\*ivy-occur" '((size . 0.35)) '((transient . 0) (quit)))
|
||||||
|
|
||||||
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)"
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)"
|
||||||
|
;; Add smart-casing and compressed archive searching (-zS) to default
|
||||||
|
;; command arguments:
|
||||||
counsel-rg-base-command "rg -zS --no-heading --line-number --color never %s ."
|
counsel-rg-base-command "rg -zS --no-heading --line-number --color never %s ."
|
||||||
counsel-ag-base-command "ag -zS --nocolor --nogroup %s"
|
counsel-ag-base-command "ag -zS --nocolor --nogroup %s"
|
||||||
counsel-pt-base-command "pt -zS --nocolor --nogroup -e %s")
|
counsel-pt-base-command "pt -zS --nocolor --nogroup -e %s")
|
||||||
|
@ -187,8 +189,7 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
|
|
||||||
|
|
||||||
(def-package! ivy-posframe
|
(def-package! ivy-posframe
|
||||||
:when EMACS26+
|
:when (and EMACS26+ (featurep! +childframe))
|
||||||
:when (featurep! +childframe)
|
|
||||||
:hook (ivy-mode . ivy-posframe-enable)
|
:hook (ivy-mode . ivy-posframe-enable)
|
||||||
:preface
|
:preface
|
||||||
;; This function searches the entire `obarray' just to populate
|
;; This function searches the entire `obarray' just to populate
|
||||||
|
@ -196,6 +197,12 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
;; wasteful, so...
|
;; wasteful, so...
|
||||||
(advice-add #'ivy-posframe-setup :override #'ignore)
|
(advice-add #'ivy-posframe-setup :override #'ignore)
|
||||||
:config
|
:config
|
||||||
|
(setq ivy-height 16
|
||||||
|
ivy-fixed-height-minibuffer nil
|
||||||
|
ivy-posframe-parameters `((min-width . 90)
|
||||||
|
(min-height . ,ivy-height)
|
||||||
|
(internal-border-width . 10)))
|
||||||
|
|
||||||
;; ... let's do it manually
|
;; ... let's do it manually
|
||||||
(dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
|
(dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
|
||||||
'ivy-posframe-display-at-frame-center
|
'ivy-posframe-display-at-frame-center
|
||||||
|
@ -211,10 +218,4 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
|
|
||||||
;; posframe doesn't work well with async sources
|
;; posframe doesn't work well with async sources
|
||||||
(dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep))
|
(dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep))
|
||||||
(map-put ivy-display-functions-alist fn nil))
|
(map-put ivy-display-functions-alist fn nil)))
|
||||||
|
|
||||||
(setq ivy-height 16
|
|
||||||
ivy-fixed-height-minibuffer nil
|
|
||||||
ivy-posframe-parameters `((min-width . 90)
|
|
||||||
(min-height . ,ivy-height)
|
|
||||||
(internal-border-width . 10))))
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ the new algorithm is confusing, like in python or ruby."
|
||||||
fn '((:default . evil-mc-execute-default-call))))
|
fn '((:default . evil-mc-execute-default-call))))
|
||||||
|
|
||||||
;; disable evil-escape in evil-mc; causes unwanted text on invocation
|
;; disable evil-escape in evil-mc; causes unwanted text on invocation
|
||||||
(cl-pushnew 'evil-escape-mode evil-mc-incompatible-minor-modes :test #'eq)
|
(add-to-list 'evil-mc-incompatible-minor-modes 'evil-escape-mode #'eq)
|
||||||
|
|
||||||
(defun +evil|escape-multiple-cursors ()
|
(defun +evil|escape-multiple-cursors ()
|
||||||
"Clear evil-mc cursors and restore state."
|
"Clear evil-mc cursors and restore state."
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
:after clojure-mode
|
:after clojure-mode
|
||||||
:config
|
:config
|
||||||
;; setup some extra namespace auto completion for great awesome
|
;; setup some extra namespace auto completion for great awesome
|
||||||
(nconc cljr-magic-require-namespaces
|
(dolist (ns '(("re-frame" . "re-frame.core")
|
||||||
'(("re-frame" . "re-frame.core")
|
("reagent" . "reagent.core")
|
||||||
("reagent" . "reagent.core")
|
("str" . "clojure.string")))
|
||||||
("str" . "clojure.string"))))
|
(map-put cljr-magic-require-namespaces (car ns) (cdr ns))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! cider
|
(def-package! cider
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
(def-package! flycheck-crystal
|
(def-package! flycheck-crystal
|
||||||
|
:when (featurep! :feature syntax-checker)
|
||||||
:after crystal-mode
|
:after crystal-mode
|
||||||
:config (add-hook 'crystal-mode-hook #'flycheck-mode))
|
:config (add-hook 'crystal-mode-hook #'flycheck-mode))
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
:when (featurep! :completion company)
|
:when (featurep! :completion company)
|
||||||
:after elixir-mode
|
:after elixir-mode
|
||||||
:config
|
:config
|
||||||
;; Let Doom handle this
|
;; Alchemist doesn't use hook symbols to add these backends, so we have to use
|
||||||
|
;; the entire closure to get rid of it.
|
||||||
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
|
(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))
|
||||||
|
|
|
@ -57,9 +57,7 @@
|
||||||
(defun +emacs-lisp|init-flycheck ()
|
(defun +emacs-lisp|init-flycheck ()
|
||||||
"Initialize flycheck-mode if not in emacs.d."
|
"Initialize flycheck-mode if not in emacs.d."
|
||||||
(when (and buffer-file-name
|
(when (and buffer-file-name
|
||||||
(not (cl-loop for dir in (append (list doom-emacs-dir)
|
(not (cl-loop for dir in (list doom-emacs-dir doom-private-dir)
|
||||||
doom-modules-dirs
|
|
||||||
doom-psuedo-module-dirs)
|
|
||||||
if (file-in-directory-p buffer-file-name dir)
|
if (file-in-directory-p buffer-file-name dir)
|
||||||
return t)))
|
return t)))
|
||||||
(flycheck-mode +1))))
|
(flycheck-mode +1))))
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
|
("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
|
||||||
:init
|
:init
|
||||||
(unless (featurep! :lang julia)
|
(unless (featurep! :lang julia)
|
||||||
(push (cons "\\.jl\\'" 'ess-julia-mode) auto-mode-alist))
|
(map-put auto-mode-alist "\\.jl\'" 'ess-julia-mode))
|
||||||
:config
|
:config
|
||||||
(add-hook 'ess-mode-hook #'doom|enable-line-numbers)
|
(add-hook 'ess-mode-hook #'doom|enable-line-numbers)
|
||||||
(setq ess-offset-continued 'straight
|
(setq ess-offset-continued 'straight
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
markdown-hide-urls nil) ; trigger with `markdown-toggle-url-hiding'
|
markdown-hide-urls nil) ; trigger with `markdown-toggle-url-hiding'
|
||||||
|
|
||||||
:config
|
:config
|
||||||
|
(defun +markdown|set-fill-column-and-line-spacing ()
|
||||||
|
(setq-local line-spacing 2)
|
||||||
|
(setq-local fill-column 80))
|
||||||
|
(add-hook 'markdown-mode-hook #'+markdown|set-fill-column-and-line-spacing)
|
||||||
(add-hook 'markdown-mode-hook #'auto-fill-mode)
|
(add-hook 'markdown-mode-hook #'auto-fill-mode)
|
||||||
(setq-hook! 'markdown-mode-hook
|
|
||||||
line-spacing 2
|
|
||||||
fill-column 80)
|
|
||||||
|
|
||||||
(map! (:map markdown-mode-map
|
(map! (:map markdown-mode-map
|
||||||
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
||||||
|
|
|
@ -102,7 +102,6 @@ environment variables."
|
||||||
:after anaconda-mode
|
:after anaconda-mode
|
||||||
:config
|
:config
|
||||||
(map! :map anaconda-mode-map
|
(map! :map anaconda-mode-map
|
||||||
:n "gf" nil
|
|
||||||
:localleader
|
:localleader
|
||||||
:prefix "f"
|
:prefix "f"
|
||||||
:nv "d" #'anaconda-mode-find-definitions
|
:nv "d" #'anaconda-mode-find-definitions
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
|
|
||||||
"M-/" #'web-mode-comment-or-uncomment
|
"M-/" #'web-mode-comment-or-uncomment
|
||||||
:i "SPC" #'self-insert-command
|
:i "SPC" #'self-insert-command
|
||||||
:n "M-r" #'doom/web-refresh-browser
|
|
||||||
:n "za" #'web-mode-fold-or-unfold
|
:n "za" #'web-mode-fold-or-unfold
|
||||||
:nv "]a" #'web-mode-attribute-next
|
:nv "]a" #'web-mode-attribute-next
|
||||||
:nv "[a" #'web-mode-attribute-previous
|
:nv "[a" #'web-mode-attribute-previous
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
|
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
|
||||||
#'+nav-flash/blink-cursor)
|
#'+nav-flash/blink-cursor)
|
||||||
|
|
||||||
|
;; `saveplace'
|
||||||
(advice-add #'save-place-find-file-hook :after #'+nav-flash/blink-cursor)
|
(advice-add #'save-place-find-file-hook :after #'+nav-flash/blink-cursor)
|
||||||
|
|
||||||
(after! evil
|
;; `evil'
|
||||||
(advice-add #'evil-window-top :after #'+nav-flash/blink-cursor)
|
(advice-add #'evil-window-top :after #'+nav-flash/blink-cursor)
|
||||||
(advice-add #'evil-window-middle :after #'+nav-flash/blink-cursor)
|
(advice-add #'evil-window-middle :after #'+nav-flash/blink-cursor)
|
||||||
(advice-add #'evil-window-bottom :after #'+nav-flash/blink-cursor)))
|
(advice-add #'evil-window-bottom :after #'+nav-flash/blink-cursor))
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
`((side . ,neo-window-position) (size . ,neo-window-width))
|
`((side . ,neo-window-position) (size . ,neo-window-width))
|
||||||
'((quit . current) (select . t)))
|
'((quit . current) (select . t)))
|
||||||
|
|
||||||
(when (bound-and-true-p winner-mode)
|
(after! winner
|
||||||
(push neo-buffer-name winner-boring-buffers))
|
(cl-pushnew neo-buffer-name winner-boring-buffers))
|
||||||
|
|
||||||
;; The cursor always sits at bol. `+neotree*fix-cursor' and
|
;; The cursor always sits at bol. `+neotree*fix-cursor' and
|
||||||
;; `+neotree*indent-cursor' change that behavior, so that the cursor is always
|
;; `+neotree*indent-cursor' change that behavior, so that the cursor is always
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
;;; ui/window-select/packages.el
|
;;; ui/window-select/packages.el
|
||||||
|
|
||||||
(cond ((featurep! +switch-window)
|
(cond ((featurep! +switch-window)
|
||||||
;; Install switch-window if the user indicated the '+switch-window' module flag
|
;; Install switch-window if the user indicated the '+switch-window'
|
||||||
|
;; module flag
|
||||||
(package! switch-window))
|
(package! switch-window))
|
||||||
((or (featurep! +ace-window) t)
|
((or (featurep! +ace-window) t)
|
||||||
;; Install ace-window if the user selects the flag '+ace-window' or by default
|
;; Install ace-window if the user selects the flag '+ace-window' or by
|
||||||
;; ... if the user did not specify a module flag
|
;; default ... if the user did not specify a module flag
|
||||||
(package! ace-window)))
|
(package! ace-window)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue