Minor refactor & reformatting across the board

This commit is contained in:
Henrik Lissner 2020-04-08 15:29:29 -04:00
parent 2957f5ff28
commit b78fc4eb76
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
27 changed files with 189 additions and 164 deletions

View file

@ -12,7 +12,7 @@ scaled up by `doom-big-font-increment'. See `doom-font' for details on
acceptable values for this variable.") acceptable values for this variable.")
;;;###autoload ;;;###autoload
(defvar doom-big-font-increment 8 (defvar doom-big-font-increment 4
"How many steps to increase the font size (with `doom-font' as the base) when "How many steps to increase the font size (with `doom-font' as the base) when
`doom-big-font-mode' is enabled and `doom-big-font' is nil.") `doom-big-font-mode' is enabled and `doom-big-font' is nil.")

View file

@ -260,15 +260,9 @@ opposite indentation style."
Respects `require-final-newline'." Respects `require-final-newline'."
(interactive) (interactive)
(save-excursion
(goto-char (point-max)) (goto-char (point-max))
(skip-chars-backward " \t\n\v") (delete-blank-lines)))
(when (looking-at "\n\\(\n\\|\\'\\)")
(forward-char 1))
(when require-final-newline
(unless (bolp)
(insert "\n")))
(when (looking-at "\n+")
(replace-match "")))
;;;###autoload ;;;###autoload
(defun doom/dos2unix () (defun doom/dos2unix ()

View file

@ -105,7 +105,7 @@ See `display-line-numbers' for what these values mean."
(_ (symbol-name next)))))) (_ (symbol-name next))))))
;;;###autoload ;;;###autoload
(defun doom/delete-frame () (defun doom/delete-frame-with-prompt ()
"Delete the current frame, but ask for confirmation if it isn't empty." "Delete the current frame, but ask for confirmation if it isn't empty."
(interactive) (interactive)
(if (cdr (frame-list)) (if (cdr (frame-list))

View file

@ -87,7 +87,7 @@ possible."
;; But have a place to store them in case we do use them... ;; But have a place to store them in case we do use them...
;; auto-save-list-file-name (concat doom-cache-dir "autosave") ;; auto-save-list-file-name (concat doom-cache-dir "autosave")
auto-save-list-file-prefix (concat doom-cache-dir "autosave/") auto-save-list-file-prefix (concat doom-cache-dir "autosave/")
auto-save-file-name-transforms `((".*" ,(concat doom-cache-dir "autosave/") t)) auto-save-file-name-transforms `((".*" ,auto-save-list-file-prefix t))
backup-directory-alist `((".*" . ,(concat doom-cache-dir "backup/")))) backup-directory-alist `((".*" . ,(concat doom-cache-dir "backup/"))))
(after! tramp (after! tramp
@ -106,39 +106,63 @@ possible."
;; ;;
;;; Formatting ;;; Formatting
;; Indentation ;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a
(setq-default tab-width 4 ;; more consistent default than 8-space tabs. It can be changed on a per-mode
tab-always-indent t ;; basis anyway (and is, where tabs are the canonical style, like go-mode).
indent-tabs-mode nil (setq-default indent-tabs-mode nil
fill-column 80) tab-width 4)
;; Word wrapping ;; Make `tabify' and `untabify' only affect indentation. Not tabs/spaces in the
(setq-default word-wrap t ;; middle of a line.
truncate-lines t (setq tabify-regexp "^\t* [ \t]+")
truncate-partial-width-windows nil)
(setq sentence-end-double-space nil ;; An archaic default in the age of widescreen 4k displays? I disagree. We still
delete-trailing-lines nil ;; frequently split our terminals and editor frames, or have them side-by-side,
require-final-newline t ;; using up more of that newly available horizontal real-estate.
tabify-regexp "^\t* [ \t]+") ; for :retab (setq-default fill-column 80)
;; Favor hard-wrapping in text modes ;; Continue wrapped words at whitespace, rather than in the middle of a word.
(setq-default word-wrap t)
;; ...but don't do any wrapping by default. It's expensive. Enable
;; `visual-line-mode' if you want soft line-wrapping. `auto-fill-mode' for hard
;; line-wrapping.
(setq-default truncate-lines t)
;; If enabled (and `truncate-lines' was disabled), soft wrapping no longer
;; occurs when that window is less than `truncate-partial-width-windows'
;; characters wide. We don't need this, and it's extra work for Emacs otherwise,
;; so off it goes.
(setq truncate-partial-width-windows nil)
;; This was a widespread practice in the days of typewriters. I actually prefer
;; it when writing prose with monospace fonts, but it is obsolete otherwise.
(setq sentence-end-double-space nil)
;; The POSIX standard defines a line is "a sequence of zero or more non-newline
;; characters followed by a terminating newline", so files should end in a
;; newline. Windows doesn't respect this (because it's Windows), but we should,
;; since programmers' tools tend to be POSIX compliant.
(setq require-final-newline t)
;; Default to hard line-wrapping in text modes. Hard wrapping is more
;; performant, and Emacs makes it trivially easy to reflow text with
;; `fill-paragraph' and `evil-fill'.
(add-hook 'text-mode-hook #'auto-fill-mode) (add-hook 'text-mode-hook #'auto-fill-mode)
;; ;;
;;; Clipboard / kill-ring ;;; Clipboard / kill-ring
;; Eliminate duplicates in the kill ring. That is, if you kill the same thing ;; Cull duplicates in the kill ring to reduce bloat and make the kill ring
;; twice, you won't have to use M-y twice to get past it to older entries in the ;; easier to peruse (with `counsel-yank-pop' or `helm-show-kill-ring'.
;; kill ring.
(setq kill-do-not-save-duplicates t) (setq kill-do-not-save-duplicates t)
;; ;; Allow UTF or composed text from the clipboard, even in the terminal or on
;; non-X systems (like Windows or macOS), where only `STRING' is used.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
;; Fixes the clipboard in tty Emacs by piping clipboard I/O through xclip, xsel, ;; Fixes the clipboard in tty Emacs by piping clipboard I/O through xclip, xsel,
;; pb{copy,paste}, wl-copy, termux-clipboard-get, or getclip (cygwin). ;; pb{copy,paste}, wl-copy, termux-clipboard-get, or getclip (cygwin); depending
;; on what is available.
(unless IS-WINDOWS (unless IS-WINDOWS
(add-hook! 'tty-setup-hook (add-hook! 'tty-setup-hook
(defun doom-init-clipboard-in-tty-emacs-h () (defun doom-init-clipboard-in-tty-emacs-h ()
@ -154,7 +178,6 @@ possible."
(push '("/LICENSE\\'" . text-mode) auto-mode-alist) (push '("/LICENSE\\'" . text-mode) auto-mode-alist)
(push '("\\.log\\'" . text-mode) auto-mode-alist) (push '("\\.log\\'" . text-mode) auto-mode-alist)
(push '("\\.env\\'" . sh-mode) auto-mode-alist)
;; ;;
@ -173,13 +196,13 @@ possible."
;; Only prompts for confirmation when buffer is unsaved. ;; Only prompts for confirmation when buffer is unsaved.
revert-without-query (list ".")) revert-without-query (list "."))
;; Instead of using `auto-revert-mode' or `global-auto-revert-mode', we employ ;; Instead of `auto-revert-mode' or `global-auto-revert-mode', we lazily auto
;; lazy auto reverting on `focus-in-hook' and `doom-switch-buffer-hook'. ;; revert; when we save a file or switch buffers/windows (or focus on Emacs).
;; ;;
;; This is because autorevert abuses the heck out of inotify handles which can ;; Autorevert normally abuses the heck out of inotify handles which can grind
;; grind Emacs to a halt if you do expensive IO (outside of Emacs) on the ;; Emacs to a halt if you do expensive IO (outside of Emacs) on the files you
;; files you have open (like compression). We only really need to revert ;; have open (like compression). The only alternative is aggressive polling,
;; changes when we switch to a buffer or when we focus the Emacs frame. ;; which is unreliable and expensive with a lot of buffers open.
(defun doom-auto-revert-buffer-h () (defun doom-auto-revert-buffer-h ()
"Auto revert current buffer, if necessary." "Auto revert current buffer, if necessary."
(unless (or auto-revert-mode (active-minibuffer-window)) (unless (or auto-revert-mode (active-minibuffer-window))
@ -204,9 +227,9 @@ possible."
(file-truename file) (file-truename file)
file)) file))
(setq recentf-filename-handlers (setq recentf-filename-handlers
'(substring-no-properties '(substring-no-properties ; strip out lingering text properties
doom--recent-file-truename doom--recent-file-truename ; resolve symlinks of local files
abbreviate-file-name) abbreviate-file-name) ; replace $HOME with ~
recentf-save-file (concat doom-cache-dir "recentf") recentf-save-file (concat doom-cache-dir "recentf")
recentf-auto-cleanup 'never recentf-auto-cleanup 'never
recentf-max-menu-items 0 recentf-max-menu-items 0
@ -272,8 +295,7 @@ possible."
`pp' can be expensive for longer lists, and there's no reason to prettify cache `pp' can be expensive for longer lists, and there's no reason to prettify cache
files, so we replace calls to `pp' with the much faster `prin1'." files, so we replace calls to `pp' with the much faster `prin1'."
:around #'save-place-alist-to-file :around #'save-place-alist-to-file
(cl-letf (((symbol-function #'pp) (cl-letf (((symbol-function #'pp) #'prin1))
(symbol-function #'prin1)))
(funcall orig-fn))) (funcall orig-fn)))
(save-place-mode +1)) (save-place-mode +1))
@ -347,9 +369,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
(use-package! dtrt-indent (use-package! dtrt-indent
;; Automatic detection of indent settings ;; Automatic detection of indent settings
:when doom-interactive-mode :when doom-interactive-mode
:defer t :hook ((change-major-mode-after-body read-only-mode) . doom-detect-indentation-h)
:init :config
(add-hook! '(change-major-mode-after-body-hook read-only-mode-hook)
(defun doom-detect-indentation-h () (defun doom-detect-indentation-h ()
(unless (or (not after-init-time) (unless (or (not after-init-time)
doom-inhibit-indent-detection doom-inhibit-indent-detection
@ -358,8 +379,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
(member (substring (buffer-name) 0 1) '(" " "*"))) (member (substring (buffer-name) 0 1) '(" " "*")))
;; Don't display messages in the echo area, but still log them ;; Don't display messages in the echo area, but still log them
(let ((inhibit-message (not doom-debug-mode))) (let ((inhibit-message (not doom-debug-mode)))
(dtrt-indent-mode +1))))) (dtrt-indent-mode +1))))
:config
;; Enable dtrt-indent even in smie modes so that it can update `tab-width', ;; Enable dtrt-indent even in smie modes so that it can update `tab-width',
;; `standard-indent' and `evil-shift-width' there as well. ;; `standard-indent' and `evil-shift-width' there as well.
(setq dtrt-indent-run-after-smie t) (setq dtrt-indent-run-after-smie t)

View file

@ -93,7 +93,7 @@ Accepts the same arguments as `message'."
ARGS is a list of the last N arguments to pass to FUN. The result is a new ARGS is a list of the last N arguments to pass to FUN. The result is a new
function which does the same as FUN, except that the last N arguments are fixed function which does the same as FUN, except that the last N arguments are fixed
at the values with which this function was called." at the values with which this function was called."
(declare (pure t) (side-effect-free t)) (declare (side-effect-free t))
(lambda (&rest pre-args) (lambda (&rest pre-args)
(apply fn (append pre-args args)))) (apply fn (append pre-args args))))

View file

@ -1,23 +1,21 @@
;;; core/core-packages.el -*- lexical-binding: t; -*- ;;; core/core-packages.el -*- lexical-binding: t; -*-
;; Emacs package management is opinionated, and so is Doom. Doom uses `straight' ;; Emacs package management is opinionated, and so is Doom. Doom uses `straight'
;; to create a declarative, lazy-loaded and optionally rolling-release package ;; to create a declarative, lazy-loaded and (nominally) reproducible package
;; management system. We use `straight' over `package' because the latter is ;; management system. We use `straight' over `package' because the latter is
;; tempermental. ELPA sources suffer downtime occasionally, and often fail at ;; tempermental. ELPA sources suffer downtime occasionally and often fail to
;; building some packages when GNU Tar is unavailable (e.g. MacOS users start ;; build packages when GNU Tar is unavailable (e.g. MacOS users start with BSD
;; with BSD tar). There are also known gnutls errors in the current stable ;; tar). Known gnutls errors plague the current stable release of Emacs (26.x)
;; release of Emacs (26.x) which bork TLS handshakes with ELPA repos (mainly ;; which bork TLS handshakes with ELPA repos (mainly gnu.elpa.org). See
;; gnu.elpa.org). See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434.
;; ;;
;; What's worse, you can only get the latest version of packages through ELPA. ;; What's worse, you can only get the latest version of packages through ELPA.
;; In an ecosystem that is constantly changing, this is more frustrating than ;; In an ecosystem that is constantly changing, this is more frustrating than
;; convenient. Straight (and Doom) can do rolling release, but it is optional ;; convenient. Straight (and Doom) can do rolling release, but it is opt-in.
;; (and will eventually be opt-in).
;; ;;
;; ANyhow, interacting with this package management system is done through the ;; Interacting with this package management system is done through Doom's
;; bin/doom script included with Doom Emacs. You'll find more about it by ;; bin/doom script. Find out more about it by running 'doom help' (I highly
;; running 'doom help' (I highly recommend you add it to your PATH), but here ;; recommend you add the script to your PATH). Here are some highlights:
;; are the highlights:
;; ;;
;; + `bin/doom install`: a wizard that guides you through setting up Doom and ;; + `bin/doom install`: a wizard that guides you through setting up Doom and
;; your private config for the first time. ;; your private config for the first time.
@ -83,35 +81,36 @@ missing) and shouldn't be deleted.")
("melpa" . ,(concat proto "://melpa.org/packages/")) ("melpa" . ,(concat proto "://melpa.org/packages/"))
("org" . ,(concat proto "://orgmode.org/elpa/"))))) ("org" . ,(concat proto "://orgmode.org/elpa/")))))
;; package.el has no business modifying the user's init.el
(advice-add #'package--ensure-init-file :override #'ignore) (advice-add #'package--ensure-init-file :override #'ignore)
;; Don't save `package-selected-packages' to `custom-file' ;; Refresh package.el the first time you call `package-install', so it can still
(defadvice! doom--package-inhibit-custom-file-a (&optional value) ;; be used (e.g. to temporarily test packages). Remember to run 'doom sync' to
:override #'package--save-selected-packages ;; purge them; they can conflict with packages installed via straight!
(if value (setq package-selected-packages value)))
;; Refresh package.el the first time you call `package-install'
(add-transient-hook! 'package-install (package-refresh-contents)) (add-transient-hook! 'package-install (package-refresh-contents))
;;; straight
;;
;;; Straight
(setq straight-base-dir doom-local-dir (setq straight-base-dir doom-local-dir
straight-repository-branch "develop" straight-repository-branch "develop"
straight-cache-autoloads nil ; we already do this, and better. straight-cache-autoloads nil ; we already do this, and better.
;; Doom doesn't encourage you to modify packages in place. Disabling this ;; Doom doesn't encourage you to modify packages in place. Disabling this
;; makes 'doom refresh' instant (once everything set up), which is much ;; makes 'doom sync' instant (once everything set up), which is much nicer
;; nicer UX than the several seconds modification checks. ;; UX than the several seconds modification checks.
straight-check-for-modifications nil straight-check-for-modifications nil
;; We handle package.el ourselves (and a little more comprehensively) ;; We handle package.el ourselves (and a little more comprehensively)
straight-enable-package-integration nil straight-enable-package-integration nil
;; Before switching to straight, `doom-local-dir' would average out at ;; Before switching to straight, `doom-local-dir' would average out at
;; around 100mb with half Doom's modules at ~230 packages. Afterwards, at ;; around 100mb with half Doom's modules at ~230 packages. Afterwards, at
;; around 1gb. With shallow cloning, that is reduced to ~400mb. This ;; around 1gb. With shallow cloning, that is reduced to ~400mb. This has
;; imposes an issue with packages that require their git history for ;; no affect on packages that are pinned, however (run 'doom purge' to
;; certain things to work (like magit and org), but we can deal with that ;; compact those after-the-fact). Some packages break when shallow cloned
;; when we cross that bridge. ;; (like magit and org), but we'll deal with that elsewhere.
straight-vc-git-default-clone-depth 1 straight-vc-git-default-clone-depth 1
;; Prefix declarations are unneeded bulk added to our autoloads file. Best ;; Prefix declarations are unneeded bulk added to our autoloads file. Best
;; we just don't have to deal with them at all. ;; we don't have to deal with them at all.
autoload-compute-prefixes nil autoload-compute-prefixes nil
;; We handle it ourselves ;; We handle it ourselves
straight-fix-org nil) straight-fix-org nil)
@ -119,7 +118,7 @@ missing) and shouldn't be deleted.")
(defadvice! doom--read-pinned-packages-a (orig-fn &rest args) (defadvice! doom--read-pinned-packages-a (orig-fn &rest args)
"Read from `doom-pinned-packages' on top of straight's lockfiles." "Read from `doom-pinned-packages' on top of straight's lockfiles."
:around #'straight--lockfile-read-all :around #'straight--lockfile-read-all
(append (apply orig-fn args) (append (apply orig-fn args) ; lockfiles still take priority
(doom-package-pinned-list))) (doom-package-pinned-list)))
@ -260,7 +259,7 @@ elsewhere."
(doplist! ((prop val) (list ,@plist) plist) (doplist! ((prop val) (list ,@plist) plist)
(unless (null val) (unless (null val)
(plist-put! plist prop val))) (plist-put! plist prop val)))
;; Some basic key validation; error if you're not using a valid key ;; Some basic key validation; throws an error on invalid properties
(condition-case e (condition-case e
(when-let (recipe (plist-get plist :recipe)) (when-let (recipe (plist-get plist :recipe))
(cl-destructuring-bind (cl-destructuring-bind
@ -286,8 +285,8 @@ elsewhere."
"A convenience macro for disabling packages in bulk. "A convenience macro for disabling packages in bulk.
Only use this macro in a module's (or your private) packages.el file." Only use this macro in a module's (or your private) packages.el file."
(macroexp-progn (macroexp-progn
(cl-loop for p in packages (mapcar (lambda (p) `(package! ,p :disable t))
collect `(package! ,p :disable t)))) packages)))
(defmacro unpin! (&rest targets) (defmacro unpin! (&rest targets)
"Unpin packages in TARGETS. "Unpin packages in TARGETS.

View file

@ -328,8 +328,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
window-divider-default-right-width 1) window-divider-default-right-width 1)
(add-hook 'doom-init-ui-hook #'window-divider-mode) (add-hook 'doom-init-ui-hook #'window-divider-mode)
;; Prompt the user for confirmation when deleting a non-empty frame ;; Prompt for confirmation when deleting a non-empty frame; a last line of
(global-set-key [remap delete-frame] #'doom/delete-frame) ;; defense against accidental loss of work.
(global-set-key [remap delete-frame] #'doom/delete-frame-with-prompt)
;; always avoid GUI ;; always avoid GUI
(setq use-dialog-box nil) (setq use-dialog-box nil)
@ -513,10 +514,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; languages like Lisp. ;; languages like Lisp.
(setq rainbow-delimiters-max-face-count 3) (setq rainbow-delimiters-max-face-count 3)
;;;###package pos-tip
(setq pos-tip-internal-border-width 6
pos-tip-border-width 1)
;; ;;
;;; Line numbers ;;; Line numbers
@ -635,9 +632,13 @@ This offers a moderate boost in startup (or theme switch) time, so long as
(add-hook 'after-change-major-mode-hook #'doom-highlight-non-default-indentation-h 'append) (add-hook 'after-change-major-mode-hook #'doom-highlight-non-default-indentation-h 'append)
;; Initialize custom switch-{buffer,window,frame} hooks: ;; Initialize custom switch-{buffer,window,frame} hooks:
;;
;; + `doom-switch-buffer-hook' ;; + `doom-switch-buffer-hook'
;; + `doom-switch-window-hook' ;; + `doom-switch-window-hook'
;; + `doom-switch-frame-hook' ;; + `doom-switch-frame-hook'
;;
;; These should be done as late as possible, as not to prematurely trigger
;; hooks during startup.
(add-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h) (add-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h)
(add-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h) (add-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h)
(dolist (fn '(switch-to-next-buffer switch-to-prev-buffer)) (dolist (fn '(switch-to-next-buffer switch-to-prev-buffer))
@ -675,7 +676,7 @@ This offers a moderate boost in startup (or theme switch) time, so long as
(put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead") (put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead")
;; Doesn't exist in terminal Emacs, so we define it to prevent void-function ;; Doesn't exist in terminal Emacs, so we define it to prevent void-function
;; errors emitted from packages use it without checking for it first. ;; errors emitted from packages that blindly try to use it.
(unless (fboundp 'define-fringe-bitmap) (unless (fboundp 'define-fringe-bitmap)
(fset 'define-fringe-bitmap #'ignore)) (fset 'define-fringe-bitmap #'ignore))

View file

@ -250,8 +250,8 @@ users).")
;;; Optimizations ;;; Optimizations
;; Disable bidirectional text rendering for a modest performance boost. I've set ;; Disable bidirectional text rendering for a modest performance boost. I've set
;; this to `nil' in the past, but the `bidi-display-reordering's docs say this ;; this to `nil' in the past, but the `bidi-display-reordering's docs say that
;; isn't a good idea, and suggests this is just as good: ;; is an undefined state and suggest this to be just as good:
(setq-default bidi-display-reordering 'left-to-right (setq-default bidi-display-reordering 'left-to-right
bidi-paragraph-direction 'left-to-right) bidi-paragraph-direction 'left-to-right)
@ -261,7 +261,8 @@ users).")
(setq highlight-nonselected-windows nil) (setq highlight-nonselected-windows nil)
;; More performant rapid scrolling over unfontified regions. May cause brief ;; More performant rapid scrolling over unfontified regions. May cause brief
;; spells of inaccurate fontification immediately after scrolling. ;; spells of inaccurate syntax highlighting right after scrolling, which should
;; quickly self-correct.
(setq fast-but-imprecise-scrolling t) (setq fast-but-imprecise-scrolling t)
;; Resizing the Emacs frame can be a terribly expensive part of changing the ;; Resizing the Emacs frame can be a terribly expensive part of changing the
@ -280,8 +281,7 @@ users).")
;; Performance on Windows is considerably worse than elsewhere, especially if ;; Performance on Windows is considerably worse than elsewhere, especially if
;; WSL is involved. We'll need everything we can get. ;; WSL is involved. We'll need everything we can get.
(when IS-WINDOWS (when IS-WINDOWS
;; Reduce the workload when doing file IO (setq w32-get-true-file-attributes nil)) ; slightly faster IO
(setq w32-get-true-file-attributes nil))
;; Remove command line options that aren't relevant to our current OS; means ;; Remove command line options that aren't relevant to our current OS; means
;; slightly less to process at startup. ;; slightly less to process at startup.

View file

@ -49,8 +49,7 @@
;; Packages ;; Packages
(after! company-files (after! company-files
(pushnew! company-files--regexps (add-to-list 'company-files--regexps "file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)"))
"file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)"))
(use-package! company-prescient (use-package! company-prescient

View file

@ -122,7 +122,14 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
'(:columns '(:columns
((counsel-describe-variable-transformer (:width 40)) ; the original transformer ((counsel-describe-variable-transformer (:width 40)) ; the original transformer
(+ivy-rich-describe-variable-transformer (:width 50)) (+ivy-rich-describe-variable-transformer (:width 50))
(ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))) (ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))
'counsel-M-x
'(:columns
((counsel-M-x-transformer (:width 60))
(ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
'counsel-projectile-switch-to-buffer
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
;; Remove built-in coloring of buffer list; we do our own ;; Remove built-in coloring of buffer list; we do our own
(setq ivy-switch-buffer-faces-alist nil) (setq ivy-switch-buffer-faces-alist nil)
@ -135,11 +142,6 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(when switch-buffer-alist (when switch-buffer-alist
(setcar switch-buffer-alist '+ivy-rich-buffer-name))) (setcar switch-buffer-alist '+ivy-rich-buffer-name)))
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
(plist-put! ivy-rich-display-transformers-list
'counsel-projectile-switch-to-buffer
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
(ivy-rich-mode +1)) (ivy-rich-mode +1))
@ -153,7 +155,8 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(all-the-icons-ivy-setup) (all-the-icons-ivy-setup)
(after! counsel-projectile (after! counsel-projectile
(let ((all-the-icons-ivy-file-commands '(counsel-projectile (let ((all-the-icons-ivy-file-commands
'(counsel-projectile
counsel-projectile-find-file counsel-projectile-find-file
counsel-projectile-find-dir))) counsel-projectile-find-dir)))
(all-the-icons-ivy-setup)))) (all-the-icons-ivy-setup))))
@ -336,8 +339,9 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(use-package! ivy-prescient (use-package! ivy-prescient
:hook (ivy-mode . ivy-prescient-mode)
:when (featurep! +prescient) :when (featurep! +prescient)
:hook (ivy-mode . ivy-prescient-mode)
:hook (ivy-prescient-mode . prescient-persist-mode)
:init :init
(setq prescient-filter-method (setq prescient-filter-method
(if (featurep! +fuzzy) (if (featurep! +fuzzy)
@ -354,8 +358,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(ivy-prescient-re-builder str))) (ivy-prescient-re-builder str)))
;; NOTE prescient config duplicated with `company' ;; NOTE prescient config duplicated with `company'
(setq prescient-save-file (concat doom-cache-dir "prescient-save.el")) (setq prescient-save-file (concat doom-cache-dir "prescient-save.el")))
(prescient-persist-mode +1))
;;;###package swiper ;;;###package swiper

View file

@ -255,7 +255,6 @@
:desc "M-x" ":" #'execute-extended-command :desc "M-x" ":" #'execute-extended-command
:desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer
:desc "Org Capture" "X" #'org-capture :desc "Org Capture" "X" #'org-capture
;; C-u is used by evil ;; C-u is used by evil
:desc "Universal argument" "u" #'universal-argument :desc "Universal argument" "u" #'universal-argument
:desc "window" "w" evil-window-map :desc "window" "w" evil-window-map
@ -264,12 +263,10 @@
(:when (featurep! :ui popup) (:when (featurep! :ui popup)
:desc "Toggle last popup" "~" #'+popup/toggle) :desc "Toggle last popup" "~" #'+popup/toggle)
:desc "Find file" "." #'find-file :desc "Find file" "." #'find-file
:desc "Switch buffer" "," #'switch-to-buffer :desc "Switch buffer" "," #'switch-to-buffer
(:when (featurep! :ui workspaces) (:when (featurep! :ui workspaces)
:desc "Switch workspace buffer" "," #'persp-switch-to-buffer :desc "Switch workspace buffer" "," #'persp-switch-to-buffer
:desc "Switch buffer" "<" #'switch-to-buffer) :desc "Switch buffer" "<" #'switch-to-buffer)
:desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer :desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer
:desc "Resume last search" "'" :desc "Resume last search" "'"
(cond ((featurep! :completion ivy) #'ivy-resume) (cond ((featurep! :completion ivy) #'ivy-resume)

View file

@ -35,7 +35,7 @@
(defun +default/yank-buffer-filename () (defun +default/yank-buffer-filename ()
"Copy the current buffer's path to the kill ring." "Copy the current buffer's path to the kill ring."
(interactive) (interactive)
(if-let* ((filename (or buffer-file-name (bound-and-true-p list-buffers-directory)))) (if-let (filename (or buffer-file-name (bound-and-true-p list-buffers-directory)))
(message (kill-new (abbreviate-file-name filename))) (message (kill-new (abbreviate-file-name filename)))
(error "Couldn't find filename in current buffer"))) (error "Couldn't find filename in current buffer")))

View file

@ -56,6 +56,7 @@ Run one of the following commands.
#+BEGIN_SRC sh #+BEGIN_SRC sh
sudo pacman -S isync # mbsync sudo pacman -S isync # mbsync
# OR
sudo pacman -S offlineimap sudo pacman -S offlineimap
#+END_SRC #+END_SRC

View file

@ -97,7 +97,8 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
"v" #'find-variable "v" #'find-variable
"l" #'find-library))) "l" #'find-library)))
;; Adapted from http://www.modernemacs.com/post/comint-highlighting/ ;; Adapted from http://www.modernemacs.com/post/comint-highlighting/ to add
;; syntax highlighting to ielm REPLs.
(add-hook! 'ielm-mode-hook (add-hook! 'ielm-mode-hook
(defun +emacs-lisp-init-syntax-highlighting-h () (defun +emacs-lisp-init-syntax-highlighting-h ()
(font-lock-add-keywords (font-lock-add-keywords
@ -122,7 +123,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
;;;###package overseer ;;;###package overseer
(autoload 'overseer-test "overseer" nil t) (autoload 'overseer-test "overseer" nil t)
(remove-hook 'emacs-lisp-mode-hook 'overseer-enable-mode) (remove-hook 'emacs-lisp-mode-hook #'overseer-enable-mode)
(use-package! flycheck-cask (use-package! flycheck-cask

View file

@ -3,16 +3,16 @@
(use-package! intero (use-package! intero
:commands intero-mode :commands intero-mode
:init :hook (haskell-mode-local-vars . +haskell-init-intero-h)
(add-hook! 'haskell-mode-local-vars-hook :config
(defun +haskell-init-intero-h () (defun +haskell-init-intero-h ()
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed. "Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks." This is necessary because `intero-mode' doesn't do its own error checks."
(when (derived-mode-p 'haskell-mode) (when (derived-mode-p 'haskell-mode)
(if (executable-find "stack") (if (executable-find "stack")
(intero-mode +1) (intero-mode +1)
(message "Couldn't find stack. Refusing to enable intero-mode."))))) (message "Couldn't find stack. Refusing to enable intero-mode."))))
:config
(setq haskell-compile-cabal-build-command "stack build --fast") (setq haskell-compile-cabal-build-command "stack build --fast")
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition) (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
(set-company-backend! 'intero-mode 'intero-company) (set-company-backend! 'intero-mode 'intero-company)

View file

@ -6,9 +6,8 @@
:config :config
(when IS-MAC (when IS-MAC
(setq lsp-haskell-process-path-hie "hie-wrapper")) (setq lsp-haskell-process-path-hie "hie-wrapper"))
;; Does some strange indentation if it pastes in the snippet
(setq-hook! 'haskell-mode-hook yas-indent-line 'fixed)
(when (featurep! +ghcide) (when (featurep! +ghcide)
(setq lsp-haskell-process-path-hie "ghcide" (setq lsp-haskell-process-path-hie "ghcide"
lsp-haskell-process-args-hie nil))) lsp-haskell-process-args-hie nil))
;; Does some strange indentation if it pastes in the snippet
(setq-hook! 'haskell-mode-hook yas-indent-line 'fixed))

View file

@ -11,8 +11,8 @@
"An alist mapping languages to babel libraries. This is necessary for babel "An alist mapping languages to babel libraries. This is necessary for babel
libraries (ob-*.el) that don't match the name of the language. libraries (ob-*.el) that don't match the name of the language.
For example, with (fish . shell) will cause #+BEGIN_SRC fish to load ob-shell.el For example, (fish . shell) will cause #+BEGIN_SRC fish blocks to load
when executed.") ob-shell.el when executed.")
(defvar +org-babel-load-functions () (defvar +org-babel-load-functions ()
"A list of functions executed to load the current executing src block. They "A list of functions executed to load the current executing src block. They

View file

@ -22,7 +22,6 @@
(:map org-journal-search-mode-map (:map org-journal-search-mode-map
"C-n" #'org-journal-search-next "C-n" #'org-journal-search-next
"C-p" #'org-journal-search-previous) "C-p" #'org-journal-search-previous)
:localleader :localleader
(:map org-journal-mode-map (:map org-journal-mode-map
"c" #'org-journal-new-entry "c" #'org-journal-new-entry

View file

@ -11,7 +11,7 @@
;;; Packages ;;; Packages
(use-package! sh-script ; built-in (use-package! sh-script ; built-in
:mode ("\\.zunit\\'" . sh-mode) :mode ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode)
:mode ("/bspwmrc\\'" . sh-mode) :mode ("/bspwmrc\\'" . sh-mode)
:config :config
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) (set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))

View file

@ -24,10 +24,9 @@
(add-hook! '(css-mode-hook sass-mode-hook stylus-mode-hook) (add-hook! '(css-mode-hook sass-mode-hook stylus-mode-hook)
#'rainbow-mode) #'rainbow-mode)
;; built-in, and contains both css-mode & scss-mode ;; built-in. Contains both css-mode & scss-mode
(after! css-mode (after! css-mode
;; css-mode hooks apply to scss and less-css modes ;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(map! :localleader (map! :localleader
:map scss-mode-map :map scss-mode-map
"b" #'+css/scss-build "b" #'+css/scss-build
@ -61,5 +60,7 @@
;;; Tools ;;; Tools
(when (featurep! +lsp) (when (featurep! +lsp)
(add-hook! '(css-mode-hook sass-mode-hook less-css-mode-hook) (add-hook! '(css-mode-local-vars-hook
sass-mode-local-vars-hook
less-css-mode-local-vars-hook)
#'lsp!)) #'lsp!))

View file

@ -33,7 +33,7 @@ extension, try to guess one."
(file-name-extension buffer-file-name)) (file-name-extension buffer-file-name))
buffer-file-name buffer-file-name
(format "%s%s" (buffer-file-name (buffer-base-buffer)) (format "%s%s" (buffer-file-name (buffer-base-buffer))
(if-let* ((ext (cdr (assq major-mode +editorconfig-mode-alist)))) (if-let (ext (alist-get major-mode +editorconfig-mode-alist))
(concat "." ext) (concat "." ext)
""))))) "")))))
(funcall orig-fn))) (funcall orig-fn)))

View file

@ -62,10 +62,11 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(dolist (mode (doom-enlist modes)) (dolist (mode (doom-enlist modes))
(let ((hook (intern (format "%s-hook" mode))) (let ((hook (intern (format "%s-hook" mode)))
(fn (intern (format "+lookup--init-%s-handlers-h" mode)))) (fn (intern (format "+lookup--init-%s-handlers-h" mode))))
(cond ((null (car plist)) (if (null (car plist))
(progn
(remove-hook hook fn) (remove-hook hook fn)
(unintern fn nil)) (unintern fn nil))
((fset (fset
fn fn
(lambda () (lambda ()
(cl-destructuring-bind (&key definition references documentation file xref-backend async) (cl-destructuring-bind (&key definition references documentation file xref-backend async)
@ -85,7 +86,7 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(make-list 5 (or (eq major-mode mode) (make-list 5 (or (eq major-mode mode)
(and (boundp mode) (and (boundp mode)
(symbol-value mode)))))))) (symbol-value mode))))))))
(add-hook hook fn)))))) (add-hook hook fn)))))
;; ;;

View file

@ -70,7 +70,7 @@
(set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t) (set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t)
(add-hook 'magit-popup-mode-hook #'hide-mode-line-mode) (add-hook 'magit-popup-mode-hook #'hide-mode-line-mode)
;; Add --tags switch ;; Add additional switches that seem common enough
(transient-append-suffix 'magit-fetch "-p" (transient-append-suffix 'magit-fetch "-p"
'("-t" "Fetch all tags" ("-t" "--tags"))) '("-t" "Fetch all tags" ("-t" "--tags")))
(transient-append-suffix 'magit-pull "-r" (transient-append-suffix 'magit-pull "-r"

View file

@ -1,5 +1,10 @@
;;; ui/doom/config.el -*- lexical-binding: t; -*- ;;; ui/doom/config.el -*- lexical-binding: t; -*-
;;;###package pos-tip
(setq pos-tip-internal-border-width 6
pos-tip-border-width 1)
(use-package! doom-themes (use-package! doom-themes
:defer t :defer t
:init :init

View file

@ -1,5 +1,7 @@
;;; ui/fill-column/autoload.el -*- lexical-binding: t; -*- ;;; ui/fill-column/autoload.el -*- lexical-binding: t; -*-
;; DEPRECATED Replaced by `display-fill-column-indicator-mode' in Emacs 27+
;;;###autoload (autoload 'hl-fill-column-mode "hl-fill-column" nil t) ;;;###autoload (autoload 'hl-fill-column-mode "hl-fill-column" nil t)
;;;###autoload ;;;###autoload

View file

@ -110,6 +110,7 @@ prevent the popup(s) from messing up the UI (or vice versa)."
`(let* ((in-popup-p (+popup-buffer-p)) `(let* ((in-popup-p (+popup-buffer-p))
(popups (+popup-windows)) (popups (+popup-windows))
(+popup--inhibit-transient t) (+popup--inhibit-transient t)
buffer-list-update-hook
+popup--last) +popup--last)
(dolist (p popups) (dolist (p popups)
(+popup/close p 'force)) (+popup/close p 'force))

View file

@ -3,6 +3,7 @@
(defun +treemacs--init () (defun +treemacs--init ()
(require 'treemacs) (require 'treemacs)
(let ((origin-buffer (current-buffer))) (let ((origin-buffer (current-buffer)))
;; Toggle treemacs without prompting for the first project.
(cl-letf (((symbol-function 'treemacs-workspace->is-empty?) (cl-letf (((symbol-function 'treemacs-workspace->is-empty?)
(symbol-function 'ignore))) (symbol-function 'ignore)))
(treemacs--init)) (treemacs--init))