General refactor for consistency & idempotency

Also updated comments
This commit is contained in:
Henrik Lissner 2018-05-18 01:21:09 +02:00
parent 50401f6c09
commit 80adb9c1f6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
17 changed files with 48 additions and 40 deletions

View file

@ -1,6 +1,5 @@
;;; core/autoload/ui.el -*- lexical-binding: t; -*-
(defvar doom--line-number-style doom-line-numbers-style)
;;;###autoload
(defun doom/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."
(interactive)
(defvar doom--line-number-style doom-line-numbers-style)
(let* ((styles '(t relative nil))
(order (cons doom-line-numbers-style (delq doom-line-numbers-style styles)))
(queue (memq doom--line-number-style order))

View file

@ -225,7 +225,7 @@ Body forms can access the hook's arguments through the let-bound variable
(,mode 1)))
,@(if (and modes (listp 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))))))
(match
`(map-put doom-auto-minor-mode-alist ,match ',mode))

View file

@ -419,11 +419,17 @@ added, if the file exists."
;;
;; Module config macros
;; Use-package modifications
;;
(autoload 'use-package "use-package" nil nil 'macro)
;;
;; Module config macros
;;
(defmacro doom! (&rest modules)
"Bootstraps DOOM Emacs and its modules.

View file

@ -67,8 +67,7 @@ XDG directory conventions if ~/.config/doom exists.")
(setq-default
ad-redefinition-action 'accept ; silence advised function warnings
apropos-do-all t ; make `apropos' more useful
debug-on-error (and (not noninteractive) doom-debug-mode)
load-prefer-newer noninteractive
debug-on-error doom-debug-mode
ffap-machine-p-known 'reject ; don't ping things that look like domain names
idle-update-delay 2 ; update ui less often
;; 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")
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/")))
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")
pcache-directory (concat doom-cache-dir "pcache/")
request-storage-directory (concat doom-cache-dir "request")
server-auth-dir (concat doom-cache-dir "server/")
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")

View file

@ -48,7 +48,7 @@ immediately runs it on the current candidate (ending the ivy session)."
ivy-use-selectable-prompt t)
(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
[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)))
(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-ag-base-command "ag -zS --nocolor --nogroup %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
:when EMACS26+
:when (featurep! +childframe)
:when (and EMACS26+ (featurep! +childframe))
:hook (ivy-mode . ivy-posframe-enable)
:preface
;; 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...
(advice-add #'ivy-posframe-setup :override #'ignore)
: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
(dolist (fn (list 'ivy-posframe-display-at-frame-bottom-left
'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
(dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep))
(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))))
(map-put ivy-display-functions-alist fn nil)))

View file

@ -311,7 +311,7 @@ the new algorithm is confusing, like in python or ruby."
fn '((:default . evil-mc-execute-default-call))))
;; 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 ()
"Clear evil-mc cursors and restore state."

View file

@ -14,10 +14,10 @@
:after clojure-mode
:config
;; setup some extra namespace auto completion for great awesome
(nconc cljr-magic-require-namespaces
'(("re-frame" . "re-frame.core")
("reagent" . "reagent.core")
("str" . "clojure.string"))))
(dolist (ns '(("re-frame" . "re-frame.core")
("reagent" . "reagent.core")
("str" . "clojure.string")))
(map-put cljr-magic-require-namespaces (car ns) (cdr ns))))
(def-package! cider

View file

@ -14,6 +14,7 @@
(def-package! flycheck-crystal
:when (featurep! :feature syntax-checker)
:after crystal-mode
:config (add-hook 'crystal-mode-hook #'flycheck-mode))

View file

@ -32,7 +32,8 @@
:when (featurep! :completion company)
:after elixir-mode
: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)))))
(remove-hook 'alchemist-mode-hook fn)
(remove-hook 'alchemist-iex-mode-hook fn))

View file

@ -57,9 +57,7 @@
(defun +emacs-lisp|init-flycheck ()
"Initialize flycheck-mode if not in emacs.d."
(when (and buffer-file-name
(not (cl-loop for dir in (append (list doom-emacs-dir)
doom-modules-dirs
doom-psuedo-module-dirs)
(not (cl-loop for dir in (list doom-emacs-dir doom-private-dir)
if (file-in-directory-p buffer-file-name dir)
return t)))
(flycheck-mode +1))))

View file

@ -31,7 +31,7 @@
("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
:init
(unless (featurep! :lang julia)
(push (cons "\\.jl\\'" 'ess-julia-mode) auto-mode-alist))
(map-put auto-mode-alist "\\.jl\'" 'ess-julia-mode))
:config
(add-hook 'ess-mode-hook #'doom|enable-line-numbers)
(setq ess-offset-continued 'straight

View file

@ -15,10 +15,11 @@
markdown-hide-urls nil) ; trigger with `markdown-toggle-url-hiding'
: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)
(setq-hook! 'markdown-mode-hook
line-spacing 2
fill-column 80)
(map! (:map markdown-mode-map
[remap find-file-at-point] #'markdown-follow-thing-at-point

View file

@ -102,7 +102,6 @@ environment variables."
:after anaconda-mode
:config
(map! :map anaconda-mode-map
:n "gf" nil
:localleader
:prefix "f"
:nv "d" #'anaconda-mode-find-definitions

View file

@ -82,7 +82,6 @@
"M-/" #'web-mode-comment-or-uncomment
:i "SPC" #'self-insert-command
:n "M-r" #'doom/web-refresh-browser
:n "za" #'web-mode-fold-or-unfold
:nv "]a" #'web-mode-attribute-next
:nv "[a" #'web-mode-attribute-previous

View file

@ -11,10 +11,11 @@
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
#'+nav-flash/blink-cursor)
;; `saveplace'
(advice-add #'save-place-find-file-hook :after #'+nav-flash/blink-cursor)
(after! evil
(advice-add #'evil-window-top :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)))
;; `evil'
(advice-add #'evil-window-top :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))

View file

@ -38,8 +38,8 @@
`((side . ,neo-window-position) (size . ,neo-window-width))
'((quit . current) (select . t)))
(when (bound-and-true-p winner-mode)
(push neo-buffer-name winner-boring-buffers))
(after! winner
(cl-pushnew neo-buffer-name winner-boring-buffers))
;; The cursor always sits at bol. `+neotree*fix-cursor' and
;; `+neotree*indent-cursor' change that behavior, so that the cursor is always

View file

@ -2,10 +2,11 @@
;;; ui/window-select/packages.el
(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))
((or (featurep! +ace-window) t)
;; Install ace-window if the user selects the flag '+ace-window' or by default
;; ... if the user did not specify a module flag
;; Install ace-window if the user selects the flag '+ace-window' or by
;; default ... if the user did not specify a module flag
(package! ace-window)))