From fbcb4e69730bfe35f4f3538ea83f30cff0ba6a98 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 4 Mar 2019 20:44:35 -0500 Subject: [PATCH] Minor refactor across the board --- core/autoload/packages.el | 5 +++-- core/autoload/sessions.el | 3 +-- core/core-ui.el | 19 +++++++++---------- modules/config/default/+evil-bindings.el | 3 ++- modules/feature/snippets/config.el | 6 ++++-- modules/lang/latex/autoload.el | 5 ++--- modules/lang/latex/config.el | 7 +++---- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index cde86e3f4..9b42497bc 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -40,8 +40,9 @@ ;;;###autoload (defun doom-package-backend (name &optional noerror) - "Get which backend the package NAME was installed with. Can either be elpa or -quelpa. Throws an error if NOERROR is nil and the package isn't installed." + "Get which backend the package NAME was installed with. Can either be elpa, +quelpa or emacs (built-in). Throws an error if NOERROR is nil and the package +isn't installed." (cl-check-type name symbol) (cond ((assq name quelpa-cache) 'quelpa) ((assq name package-alist) 'elpa) diff --git a/core/autoload/sessions.el b/core/autoload/sessions.el index 611e0096e..b617dedc5 100644 --- a/core/autoload/sessions.el +++ b/core/autoload/sessions.el @@ -34,8 +34,7 @@ ((and (require 'frameset nil t) (require 'restart-emacs nil t)) (restart-emacs--restore-frames-using-desktop file)) - ((error "No session backend to load session with"))) - (select-frame-set-input-focus (selected-frame))) + ((error "No session backend to load session with")))) ;;;###autoload (defun doom-session-file () diff --git a/core/core-ui.el b/core/core-ui.el index caec4a7ed..1134ecb33 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -51,6 +51,10 @@ Expects either a `font-spec', font object, a XFT font string or XLFD string. See It is recommended you don't set specify a font-size, as to inherit `doom-font's size.") +(defvar doom--prefer-theme-elc nil + "If non-nil, `load-theme' will prefer the compiled theme (unlike its default +behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") + ;; ;;; Custom hooks @@ -131,8 +135,8 @@ Do not set this directly.") (defun doom|protect-visible-buffer () "Don't kill the current buffer if it is visible in another window (bury it instead). Meant for `kill-buffer-query-functions'." - (not (and (delq (selected-window) (get-buffer-window-list nil nil t)) - (not (member (substring (buffer-name) 0 1) '(" " "*")))))) + (not (and (not (member (substring (buffer-name) 0 1) '(" " "*"))) + (delq (selected-window) (get-buffer-window-list nil nil t))))) (defun doom|protect-fallback-buffer () "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." @@ -164,10 +168,6 @@ read-only or not file-visiting." ;; ;;; General configuration -(defvar doom--prefer-theme-elc nil - "If non-nil, `load-theme' will prefer the compiled theme (unlike its default -behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") - (setq-default ansi-color-for-comint-mode t bidi-display-reordering nil ; disable bidirectional text for tiny performance boost @@ -305,9 +305,8 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") (def-package! winner ;; undo/redo changes to Emacs' window layout - :after-call doom-exit-window-hook - :preface (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself - :config (winner-mode +1)) + :hook (doom-exit-window . winner-mode) + :preface (defvar winner-dont-bind-my-keys t)) ; I'll bind keys myself (def-package! paren @@ -471,7 +470,7 @@ character that looks like a space that `whitespace-mode' won't affect.") :defer t :config (setq nlinum-format " %d ") - (add-hook 'evil-mode #'nlinum-relative-setup-evil)) + (add-hook 'evil-mode-hook #'nlinum-relative-setup-evil)) ;; diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index a00bf4f56..46d736261 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -672,6 +672,7 @@ :desc "Command log" "L" #'global-command-log-mode :desc "Describe mode" "M" #'describe-mode :desc "Reload private config" "R" #'doom/reload + :desc "Describe symbol" "S" #'describe-symbol :desc "Print Doom version" "V" #'doom/version :desc "Apropos" "a" #'apropos :desc "Open Bug Report" "b" #'doom/open-bug-report @@ -679,7 +680,7 @@ :desc "Describe DOOM module" "d" #'doom/describe-module :desc "Describe function" "f" #'describe-function :desc "Emacs help map" "h" help-map - :desc "Info" "i" #'info-lookup-symbol + :desc "Lookup in manual" "i" #'info-lookup-symbol :desc "Describe key" "k" #'describe-key :desc "Find library" "l" #'find-library :desc "View *Messages*" "m" #'view-echo-area-messages diff --git a/modules/feature/snippets/config.el b/modules/feature/snippets/config.el index c2f47b2a6..50ce7fce7 100644 --- a/modules/feature/snippets/config.el +++ b/modules/feature/snippets/config.el @@ -21,13 +21,15 @@ :config (setq yas-verbosity (if doom-debug-mode 3 0) yas-also-auto-indent-first-line t - yas-triggers-in-field t) ; Allow nested snippets + yas-triggers-in-field t ; Allow nested snippets + ;; Remove default ~/.emacs.d/snippets + yas-snippet-dirs (delete yas--default-user-snippets-dir yas-snippet-dirs)) ;; Allow private snippets in DOOMDIR/snippets (add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq) ;; Remove GUI dropdown prompt (prefer ivy/helm) - (delq #'yas-dropdown-prompt yas-prompt-functions) + (setq yas-prompt-functions (delq 'yas-dropdown-prompt yas-prompt-functions)) ;; Prioritize private snippets in `+snippets-dir' over built-in ones if there ;; are multiple choices. (add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq) diff --git a/modules/lang/latex/autoload.el b/modules/lang/latex/autoload.el index de168cdba..c63b7b6be 100644 --- a/modules/lang/latex/autoload.el +++ b/modules/lang/latex/autoload.el @@ -14,7 +14,7 @@ (let* ((offset LaTeX-indent-level) (contin (or (and (boundp '+latex-indent-level-item-continuation) +latex-indent-level-item-continuation) - (* 4 LaTeX-indent-level))) + (* 4 offset))) (re-beg "\\\\begin{") (re-end "\\\\end{") (re-env "\\(itemize\\|\\enumerate\\|description\\)") @@ -37,8 +37,7 @@ indent) ((looking-at "\\\\item") (+ offset indent)) - (t - (+ contin indent)))))) + ((+ contin indent)))))) ;;;###autoload (defun +latex-symbols-company-backend (command &optional arg &rest _ignored) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 5a1c9921a..82efbbecf 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -54,6 +54,8 @@ If no viewers are found, `latex-preview-pane' is used.") (add-hook 'TeX-mode-hook #'visual-line-mode) ;; Fold TeX macros (add-hook 'TeX-mode-hook #'TeX-fold-mode) + ;; Enable rainbow mode after applying styles to the buffer + (add-hook 'TeX-mode-hook #'rainbow-delimiters-mode) ;; display output of latex commands in popup (set-popup-rule! " output\\*$" :size 15) ;; Do not prompt for Master files, this allows auto-insert to add templates to @@ -63,10 +65,7 @@ If no viewers are found, `latex-preview-pane' is used.") (remove-hook 'find-file-hook (cl-find-if #'byte-code-function-p find-file-hook) 'local)) - ;; Enable rainbow mode after applying styles to the buffer - (add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode) - (when (featurep! :tools flyspell) - (add-hook 'latex-mode-local-vars-hook #'flyspell-mode)) + (add-hook 'latex-mode-local-vars-hook #'flyspell-mode!) ;; All these excess pairs dramatically slow down typing in latex buffers, so ;; we remove them. Let snippets do their job. (after! smartparens-latex