PRAISE BE TO THE BYTE COMPILER FOR THY SHARP QUOTES
This commit is contained in:
parent
ef88d30b73
commit
5ae94b765c
79 changed files with 798 additions and 795 deletions
|
@ -53,7 +53,7 @@ the current workspace."
|
|||
(buffer-list)))
|
||||
(project-root (and project-p (doom-project-root t))))
|
||||
(if project-root
|
||||
(funcall (if (eq project-p 'not) 'cl-remove-if 'cl-remove-if-not)
|
||||
(funcall (if (eq project-p 'not) #'cl-remove-if #'cl-remove-if-not)
|
||||
(lambda (b) (projectile-project-buffer-p b project-root))
|
||||
buffers)
|
||||
buffers)))
|
||||
|
@ -62,7 +62,7 @@ the current workspace."
|
|||
(defun doom-real-buffers-list (&optional buffer-list)
|
||||
"Get a list of all buffers (in the current workspace OR in BUFFER-LIST) that
|
||||
`doom-real-buffer-p' returns non-nil for."
|
||||
(cl-remove-if-not 'doom-real-buffer-p (or buffer-list (doom-buffer-list))))
|
||||
(cl-remove-if-not #'doom-real-buffer-p (or buffer-list (doom-buffer-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-buffers-in-mode (modes &optional buffer-list)
|
||||
|
@ -76,19 +76,19 @@ the current workspace."
|
|||
(defun doom-visible-windows (&optional window-list)
|
||||
"Get a list of the visible windows in the current frame (that aren't popups),
|
||||
OR return only the visible windows in WINDOW-LIST."
|
||||
(cl-remove-if 'doom-popup-p (or window-list (window-list))))
|
||||
(cl-remove-if #'doom-popup-p (or window-list (window-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-visible-buffers (&optional buffer-list)
|
||||
"Get a list of unburied buffers in the current project and workspace, OR
|
||||
return only the unburied buffers in BUFFER-LIST (a list of BUFFER-OR-NAMEs)."
|
||||
(cl-remove-if-not 'get-buffer-window (or buffer-list (doom-buffer-list))))
|
||||
(cl-remove-if-not #'get-buffer-window (or buffer-list (doom-buffer-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-buried-buffers (&optional buffer-list)
|
||||
"Get a list of buried buffers in the current project and workspace, OR return
|
||||
only the buried buffers in BUFFER-LIST (a list of BUFFER-OR-NAMEs)."
|
||||
(cl-remove-if 'get-buffer-window (or buffer-list (doom-buffer-list))))
|
||||
(cl-remove-if #'get-buffer-window (or buffer-list (doom-buffer-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-matching-buffers (pattern &optional buffer-list)
|
||||
|
@ -109,7 +109,7 @@ buffers. If there's nothing left, switch to `doom-fallback-buffer'. See
|
|||
((= (length buffers) 1)
|
||||
(set-window-buffer nil (car buffers)))
|
||||
(t
|
||||
(let ((move-func (if (> n 0) 'switch-to-next-buffer 'switch-to-prev-buffer)))
|
||||
(let ((move-func (if (> n 0) #'switch-to-next-buffer #'switch-to-prev-buffer)))
|
||||
;; Why this instead of switching straight to the Nth buffer in
|
||||
;; BUFFERS? Because `switch-to-next-buffer' and
|
||||
;; `switch-to-prev-buffer' properly update buffer list order.
|
||||
|
@ -202,7 +202,7 @@ See `doom-real-buffer-p' for what 'real' means."
|
|||
"Kill all buffers (in current workspace OR in BUFFER-LIST) that match the
|
||||
regex PATTERN. Returns the number of killed buffers."
|
||||
(let ((buffers (doom-matching-buffers pattern buffer-list)))
|
||||
(mapc 'doom-kill-buffer buffers)
|
||||
(mapc #'doom-kill-buffer buffers)
|
||||
(length buffers)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -218,7 +218,7 @@ regex PATTERN. Returns the number of killed buffers."
|
|||
belong to the current project in this workspace."
|
||||
(interactive "P")
|
||||
(let ((buffers (doom-buffer-list project-p)))
|
||||
(mapc 'doom-kill-buffer-and-windows buffers)
|
||||
(mapc #'doom-kill-buffer-and-windows buffers)
|
||||
(when (called-interactively-p 'interactive)
|
||||
(message "Killed %s buffers" (length buffers)))))
|
||||
|
||||
|
@ -250,7 +250,7 @@ exclude buffers that aren't part of the current project."
|
|||
"Clean up buried and process buffers in the current workspace."
|
||||
(interactive "P")
|
||||
(let ((buffers (doom-buried-buffers (if all-p (buffer-list)))))
|
||||
(mapc 'kill-buffer buffers)
|
||||
(mapc #'kill-buffer buffers)
|
||||
(setq n (+ (doom-kill-process-buffers) (length buffers)))
|
||||
(when (called-interactively-p 'interactive)
|
||||
(message "Cleaned up %s buffers" n))))
|
||||
|
|
|
@ -37,7 +37,7 @@ If already there, do nothing."
|
|||
(skip-chars-backward " " bol)
|
||||
(point))))
|
||||
eol))
|
||||
(goto-char-fn (if (featurep 'evil) 'evil-goto-char 'goto-char)))
|
||||
(goto-char-fn (if (featurep 'evil) #'evil-goto-char #'goto-char)))
|
||||
(if (= eoc point)
|
||||
(funcall goto-char-fn eol)
|
||||
(unless (= eol point)
|
||||
|
@ -64,7 +64,7 @@ If already there, do nothing."
|
|||
"Dedents the current line."
|
||||
(interactive)
|
||||
(if indent-tabs-mode
|
||||
(call-interactively 'backward-delete-char)
|
||||
(call-interactively #'backward-delete-char)
|
||||
(save-excursion
|
||||
(unless (looking-back "^[\s\t]*" (line-beginning-position))
|
||||
(doom--goto-first-non-blank))
|
||||
|
@ -78,7 +78,7 @@ If already there, do nothing."
|
|||
afterwards, kill line to column 1."
|
||||
(interactive)
|
||||
(let ((empty-line (save-excursion (beginning-of-line) (looking-at-p "[ \t]*$"))))
|
||||
(funcall (if (featurep 'evil) 'evil-delete 'delete-region)
|
||||
(funcall (if (featurep 'evil) #'evil-delete #'delete-region)
|
||||
(point-at-bol) (point))
|
||||
(unless empty-line
|
||||
(indent-according-to-mode))))
|
||||
|
@ -113,9 +113,9 @@ possible, or just one char if that's not possible."
|
|||
(if (string-match "\\w*\\(\\s-+\\)$"
|
||||
(buffer-substring-no-properties (max (point-min) (- p movement)) p))
|
||||
(delete-char (- 0 (- (match-end 1) (match-beginning 1))))
|
||||
(call-interactively 'delete-backward-char)))))
|
||||
(call-interactively #'delete-backward-char)))))
|
||||
;; Otherwise do a regular delete
|
||||
(t (call-interactively 'delete-backward-char)))))
|
||||
(t (call-interactively #'delete-backward-char)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/inflate-space-maybe ()
|
||||
|
@ -123,9 +123,9 @@ possible, or just one char if that's not possible."
|
|||
space on either side of the point if so."
|
||||
(interactive)
|
||||
(if (doom--surrounded-p)
|
||||
(progn (call-interactively 'self-insert-command)
|
||||
(save-excursion (call-interactively 'self-insert-command)))
|
||||
(call-interactively 'self-insert-command)))
|
||||
(progn (call-interactively #'self-insert-command)
|
||||
(save-excursion (call-interactively #'self-insert-command)))
|
||||
(call-interactively #'self-insert-command)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/deflate-space-maybe ()
|
||||
|
@ -137,12 +137,12 @@ spaces on either side of the point if so. Resorts to
|
|||
(if (doom--surrounded-p)
|
||||
(let ((whitespace-match (match-string 1)))
|
||||
(cond ((not whitespace-match)
|
||||
(call-interactively 'delete-backward-char))
|
||||
(call-interactively #'delete-backward-char))
|
||||
((string-match "\n" whitespace-match)
|
||||
(funcall (if (featurep 'evil) 'evil-delete 'delete-region)
|
||||
(funcall (if (featurep 'evil) #'evil-delete #'delete-region)
|
||||
(point-at-bol) (point))
|
||||
(call-interactively 'delete-backward-char)
|
||||
(save-excursion (call-interactively 'delete-char)))
|
||||
(call-interactively #'delete-backward-char)
|
||||
(save-excursion (call-interactively #'delete-char)))
|
||||
(t (just-one-space 0))))
|
||||
(doom/backward-delete-whitespace-to-column))))
|
||||
|
||||
|
@ -155,7 +155,7 @@ from a commented line."
|
|||
(newline))
|
||||
((sp-point-in-comment)
|
||||
(cond ((memq major-mode '(js2-mode rjsx-mode))
|
||||
(call-interactively 'js2-line-break))
|
||||
(call-interactively #'js2-line-break))
|
||||
((memq major-mode '(java-mode php-mode))
|
||||
(c-indent-new-comment-line))
|
||||
((memq major-mode '(c-mode c++-mode objc-mode css-mode scss-mode js2-mode))
|
||||
|
|
|
@ -44,7 +44,7 @@ interactive session."
|
|||
(lambda (rule)
|
||||
`(,(car rule)
|
||||
(lambda (message &rest args)
|
||||
(apply 'doom-ansi-apply ',(car rule) message args))))
|
||||
(apply #'doom-ansi-apply ',(car rule) message args))))
|
||||
(append doom-message-fg doom-message-bg doom-message-fx))
|
||||
(color (symbol-function 'doom-ansi-apply)))
|
||||
(format ,message ,@args)))
|
||||
|
@ -73,6 +73,6 @@ interactive session."
|
|||
(assq code doom-message-fx))))
|
||||
(format "\e[%dm%s\e[%dm"
|
||||
(cdr rule)
|
||||
(apply 'format format args)
|
||||
(apply #'format format args)
|
||||
0)))
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@ Be careful not to use it in a loop."
|
|||
(or (assq pkgsym doom-packages)
|
||||
(list (car (assq pkgsym package-alist)))))
|
||||
(cl-delete-duplicates
|
||||
(append doom-core-packages (mapcar 'car doom-packages))))))
|
||||
(append doom-core-packages (mapcar #'car doom-packages))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-get-depending-on (name)
|
||||
"Return a list of packages that depend on the package named NAME."
|
||||
(doom-initialize)
|
||||
(when-let (desc (cadr (assq name package-alist)))
|
||||
(mapcar 'package-desc-name (package--used-elsewhere-p desc nil t))))
|
||||
(mapcar #'package-desc-name (package--used-elsewhere-p desc nil t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-get-dependencies-for (name &optional only)
|
||||
|
@ -97,7 +97,7 @@ Be careful not to use it in a loop."
|
|||
containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST).
|
||||
|
||||
Used by `doom/packages-update'."
|
||||
(delq nil (mapcar 'doom-package-outdated-p (mapcar 'car (doom-get-packages)))))
|
||||
(delq nil (mapcar #'doom-package-outdated-p (mapcar #'car (doom-get-packages)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-get-orphaned-packages ()
|
||||
|
@ -107,7 +107,7 @@ depended on.
|
|||
Used by `doom/packages-autoremove'."
|
||||
(doom-initialize-packages t)
|
||||
(let ((package-selected-packages
|
||||
(append (mapcar 'car doom-packages) doom-core-packages)))
|
||||
(append (mapcar #'car doom-packages) doom-core-packages)))
|
||||
(cl-set-difference (package--removable-packages)
|
||||
doom-protected-packages)))
|
||||
|
||||
|
@ -158,7 +158,7 @@ example; the package name can be omitted)."
|
|||
(recipe (plist-get plist :recipe)))
|
||||
(cond (recipe (quelpa recipe))
|
||||
(t (package-install name))))
|
||||
(cl-pushnew (cons name plist) doom-packages :test 'eq :key 'car)
|
||||
(cl-pushnew (cons name plist) doom-packages :test #'eq :key #'car)
|
||||
(package-installed-p name))
|
||||
|
||||
(defun doom-update-package (name)
|
||||
|
@ -219,7 +219,7 @@ appropriate."
|
|||
(if (plist-get (cdr pkg) :recipe)
|
||||
"QUELPA"
|
||||
"ELPA")))
|
||||
(sort (cl-copy-list packages) 'doom--sort-alpha)
|
||||
(sort (cl-copy-list packages) #'doom--sort-alpha)
|
||||
"\n")))))
|
||||
(message! (yellow "Aborted!")))
|
||||
|
||||
|
@ -249,7 +249,7 @@ appropriate."
|
|||
(defun doom/packages-update ()
|
||||
"Interactive command for updating packages."
|
||||
(interactive)
|
||||
(let ((packages (sort (doom-get-outdated-packages) 'doom--sort-alpha)))
|
||||
(let ((packages (sort (doom-get-outdated-packages) #'doom--sort-alpha)))
|
||||
(cond ((not packages)
|
||||
(message! (green "Everything is up-to-date")))
|
||||
|
||||
|
@ -299,7 +299,7 @@ appropriate."
|
|||
(format "%s packages will be deleted:\n\n%s\n\nProceed?"
|
||||
(length packages)
|
||||
(mapconcat (lambda (sym) (format "+ %s" (symbol-name sym)))
|
||||
(sort (cl-copy-list packages) 'string-lessp)
|
||||
(sort (cl-copy-list packages) #'string-lessp)
|
||||
"\n")))))
|
||||
(message! (yellow "Aborted!")))
|
||||
|
||||
|
@ -319,7 +319,7 @@ appropriate."
|
|||
(doom/reload)))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'doom/install-package 'package-install)
|
||||
(defalias 'doom/install-package #'package-install)
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/delete-package (package)
|
||||
|
@ -332,7 +332,7 @@ Use this interactively. Use `doom-delete-package' for direct calls."
|
|||
"Delete package: "
|
||||
(delq nil
|
||||
(mapcar (lambda (p) (unless (package-built-in-p p) p))
|
||||
(mapcar 'car package-alist)))
|
||||
(mapcar #'car package-alist)))
|
||||
nil t))))
|
||||
(if (package-installed-p package)
|
||||
(if (y-or-n-p (format "%s will be deleted. Confirm?" package))
|
||||
|
@ -352,7 +352,7 @@ calls."
|
|||
(let ((packages (doom-get-outdated-packages)))
|
||||
(list
|
||||
(if packages
|
||||
(completing-read "Update package: " (mapcar 'symbol-name (mapcar 'car packages)))
|
||||
(completing-read "Update package: " (mapcar #'symbol-name (mapcar #'car packages)))
|
||||
(user-error "All packages are up-to-date")))))
|
||||
(if-let (desc (doom-package-outdated-p (intern package)))
|
||||
(if (y-or-n-p (format "%s will be updated from %s to %s. Update?"
|
||||
|
|
|
@ -35,7 +35,7 @@ possible rules."
|
|||
;;;###autoload
|
||||
(defun doom-popup-windows ()
|
||||
"Get a list of open poups."
|
||||
(cl-remove-if-not 'doom-popup-p (window-list)))
|
||||
(cl-remove-if-not #'doom-popup-p (window-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/popup-restore ()
|
||||
|
@ -54,7 +54,7 @@ Returns t if popups were restored, nil otherwise."
|
|||
(rules (plist-get (cdr spec) :rules)))
|
||||
(when (and (not buffer) path)
|
||||
(setq buffer (find-file-noselect path t)))
|
||||
(when (and buffer (apply 'doom-popup-buffer buffer rules) (not any-p))
|
||||
(when (and buffer (apply #'doom-popup-buffer buffer rules) (not any-p))
|
||||
(setq any-p t))))
|
||||
(when any-p
|
||||
(setq doom-popup-history '()))
|
||||
|
@ -90,7 +90,7 @@ only close popups that have an :autoclose property in their rule (see
|
|||
(interactive)
|
||||
(let ((orig-win (selected-window)))
|
||||
(when-let (popups (doom-popup-windows))
|
||||
(setq doom-popup-history (mapcar 'doom--popup-data popups))
|
||||
(setq doom-popup-history (mapcar #'doom--popup-data popups))
|
||||
(let (doom-popup-remember-history)
|
||||
(dolist (window popups)
|
||||
(let ((rules (window-parameter window 'popup)))
|
||||
|
@ -107,8 +107,8 @@ only close popups that have an :autoclose property in their rule (see
|
|||
(let ((window (selected-window)))
|
||||
(if (window-parameter window :noesc)
|
||||
(call-interactively (if (featurep 'evil)
|
||||
'evil-force-normal-state
|
||||
'keyboard-escape-quit))
|
||||
#'evil-force-normal-state
|
||||
#'keyboard-escape-quit))
|
||||
(delete-window window))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
"Runs a shell command and prints any output to the DOOM buffer."
|
||||
(let ((cmd-list (split-string command " ")))
|
||||
(cond ((equal (car cmd-list) "sudo")
|
||||
(apply 'doom-sudo (s-join " " (cdr cmd-list)) args))
|
||||
(apply #'doom-sudo (string-join (cdr cmd-list) " ") args))
|
||||
((let ((bin (executable-find "npm")))
|
||||
(and (file-exists-p bin)
|
||||
(not (file-writable-p bin))))
|
||||
(apply 'doom-sudo (s-join " " cmd-list) args))
|
||||
(apply #'doom-sudo (string-join cmd-list " ") args))
|
||||
(t
|
||||
(princ (shell-command-to-string (apply 'format command args)))))))
|
||||
(princ (shell-command-to-string (apply #'format command args)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-sudo (command &rest args)
|
||||
|
@ -37,7 +37,7 @@
|
|||
(with-current-buffer (get-buffer-create "*doom-sudo*")
|
||||
(unless (string-prefix-p "/sudo::/" default-directory)
|
||||
(cd "/sudo::/"))
|
||||
(princ (shell-command-to-string (apply 'format command args))))))
|
||||
(princ (shell-command-to-string (apply #'format command args))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-fetch (fetcher location dest)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
(interactive)
|
||||
(let ((theme (car-safe custom-enabled-themes)))
|
||||
(when theme
|
||||
(mapc 'disable-theme custom-enabled-themes))
|
||||
(mapc #'disable-theme custom-enabled-themes))
|
||||
(load-theme theme t)))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
;; Ediff
|
||||
(add-hook! ediff-load
|
||||
(setq ediff-diff-options "-w"
|
||||
ediff-split-window-function 'split-window-horizontally
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain)) ; no extra frames
|
||||
ediff-split-window-function #'split-window-horizontally
|
||||
ediff-window-setup-function #'ediff-setup-windows-plain)) ; no extra frames
|
||||
|
||||
;; revert buffers for changed files
|
||||
(global-auto-revert-mode 1)
|
||||
|
@ -71,7 +71,7 @@
|
|||
(defun doom|dont-kill-scratch-buffer ()
|
||||
(or (not (eq (buffer-name) "*scratch*"))
|
||||
(ignore (bury-buffer))))
|
||||
(add-hook 'kill-buffer-query-functions 'doom|dont-kill-scratch-buffer)
|
||||
(add-hook 'kill-buffer-query-functions #'doom|dont-kill-scratch-buffer)
|
||||
|
||||
;; enabled by default in Emacs 25+. No thanks.
|
||||
(electric-indent-mode -1)
|
||||
|
@ -86,7 +86,7 @@
|
|||
(when (and (if (featurep 'evil) (evil-insert-state-p) t)
|
||||
(string-match-p "^[\s\t]*$" linestr))
|
||||
(insert linestr))))
|
||||
(advice-add 'delete-trailing-whitespace :around 'doom*delete-trailing-whitespace)
|
||||
(advice-add #'delete-trailing-whitespace :around #'doom*delete-trailing-whitespace)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -129,8 +129,8 @@
|
|||
(smartparens-global-mode 1)
|
||||
(require 'smartparens-config)
|
||||
;; Smartparens interferes with Replace mode
|
||||
(add-hook 'evil-replace-state-entry-hook 'turn-off-smartparens-mode)
|
||||
(add-hook 'evil-replace-state-exit-hook 'turn-on-smartparens-mode)
|
||||
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
|
||||
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
|
||||
;; Auto-close more conservatively
|
||||
(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p))
|
||||
(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p))
|
||||
|
@ -200,8 +200,8 @@
|
|||
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
||||
:config
|
||||
(setq wgrep-auto-save-buffer t)
|
||||
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
||||
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
||||
(advice-add #'wgrep-abort-changes :after #'doom/popup-close)
|
||||
(advice-add #'wgrep-finish-edit :after #'doom/popup-close))
|
||||
|
||||
(provide 'core-editor)
|
||||
;;; core-editor.el ends here
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
(def-package! which-key
|
||||
:defer 1
|
||||
:config
|
||||
(setq which-key-sort-order 'which-key-key-order-alpha
|
||||
(setq which-key-sort-order #'which-key-key-order-alpha
|
||||
which-key-sort-uppercase-first nil
|
||||
which-key-add-column-padding 1
|
||||
which-key-max-display-columns nil
|
||||
|
@ -28,7 +28,7 @@
|
|||
(which-key-setup-side-window-bottom)
|
||||
(which-key-mode +1)
|
||||
(when (cdr doom--which-key-defs)
|
||||
(apply 'which-key-add-key-based-replacements (cdr doom--which-key-defs))))
|
||||
(apply #'which-key-add-key-based-replacements (cdr doom--which-key-defs))))
|
||||
|
||||
|
||||
(defun doom-keyword-to-states (keyword &optional ignore)
|
||||
|
|
|
@ -84,8 +84,8 @@ compilation."
|
|||
(if (symbolp feature)
|
||||
(require feature nil :no-error)
|
||||
(load feature :no-message :no-error)))
|
||||
'progn
|
||||
'with-no-warnings)
|
||||
#'progn
|
||||
#'with-no-warnings)
|
||||
(with-eval-after-load ',feature ,@forms)))
|
||||
|
||||
(defmacro quiet! (&rest forms)
|
||||
|
@ -114,10 +114,10 @@ function/hook is first invoked, then it detaches itself."
|
|||
`(progn
|
||||
(defun ,fn (&rest _)
|
||||
,@forms
|
||||
,(cond ((functionp hook) `(advice-remove ',hook ',fn))
|
||||
((symbolp hook) `(remove-hook ',hook ',fn))))
|
||||
,(cond ((functionp hook) `(advice-add ',hook :before ',fn))
|
||||
((symbolp hook) `(add-hook ',hook ',fn))))))
|
||||
,(cond ((functionp hook) `(advice-remove #',hook #',fn))
|
||||
((symbolp hook) `(remove-hook ',hook #',fn))))
|
||||
,(cond ((functionp hook) `(advice-add #',hook :before #',fn))
|
||||
((symbolp hook) `(add-hook ',hook #',fn))))))
|
||||
|
||||
(defmacro add-hook! (&rest args)
|
||||
"A convenience macro for `add-hook'. Takes, in order:
|
||||
|
@ -151,7 +151,7 @@ Body forms can access the hook's arguments through the let-bound variable
|
|||
(let ((hooks (doom--resolve-hooks (pop args)))
|
||||
(funcs
|
||||
(let ((val (car args)))
|
||||
(if (eq (car-safe val) 'quote)
|
||||
(if (memq (car-safe val) '(quote function))
|
||||
(if (cdr-safe (cadr val))
|
||||
(cadr val)
|
||||
(list (cadr val)))
|
||||
|
@ -159,7 +159,7 @@ Body forms can access the hook's arguments through the let-bound variable
|
|||
forms)
|
||||
(dolist (fn funcs)
|
||||
(setq fn (if (symbolp fn)
|
||||
`(quote ,fn)
|
||||
`(function ,fn)
|
||||
`(lambda (&rest args) ,@args)))
|
||||
(dolist (hook hooks)
|
||||
(push (cond ((eq hook-fn 'remove-hook)
|
||||
|
@ -249,11 +249,11 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it.
|
|||
(dotimes (i 2) (pop forms)))
|
||||
`(push (cons ',name
|
||||
(lambda ()
|
||||
(cl-flet ((sh (lambda (&rest args) (apply 'doom-sh args)))
|
||||
(sudo (lambda (&rest args) (apply 'doom-sudo args)))
|
||||
(fetch (lambda (&rest args) (apply 'doom-fetch args)))
|
||||
(cl-flet ((sh (lambda (&rest args) (apply #'doom-sh args)))
|
||||
(sudo (lambda (&rest args) (apply #'doom-sudo args)))
|
||||
(fetch (lambda (&rest args) (apply #'doom-fetch args)))
|
||||
(message (lambda (&rest args)
|
||||
(apply 'message (format "[%s] %s" ,(symbol-name name) (car args))
|
||||
(apply #'message (format "[%s] %s" ,(symbol-name name) (car args))
|
||||
(cdr args)))))
|
||||
(if (not ,(if (not prereqs)
|
||||
't
|
||||
|
@ -281,7 +281,7 @@ recipes for setting up the external dependencies of a module by, for instance,
|
|||
using the OS package manager to install them, or retrieving them from a repo
|
||||
using `doom-fetch'."
|
||||
(interactive
|
||||
(list (list (completing-read "Bootstrap: " (mapcar 'car doom-bootstraps) nil t))))
|
||||
(list (list (completing-read "Bootstrap: " (mapcar #'car doom-bootstraps) nil t))))
|
||||
(let (noninteractive)
|
||||
(load "core.el" nil t))
|
||||
(doom-initialize-packages t)
|
||||
|
@ -295,7 +295,7 @@ using `doom-fetch'."
|
|||
(and err-not-func
|
||||
(message "ERROR: These bootstraps were invalid: %s" err-not-func)))
|
||||
(error "There were errors. Aborting."))
|
||||
(mapc 'doom-bootstrap ids)))
|
||||
(mapc #'doom-bootstrap ids)))
|
||||
|
||||
(provide 'core-lib)
|
||||
;;; core-lib.el ends here
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
;; Most of this code grokked from:
|
||||
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
||||
(when (or (featurep 'mac) (featurep 'ns))
|
||||
(advice-add 'evil-visual-update-x-selection :override 'ignore))))
|
||||
(advice-add #'evil-visual-update-x-selection :override #'ignore))))
|
||||
|
||||
(IS-LINUX
|
||||
;; nothing yet
|
||||
|
|
|
@ -139,7 +139,7 @@ to speed up startup."
|
|||
load-path (append load-path doom--package-load-path))
|
||||
|
||||
;; Ensure core packages are installed
|
||||
(let ((core-packages (cl-remove-if 'package-installed-p doom-core-packages)))
|
||||
(let ((core-packages (cl-remove-if #'package-installed-p doom-core-packages)))
|
||||
(when core-packages
|
||||
(package-refresh-contents)
|
||||
(dolist (pkg core-packages)
|
||||
|
@ -191,7 +191,7 @@ files."
|
|||
|
||||
e.g '(:feature evil :lang emacs-lisp javascript java)"
|
||||
(unless doom-modules
|
||||
(setq doom-modules (make-hash-table :test 'equal :size (+ 5 (length modules)))))
|
||||
(setq doom-modules (make-hash-table :test #'equal :size (+ 5 (length modules)))))
|
||||
(let (mode)
|
||||
(dolist (m modules)
|
||||
(cond ((keywordp m)
|
||||
|
@ -204,7 +204,7 @@ files."
|
|||
(mapcar
|
||||
(lambda (dir) (intern (file-name-nondirectory dir)))
|
||||
(cl-remove-if-not
|
||||
'file-directory-p
|
||||
#'file-directory-p
|
||||
(directory-files (expand-file-name
|
||||
(substring (symbol-name mode) 1)
|
||||
doom-modules-dir)
|
||||
|
@ -289,7 +289,7 @@ byte-compilation."
|
|||
(server-start)))
|
||||
|
||||
;; Benchmark
|
||||
(add-hook 'after-init-hook 'doom--display-benchmark t))))
|
||||
(add-hook 'after-init-hook #'doom--display-benchmark t))))
|
||||
|
||||
(defalias 'def-package! 'use-package
|
||||
"An alias for `use-package'. Note that packages are deferred by default.")
|
||||
|
@ -535,7 +535,7 @@ package files."
|
|||
;;
|
||||
|
||||
;; Updates QUELPA after deleting a package
|
||||
(advice-add 'package-delete :after 'doom*package-delete)
|
||||
(advice-add #'package-delete :after #'doom*package-delete)
|
||||
|
||||
(provide 'core-packages)
|
||||
;;; core-packages.el ends here
|
||||
|
|
|
@ -99,7 +99,7 @@ for :align t on every rule."
|
|||
(plist-member plist :noselect))
|
||||
(plist-put plist :select t)))
|
||||
plist)
|
||||
(advice-add 'shackle--match :filter-return 'doom*shackle-always-align))
|
||||
(advice-add #'shackle--match :filter-return #'doom*shackle-always-align))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -173,7 +173,7 @@ for :align t on every rule."
|
|||
(set-window-parameter window param nil))))))
|
||||
|
||||
;; Hide modeline in completion popups
|
||||
(add-hook 'completion-list-mode-hook 'doom-hide-modeline-mode)
|
||||
(add-hook 'completion-list-mode-hook #'doom-hide-modeline-mode)
|
||||
|
||||
;;
|
||||
(defun doom*popup-init (orig-fn &rest args)
|
||||
|
@ -202,7 +202,7 @@ prevent the popup(s) from messing up the UI (or vice versa)."
|
|||
(popups (doom-popup-windows))
|
||||
(doom-popup-remember-history t))
|
||||
(when popups
|
||||
(mapc 'doom/popup-close popups))
|
||||
(mapc #'doom/popup-close popups))
|
||||
(unwind-protect (apply orig-fn args)
|
||||
(when popups
|
||||
(let ((origin (selected-window)))
|
||||
|
@ -223,9 +223,9 @@ properties."
|
|||
(when autokill-p
|
||||
(kill-buffer (current-buffer))))))))
|
||||
|
||||
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
||||
(advice-add 'balance-windows :around 'doom*popups-save)
|
||||
(advice-add 'delete-window :before 'doom*delete-popup-window)
|
||||
(advice-add #'shackle-display-buffer :around #'doom*popup-init)
|
||||
(advice-add #'balance-windows :around #'doom*popups-save)
|
||||
(advice-add #'delete-window :before #'doom*delete-popup-window)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -251,11 +251,11 @@ mode in any evil-mode buffer."
|
|||
(and (bound-and-true-p evil-mode)
|
||||
(evil-ex-hl-active-p 'evil-ex-search)))
|
||||
(doom/popup-close-all)))
|
||||
(advice-add 'evil-force-normal-state :after 'doom*popup-close-all-maybe)
|
||||
(advice-add #'evil-force-normal-state :after #'doom*popup-close-all-maybe)
|
||||
|
||||
;; Make evil-mode cooperate with popups
|
||||
(advice-add 'evil-command-window :override 'doom*popup-evil-command-window)
|
||||
(advice-add 'evil-command-window-execute :override 'doom*popup-evil-command-window-execute)
|
||||
(advice-add #'evil-command-window :override #'doom*popup-evil-command-window)
|
||||
(advice-add #'evil-command-window-execute :override #'doom*popup-evil-command-window-execute)
|
||||
|
||||
(defun doom*popup-evil-command-window (hist cmd-key execute-fn)
|
||||
"The evil command window has a mind of its own (uses `switch-to-buffer'). We
|
||||
|
@ -292,11 +292,11 @@ the command buffer."
|
|||
(setq evil-command-window-current-buffer nil)))
|
||||
|
||||
;; Don't mess with popups
|
||||
(advice-add 'doom-evil-window-move :around 'doom*popups-save)
|
||||
(advice-add 'evil-window-move-very-bottom :around 'doom*popups-save)
|
||||
(advice-add 'evil-window-move-very-top :around 'doom*popups-save)
|
||||
(advice-add 'evil-window-move-far-left :around 'doom*popups-save)
|
||||
(advice-add 'evil-window-move-far-right :around 'doom*popups-save)
|
||||
(advice-add #'doom-evil-window-move :around #'doom*popups-save)
|
||||
(advice-add #'evil-window-move-very-bottom :around #'doom*popups-save)
|
||||
(advice-add #'evil-window-move-very-top :around #'doom*popups-save)
|
||||
(advice-add #'evil-window-move-far-left :around #'doom*popups-save)
|
||||
(advice-add #'evil-window-move-far-right :around #'doom*popups-save)
|
||||
|
||||
;; Don't block moving to/from popup windows
|
||||
(defun doom*ignore-window-parameters-in-popups (dir &optional arg window)
|
||||
|
@ -304,7 +304,7 @@ the command buffer."
|
|||
((eq dir 'down) 'below)
|
||||
(t dir))
|
||||
window t arg windmove-wrap-around t))
|
||||
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups))
|
||||
(advice-add #'windmove-find-other-window :override #'doom*ignore-window-parameters-in-popups))
|
||||
|
||||
|
||||
(after! help-mode
|
||||
|
@ -347,7 +347,7 @@ the command buffer."
|
|||
|
||||
;; (after! magit
|
||||
;; ;; Don't open files (from magit) within the magit popup
|
||||
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
|
||||
;; (advice-add #'magit-display-file-buffer-traditional :around #'doom*popups-save))
|
||||
|
||||
|
||||
(after! neotree
|
||||
|
@ -363,23 +363,23 @@ the command buffer."
|
|||
(neotree-show))))))
|
||||
|
||||
;; Prevents messing up the neotree buffer on window changes
|
||||
(advice-add '+evil-window-move :around 'doom*popups-save-neotree)
|
||||
(advice-add #'+evil-window-move :around #'doom*popups-save-neotree)
|
||||
;; Don't let neotree interfere with moving, splitting or rebalancing windows
|
||||
(advice-add 'evil-window-move-very-bottom :around 'doom*popups-save-neotree)
|
||||
(advice-add 'evil-window-move-very-top :around 'doom*popups-save-neotree)
|
||||
(advice-add 'evil-window-move-far-left :around 'doom*popups-save-neotree)
|
||||
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
|
||||
(advice-add #'evil-window-move-very-bottom :around #'doom*popups-save-neotree)
|
||||
(advice-add #'evil-window-move-very-top :around #'doom*popups-save-neotree)
|
||||
(advice-add #'evil-window-move-far-left :around #'doom*popups-save-neotree)
|
||||
(advice-add #'evil-window-move-far-right :around #'doom*popups-save-neotree))
|
||||
|
||||
|
||||
(after! mu4e
|
||||
(advice-add 'mu4e~temp-window :override 'doom*mu4e~temp-window)
|
||||
(advice-add #'mu4e~temp-window :override #'doom*mu4e~temp-window)
|
||||
(defun doom*mu4e~temp-window (buf height)
|
||||
(doom-popup-buffer buf :size 10 :noselect t)
|
||||
buf))
|
||||
|
||||
|
||||
(after! twittering-mode
|
||||
(setq twittering-pop-to-buffer-function 'pop-to-buffer))
|
||||
(setq twittering-pop-to-buffer-function #'pop-to-buffer))
|
||||
|
||||
|
||||
;; Ensure these settings are attached to org-load-hook as late as possible,
|
||||
|
@ -407,14 +407,14 @@ the command buffer."
|
|||
;; Suppress `delete-other-windows' in org functions:
|
||||
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
|
||||
(cl-flet ((silence (&rest args) (ignore)))
|
||||
(advice-add 'delete-other-windows :around #'silence)
|
||||
(advice-add #'delete-other-windows :around #'silence)
|
||||
(unwind-protect
|
||||
(apply orig-fn args)
|
||||
(advice-remove 'delete-other-windows #'silence))))
|
||||
(advice-add 'org-capture-place-template :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add 'org-agenda :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add 'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add 'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
||||
(advice-remove #'delete-other-windows #'silence))))
|
||||
(advice-add #'org-capture-place-template :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add #'org-agenda :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add #'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
||||
(advice-add #'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
||||
|
||||
;; Tell `org-src-edit' to open another window, which shackle can intercept.
|
||||
(setq org-src-window-setup 'other-window)
|
||||
|
@ -426,11 +426,11 @@ the command buffer."
|
|||
(let ((window (doom-popup-buffer (car args))))
|
||||
(set-window-dedicated-p window nil)
|
||||
(select-window window)))
|
||||
(advice-add 'org-src-switch-to-buffer :override 'doom*org-src-switch-to-buffer)
|
||||
(advice-add #'org-src-switch-to-buffer :override #'doom*org-src-switch-to-buffer)
|
||||
|
||||
(defun doom*org-src-exit (&rest _)
|
||||
(when doom-popup-mode (doom-popup-mode -1)))
|
||||
(advice-add 'org-edit-src-exit :after 'doom*org-src-exit)
|
||||
(advice-add #'org-edit-src-exit :after #'doom*org-src-exit)
|
||||
|
||||
;; Ensure todo, agenda, and other popups are opened with shackle
|
||||
(defun doom*org-switch-to-buffer-other-window (&rest args)
|
||||
|
@ -439,10 +439,10 @@ the command buffer."
|
|||
(cond ((stringp buf) (get-buffer-create buf))
|
||||
((bufferp buf) buf)
|
||||
(t (error "Invalid buffer %s" buf))))))
|
||||
(advice-add 'org-switch-to-buffer-other-window :override 'doom*org-switch-to-buffer-other-window)
|
||||
(advice-add #'org-switch-to-buffer-other-window :override #'doom*org-switch-to-buffer-other-window)
|
||||
|
||||
;; Hide modeline in org-agenda
|
||||
(add-hook 'org-agenda-finalize-hook 'doom-hide-modeline-mode)
|
||||
(add-hook 'org-agenda-finalize-hook #'doom-hide-modeline-mode)
|
||||
|
||||
(after! org-agenda
|
||||
(setq org-agenda-window-setup 'other-window)
|
||||
|
|
|
@ -43,7 +43,7 @@ state are passed in.")
|
|||
"Don't traverse the file system if a remote connection."
|
||||
(unless (file-remote-p default-directory)
|
||||
(apply orig-fn args)))
|
||||
(advice-add 'projectile-locate-dominating-file :around 'doom*projectile-locate-dominating-file)
|
||||
(advice-add #'projectile-locate-dominating-file :around #'doom*projectile-locate-dominating-file)
|
||||
|
||||
(defun doom*projectile-cache-current-file (orig-fun &rest args)
|
||||
"Don't cache ignored files."
|
||||
|
@ -52,7 +52,7 @@ state are passed in.")
|
|||
(expand-file-name path)))
|
||||
(projectile-ignored-directories))
|
||||
(apply orig-fun args)))
|
||||
(advice-add 'projectile-cache-current-file :around 'doom*projectile-cache-current-file))
|
||||
(advice-add #'projectile-cache-current-file :around #'doom*projectile-cache-current-file))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -88,7 +88,7 @@ unless the path begins with ./ or ../, in which case it's relative to
|
|||
.dir-locals.el files."
|
||||
(dolist (mode doom-project)
|
||||
(funcall mode)))
|
||||
(add-hook 'after-change-major-mode-hook 'doom|autoload-project-mode)
|
||||
(add-hook 'after-change-major-mode-hook #'doom|autoload-project-mode)
|
||||
|
||||
(defmacro def-project-mode! (name &rest plist)
|
||||
"Define a project minor-mode named NAME, and declare where and how it is
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
visible-cursor nil
|
||||
x-stretch-cursor nil
|
||||
;; no beeping or blinking please
|
||||
ring-bell-function 'ignore
|
||||
ring-bell-function #'ignore
|
||||
visible-bell nil
|
||||
;; Ask for confirmation on quit only if real buffers exist
|
||||
confirm-kill-emacs (lambda (_) (if (doom-real-buffers-list) (y-or-n-p "››› Quit?") t)))
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||
(fset #'yes-or-no-p #'y-or-n-p) ; y/n instead of yes/no
|
||||
|
||||
;; auto-enabled in Emacs 25+; I'd rather enable it manually
|
||||
(global-eldoc-mode -1)
|
||||
|
@ -72,7 +72,7 @@ disabled.")
|
|||
;; undo/redo changes to Emacs' window layout
|
||||
(defvar winner-dont-bind-my-keys t) ; I'll bind keys myself
|
||||
(require 'winner)
|
||||
(add-hook 'window-setup-hook 'winner-mode)
|
||||
(add-hook 'window-setup-hook #'winner-mode)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -107,7 +107,7 @@ disabled.")
|
|||
(defun doom*autoload-hideshow ()
|
||||
(unless (bound-and-true-p hs-minor-mode)
|
||||
(hs-minor-mode 1)))
|
||||
(advice-add 'evil-toggle-fold :before 'doom*autoload-hideshow)
|
||||
(advice-add #'evil-toggle-fold :before #'doom*autoload-hideshow)
|
||||
:config
|
||||
(setq hs-hide-comments-when-hiding-all nil))
|
||||
|
||||
|
@ -156,10 +156,10 @@ file."
|
|||
(if highlight-indentation-mode
|
||||
(progn
|
||||
(doom|inject-trailing-whitespace)
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
||||
(add-hook 'after-save-hook 'doom|inject-trailing-whitespace nil t))
|
||||
(remove-hook 'before-save-hook 'delete-trailing-whitespace t)
|
||||
(remove-hook 'after-save-hook 'doom|inject-trailing-whitespace t)
|
||||
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t)
|
||||
(add-hook 'after-save-hook #'doom|inject-trailing-whitespace nil t))
|
||||
(remove-hook 'before-save-hook #'delete-trailing-whitespace t)
|
||||
(remove-hook 'after-save-hook #'doom|inject-trailing-whitespace t)
|
||||
(delete-trailing-whitespace))))
|
||||
|
||||
;; For modes that don't adequately highlight numbers
|
||||
|
@ -183,7 +183,7 @@ file."
|
|||
(add-hook!
|
||||
(markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode
|
||||
nxml-mode snippet-mode php-mode)
|
||||
'nlinum-mode)
|
||||
#'nlinum-mode)
|
||||
|
||||
:config
|
||||
(defun doom*nlinum-flush (&rest _)
|
||||
|
@ -191,7 +191,7 @@ file."
|
|||
(dolist (buffer (doom-visible-buffers))
|
||||
(with-current-buffer buffer
|
||||
(when nlinum-mode (nlinum--flush)))))
|
||||
(advice-add 'set-frame-font :after 'doom*nlinum-flush)
|
||||
(advice-add #'set-frame-font :after #'doom*nlinum-flush)
|
||||
|
||||
;; Optimization: calculate line number column width beforehand
|
||||
(add-hook! nlinum-mode
|
||||
|
@ -203,7 +203,7 @@ file."
|
|||
(def-package! rainbow-delimiters
|
||||
:commands rainbow-delimiters-mode
|
||||
:config (setq rainbow-delimiters-max-face-count 3)
|
||||
:init (add-hook 'lisp-mode-hook 'rainbow-delimiters-mode))
|
||||
:init (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode))
|
||||
|
||||
;; For a distractions-free-like UI, that dynamically resizes margets and can
|
||||
;; center a buffer.
|
||||
|
@ -226,7 +226,7 @@ file."
|
|||
(defun ,sym () ,@forms)
|
||||
,(unless (bound-and-true-p byte-compile-current-file)
|
||||
`(let (byte-compile-warnings)
|
||||
(byte-compile ',sym))))))
|
||||
(byte-compile #',sym))))))
|
||||
|
||||
(defsubst doom--prepare-modeline-segments (segments)
|
||||
(let (segs)
|
||||
|
@ -261,7 +261,7 @@ Example:
|
|||
rhs)))
|
||||
,(unless (bound-and-true-p byte-compile-current-file)
|
||||
`(let (byte-compile-warnings)
|
||||
(byte-compile ',sym))))))
|
||||
(byte-compile #',sym))))))
|
||||
|
||||
(defun doom-modeline (key)
|
||||
"Returns a mode-line configuration associated with KEY (a symbol). Throws an
|
||||
|
|
|
@ -111,7 +111,7 @@ there are problems.")
|
|||
undo-tree-history-directory-alist (list (cons "." (concat doom-cache-dir "undo-tree-hist/"))))
|
||||
|
||||
;; be quiet at startup
|
||||
(advice-add 'display-startup-echo-area-message :override 'ignore)
|
||||
(advice-add #'display-startup-echo-area-message :override #'ignore)
|
||||
(setq inhibit-startup-message t
|
||||
inhibit-startup-echo-area-message user-login-name
|
||||
initial-major-mode 'fundamental-mode
|
||||
|
@ -142,7 +142,7 @@ enable multiple minor modes for the same regexp.")
|
|||
(funcall (cdar alist) 1))
|
||||
(setq alist (cdr alist))))))
|
||||
|
||||
(add-hook 'find-file-hook 'doom|enable-minor-mode-maybe)
|
||||
(add-hook 'find-file-hook #'doom|enable-minor-mode-maybe)
|
||||
|
||||
|
||||
;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue