Minor refactor across the board

This commit is contained in:
Henrik Lissner 2019-03-04 20:44:35 -05:00
parent dd0d264a27
commit fbcb4e6973
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 24 additions and 24 deletions

View file

@ -40,8 +40,9 @@
;;;###autoload ;;;###autoload
(defun doom-package-backend (name &optional noerror) (defun doom-package-backend (name &optional noerror)
"Get which backend the package NAME was installed with. Can either be elpa or "Get which backend the package NAME was installed with. Can either be elpa,
quelpa. Throws an error if NOERROR is nil and the package isn't installed." quelpa or emacs (built-in). Throws an error if NOERROR is nil and the package
isn't installed."
(cl-check-type name symbol) (cl-check-type name symbol)
(cond ((assq name quelpa-cache) 'quelpa) (cond ((assq name quelpa-cache) 'quelpa)
((assq name package-alist) 'elpa) ((assq name package-alist) 'elpa)

View file

@ -34,8 +34,7 @@
((and (require 'frameset nil t) ((and (require 'frameset nil t)
(require 'restart-emacs nil t)) (require 'restart-emacs nil t))
(restart-emacs--restore-frames-using-desktop file)) (restart-emacs--restore-frames-using-desktop file))
((error "No session backend to load session with"))) ((error "No session backend to load session with"))))
(select-frame-set-input-focus (selected-frame)))
;;;###autoload ;;;###autoload
(defun doom-session-file () (defun doom-session-file ()

View file

@ -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 It is recommended you don't set specify a font-size, as to inherit `doom-font's
size.") 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 ;;; Custom hooks
@ -131,8 +135,8 @@ Do not set this directly.")
(defun doom|protect-visible-buffer () (defun doom|protect-visible-buffer ()
"Don't kill the current buffer if it is visible in another window (bury it "Don't kill the current buffer if it is visible in another window (bury it
instead). Meant for `kill-buffer-query-functions'." instead). Meant for `kill-buffer-query-functions'."
(not (and (delq (selected-window) (get-buffer-window-list nil nil t)) (not (and (not (member (substring (buffer-name) 0 1) '(" " "*")))
(not (member (substring (buffer-name) 0 1) '(" " "*")))))) (delq (selected-window) (get-buffer-window-list nil nil t)))))
(defun doom|protect-fallback-buffer () (defun doom|protect-fallback-buffer ()
"Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."
@ -164,10 +168,6 @@ read-only or not file-visiting."
;; ;;
;;; General configuration ;;; 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 (setq-default
ansi-color-for-comint-mode t ansi-color-for-comint-mode t
bidi-display-reordering nil ; disable bidirectional text for tiny performance boost 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 (def-package! winner
;; undo/redo changes to Emacs' window layout ;; undo/redo changes to Emacs' window layout
:after-call doom-exit-window-hook :hook (doom-exit-window . winner-mode)
:preface (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself :preface (defvar winner-dont-bind-my-keys t)) ; I'll bind keys myself
:config (winner-mode +1))
(def-package! paren (def-package! paren
@ -471,7 +470,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
:defer t :defer t
:config :config
(setq nlinum-format " %d ") (setq nlinum-format " %d ")
(add-hook 'evil-mode #'nlinum-relative-setup-evil)) (add-hook 'evil-mode-hook #'nlinum-relative-setup-evil))
;; ;;

View file

@ -672,6 +672,7 @@
:desc "Command log" "L" #'global-command-log-mode :desc "Command log" "L" #'global-command-log-mode
:desc "Describe mode" "M" #'describe-mode :desc "Describe mode" "M" #'describe-mode
:desc "Reload private config" "R" #'doom/reload :desc "Reload private config" "R" #'doom/reload
:desc "Describe symbol" "S" #'describe-symbol
:desc "Print Doom version" "V" #'doom/version :desc "Print Doom version" "V" #'doom/version
:desc "Apropos" "a" #'apropos :desc "Apropos" "a" #'apropos
:desc "Open Bug Report" "b" #'doom/open-bug-report :desc "Open Bug Report" "b" #'doom/open-bug-report
@ -679,7 +680,7 @@
:desc "Describe DOOM module" "d" #'doom/describe-module :desc "Describe DOOM module" "d" #'doom/describe-module
:desc "Describe function" "f" #'describe-function :desc "Describe function" "f" #'describe-function
:desc "Emacs help map" "h" help-map :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 "Describe key" "k" #'describe-key
:desc "Find library" "l" #'find-library :desc "Find library" "l" #'find-library
:desc "View *Messages*" "m" #'view-echo-area-messages :desc "View *Messages*" "m" #'view-echo-area-messages

View file

@ -21,13 +21,15 @@
:config :config
(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-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 ;; Allow private snippets in DOOMDIR/snippets
(add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq) (add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq)
;; Remove GUI dropdown prompt (prefer ivy/helm) ;; 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 ;; Prioritize private snippets in `+snippets-dir' over built-in ones if there
;; are multiple choices. ;; are multiple choices.
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq) (add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq)

View file

@ -14,7 +14,7 @@
(let* ((offset LaTeX-indent-level) (let* ((offset LaTeX-indent-level)
(contin (or (and (boundp '+latex-indent-level-item-continuation) (contin (or (and (boundp '+latex-indent-level-item-continuation)
+latex-indent-level-item-continuation) +latex-indent-level-item-continuation)
(* 4 LaTeX-indent-level))) (* 4 offset)))
(re-beg "\\\\begin{") (re-beg "\\\\begin{")
(re-end "\\\\end{") (re-end "\\\\end{")
(re-env "\\(itemize\\|\\enumerate\\|description\\)") (re-env "\\(itemize\\|\\enumerate\\|description\\)")
@ -37,8 +37,7 @@
indent) indent)
((looking-at "\\\\item") ((looking-at "\\\\item")
(+ offset indent)) (+ offset indent))
(t ((+ contin indent))))))
(+ contin indent))))))
;;;###autoload ;;;###autoload
(defun +latex-symbols-company-backend (command &optional arg &rest _ignored) (defun +latex-symbols-company-backend (command &optional arg &rest _ignored)

View file

@ -54,6 +54,8 @@ If no viewers are found, `latex-preview-pane' is used.")
(add-hook 'TeX-mode-hook #'visual-line-mode) (add-hook 'TeX-mode-hook #'visual-line-mode)
;; Fold TeX macros ;; Fold TeX macros
(add-hook 'TeX-mode-hook #'TeX-fold-mode) (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 ;; display output of latex commands in popup
(set-popup-rule! " output\\*$" :size 15) (set-popup-rule! " output\\*$" :size 15)
;; Do not prompt for Master files, this allows auto-insert to add templates to ;; 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 (remove-hook 'find-file-hook
(cl-find-if #'byte-code-function-p find-file-hook) (cl-find-if #'byte-code-function-p find-file-hook)
'local)) 'local))
;; Enable rainbow mode after applying styles to the buffer (add-hook 'latex-mode-local-vars-hook #'flyspell-mode!)
(add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode)
(when (featurep! :tools flyspell)
(add-hook 'latex-mode-local-vars-hook #'flyspell-mode))
;; All these excess pairs dramatically slow down typing in latex buffers, so ;; All these excess pairs dramatically slow down typing in latex buffers, so
;; we remove them. Let snippets do their job. ;; we remove them. Let snippets do their job.
(after! smartparens-latex (after! smartparens-latex