From b78fc4eb76854451fd915d57add25bd4134490b4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Apr 2020 15:29:29 -0400 Subject: [PATCH] Minor refactor & reformatting across the board --- core/autoload/fonts.el | 2 +- core/autoload/text.el | 12 +-- core/autoload/ui.el | 2 +- core/core-editor.el | 109 ++++++++++++++--------- core/core-lib.el | 2 +- core/core-packages.el | 59 ++++++------ core/core-ui.el | 15 ++-- core/core.el | 10 +-- modules/completion/company/config.el | 3 +- modules/completion/ivy/config.el | 27 +++--- modules/config/default/+evil-bindings.el | 3 - modules/config/default/autoload/text.el | 2 +- modules/email/mu4e/README.org | 1 + modules/lang/emacs-lisp/config.el | 5 +- modules/lang/haskell/+intero.el | 18 ++-- modules/lang/haskell/+lsp.el | 7 +- modules/lang/org/config.el | 4 +- modules/lang/org/contrib/journal.el | 1 - modules/lang/sh/config.el | 2 +- modules/lang/web/+css.el | 7 +- modules/tools/editorconfig/config.el | 2 +- modules/tools/lookup/autoload/lookup.el | 49 +++++----- modules/tools/magit/config.el | 2 +- modules/ui/doom/config.el | 5 ++ modules/ui/fill-column/autoload.el | 2 + modules/ui/popup/config.el | 1 + modules/ui/treemacs/autoload.el | 1 + 27 files changed, 189 insertions(+), 164 deletions(-) diff --git a/core/autoload/fonts.el b/core/autoload/fonts.el index 8df22d185..546e7cc0f 100644 --- a/core/autoload/fonts.el +++ b/core/autoload/fonts.el @@ -12,7 +12,7 @@ scaled up by `doom-big-font-increment'. See `doom-font' for details on acceptable values for this variable.") ;;;###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 `doom-big-font-mode' is enabled and `doom-big-font' is nil.") diff --git a/core/autoload/text.el b/core/autoload/text.el index 5371fa805..b56917d76 100644 --- a/core/autoload/text.el +++ b/core/autoload/text.el @@ -260,15 +260,9 @@ opposite indentation style." Respects `require-final-newline'." (interactive) - (goto-char (point-max)) - (skip-chars-backward " \t\n\v") - (when (looking-at "\n\\(\n\\|\\'\\)") - (forward-char 1)) - (when require-final-newline - (unless (bolp) - (insert "\n"))) - (when (looking-at "\n+") - (replace-match ""))) + (save-excursion + (goto-char (point-max)) + (delete-blank-lines))) ;;;###autoload (defun doom/dos2unix () diff --git a/core/autoload/ui.el b/core/autoload/ui.el index 3f142e5eb..56905444d 100644 --- a/core/autoload/ui.el +++ b/core/autoload/ui.el @@ -105,7 +105,7 @@ See `display-line-numbers' for what these values mean." (_ (symbol-name next)))))) ;;;###autoload -(defun doom/delete-frame () +(defun doom/delete-frame-with-prompt () "Delete the current frame, but ask for confirmation if it isn't empty." (interactive) (if (cdr (frame-list)) diff --git a/core/core-editor.el b/core/core-editor.el index 2a3bc6548..b95cebce4 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -87,7 +87,7 @@ possible." ;; 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-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/")))) (after! tramp @@ -106,39 +106,63 @@ possible." ;; ;;; Formatting -;; Indentation -(setq-default tab-width 4 - tab-always-indent t - indent-tabs-mode nil - fill-column 80) +;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a +;; more consistent default than 8-space tabs. It can be changed on a per-mode +;; basis anyway (and is, where tabs are the canonical style, like go-mode). +(setq-default indent-tabs-mode nil + tab-width 4) -;; Word wrapping -(setq-default word-wrap t - truncate-lines t - truncate-partial-width-windows nil) +;; Make `tabify' and `untabify' only affect indentation. Not tabs/spaces in the +;; middle of a line. +(setq tabify-regexp "^\t* [ \t]+") -(setq sentence-end-double-space nil - delete-trailing-lines nil - require-final-newline t - tabify-regexp "^\t* [ \t]+") ; for :retab +;; An archaic default in the age of widescreen 4k displays? I disagree. We still +;; frequently split our terminals and editor frames, or have them side-by-side, +;; using up more of that newly available horizontal real-estate. +(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) ;; ;;; Clipboard / kill-ring -;; Eliminate duplicates in the kill ring. That is, if you kill the same thing -;; twice, you won't have to use M-y twice to get past it to older entries in the -;; kill ring. +;; Cull duplicates in the kill ring to reduce bloat and make the kill ring +;; easier to peruse (with `counsel-yank-pop' or `helm-show-kill-ring'. (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)) ;; 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 (add-hook! 'tty-setup-hook (defun doom-init-clipboard-in-tty-emacs-h () @@ -154,7 +178,6 @@ possible." (push '("/LICENSE\\'" . 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. revert-without-query (list ".")) - ;; Instead of using `auto-revert-mode' or `global-auto-revert-mode', we employ - ;; lazy auto reverting on `focus-in-hook' and `doom-switch-buffer-hook'. + ;; Instead of `auto-revert-mode' or `global-auto-revert-mode', we lazily auto + ;; 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 - ;; grind Emacs to a halt if you do expensive IO (outside of Emacs) on the - ;; files you have open (like compression). We only really need to revert - ;; changes when we switch to a buffer or when we focus the Emacs frame. + ;; Autorevert normally abuses the heck out of inotify handles which can grind + ;; Emacs to a halt if you do expensive IO (outside of Emacs) on the files you + ;; have open (like compression). The only alternative is aggressive polling, + ;; which is unreliable and expensive with a lot of buffers open. (defun doom-auto-revert-buffer-h () "Auto revert current buffer, if necessary." (unless (or auto-revert-mode (active-minibuffer-window)) @@ -204,9 +227,9 @@ possible." (file-truename file) file)) (setq recentf-filename-handlers - '(substring-no-properties - doom--recent-file-truename - abbreviate-file-name) + '(substring-no-properties ; strip out lingering text properties + doom--recent-file-truename ; resolve symlinks of local files + abbreviate-file-name) ; replace $HOME with ~ recentf-save-file (concat doom-cache-dir "recentf") recentf-auto-cleanup 'never 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 files, so we replace calls to `pp' with the much faster `prin1'." :around #'save-place-alist-to-file - (cl-letf (((symbol-function #'pp) - (symbol-function #'prin1))) + (cl-letf (((symbol-function #'pp) #'prin1)) (funcall orig-fn))) (save-place-mode +1)) @@ -347,19 +369,18 @@ files, so we replace calls to `pp' with the much faster `prin1'." (use-package! dtrt-indent ;; Automatic detection of indent settings :when doom-interactive-mode - :defer t - :init - (add-hook! '(change-major-mode-after-body-hook read-only-mode-hook) - (defun doom-detect-indentation-h () - (unless (or (not after-init-time) - doom-inhibit-indent-detection - doom-large-file-p - (memq major-mode doom-detect-indentation-excluded-modes) - (member (substring (buffer-name) 0 1) '(" " "*"))) - ;; Don't display messages in the echo area, but still log them - (let ((inhibit-message (not doom-debug-mode))) - (dtrt-indent-mode +1))))) + :hook ((change-major-mode-after-body read-only-mode) . doom-detect-indentation-h) :config + (defun doom-detect-indentation-h () + (unless (or (not after-init-time) + doom-inhibit-indent-detection + doom-large-file-p + (memq major-mode doom-detect-indentation-excluded-modes) + (member (substring (buffer-name) 0 1) '(" " "*"))) + ;; Don't display messages in the echo area, but still log them + (let ((inhibit-message (not doom-debug-mode))) + (dtrt-indent-mode +1)))) + ;; Enable dtrt-indent even in smie modes so that it can update `tab-width', ;; `standard-indent' and `evil-shift-width' there as well. (setq dtrt-indent-run-after-smie t) diff --git a/core/core-lib.el b/core/core-lib.el index 0354c2d06..1bf435167 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -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 function which does the same as FUN, except that the last N arguments are fixed 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) (apply fn (append pre-args args)))) diff --git a/core/core-packages.el b/core/core-packages.el index ea21d41e7..388a5b16c 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -1,23 +1,21 @@ ;;; core/core-packages.el -*- lexical-binding: t; -*- ;; 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 -;; tempermental. ELPA sources suffer downtime occasionally, and often fail at -;; building some packages when GNU Tar is unavailable (e.g. MacOS users start -;; with BSD tar). There are also known gnutls errors in the current stable -;; release of Emacs (26.x) which bork TLS handshakes with ELPA repos (mainly -;; gnu.elpa.org). See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434. +;; tempermental. ELPA sources suffer downtime occasionally and often fail to +;; build packages when GNU Tar is unavailable (e.g. MacOS users start with BSD +;; tar). Known gnutls errors plague the current stable release of Emacs (26.x) +;; which bork TLS handshakes with ELPA repos (mainly gnu.elpa.org). See +;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3434. ;; ;; 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 -;; convenient. Straight (and Doom) can do rolling release, but it is optional -;; (and will eventually be opt-in). +;; convenient. Straight (and Doom) can do rolling release, but it is opt-in. ;; -;; ANyhow, interacting with this package management system is done through the -;; bin/doom script included with Doom Emacs. You'll find more about it by -;; running 'doom help' (I highly recommend you add it to your PATH), but here -;; are the highlights: +;; Interacting with this package management system is done through Doom's +;; bin/doom script. Find out more about it by running 'doom help' (I highly +;; recommend you add the script to your PATH). Here are some highlights: ;; ;; + `bin/doom install`: a wizard that guides you through setting up Doom and ;; your private config for the first time. @@ -83,35 +81,36 @@ missing) and shouldn't be deleted.") ("melpa" . ,(concat proto "://melpa.org/packages/")) ("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) -;; Don't save `package-selected-packages' to `custom-file' -(defadvice! doom--package-inhibit-custom-file-a (&optional value) - :override #'package--save-selected-packages - (if value (setq package-selected-packages value))) - -;; Refresh package.el the first time you call `package-install' +;; Refresh package.el the first time you call `package-install', so it can still +;; be used (e.g. to temporarily test packages). Remember to run 'doom sync' to +;; purge them; they can conflict with packages installed via straight! (add-transient-hook! 'package-install (package-refresh-contents)) -;;; straight + +;; +;;; Straight + (setq straight-base-dir doom-local-dir straight-repository-branch "develop" straight-cache-autoloads nil ; we already do this, and better. ;; Doom doesn't encourage you to modify packages in place. Disabling this - ;; makes 'doom refresh' instant (once everything set up), which is much - ;; nicer UX than the several seconds modification checks. + ;; makes 'doom sync' instant (once everything set up), which is much nicer + ;; UX than the several seconds modification checks. straight-check-for-modifications nil ;; We handle package.el ourselves (and a little more comprehensively) straight-enable-package-integration nil ;; Before switching to straight, `doom-local-dir' would average out at ;; around 100mb with half Doom's modules at ~230 packages. Afterwards, at - ;; around 1gb. With shallow cloning, that is reduced to ~400mb. This - ;; imposes an issue with packages that require their git history for - ;; certain things to work (like magit and org), but we can deal with that - ;; when we cross that bridge. + ;; around 1gb. With shallow cloning, that is reduced to ~400mb. This has + ;; no affect on packages that are pinned, however (run 'doom purge' to + ;; compact those after-the-fact). Some packages break when shallow cloned + ;; (like magit and org), but we'll deal with that elsewhere. straight-vc-git-default-clone-depth 1 ;; 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 ;; We handle it ourselves straight-fix-org nil) @@ -119,7 +118,7 @@ missing) and shouldn't be deleted.") (defadvice! doom--read-pinned-packages-a (orig-fn &rest args) "Read from `doom-pinned-packages' on top of straight's lockfiles." :around #'straight--lockfile-read-all - (append (apply orig-fn args) + (append (apply orig-fn args) ; lockfiles still take priority (doom-package-pinned-list))) @@ -260,7 +259,7 @@ elsewhere." (doplist! ((prop val) (list ,@plist) plist) (unless (null 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 (when-let (recipe (plist-get plist :recipe)) (cl-destructuring-bind @@ -286,8 +285,8 @@ elsewhere." "A convenience macro for disabling packages in bulk. Only use this macro in a module's (or your private) packages.el file." (macroexp-progn - (cl-loop for p in packages - collect `(package! ,p :disable t)))) + (mapcar (lambda (p) `(package! ,p :disable t)) + packages))) (defmacro unpin! (&rest targets) "Unpin packages in TARGETS. diff --git a/core/core-ui.el b/core/core-ui.el index 5771ab2ec..3f4563f7b 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -328,8 +328,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original window-divider-default-right-width 1) (add-hook 'doom-init-ui-hook #'window-divider-mode) -;; Prompt the user for confirmation when deleting a non-empty frame -(global-set-key [remap delete-frame] #'doom/delete-frame) +;; Prompt for confirmation when deleting a non-empty frame; a last line of +;; defense against accidental loss of work. +(global-set-key [remap delete-frame] #'doom/delete-frame-with-prompt) ;; always avoid GUI (setq use-dialog-box nil) @@ -513,10 +514,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; languages like Lisp. (setq rainbow-delimiters-max-face-count 3) -;;;###package pos-tip -(setq pos-tip-internal-border-width 6 - pos-tip-border-width 1) - ;; ;;; 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) ;; Initialize custom switch-{buffer,window,frame} hooks: + ;; ;; + `doom-switch-buffer-hook' ;; + `doom-switch-window-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 'focus-in-hook #'doom-run-switch-frame-hooks-h) (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") ;; 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) (fset 'define-fringe-bitmap #'ignore)) diff --git a/core/core.el b/core/core.el index bfa35ae11..94739aafd 100644 --- a/core/core.el +++ b/core/core.el @@ -250,8 +250,8 @@ users).") ;;; Optimizations ;; 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 -;; isn't a good idea, and suggests this is just as good: +;; this to `nil' in the past, but the `bidi-display-reordering's docs say that +;; is an undefined state and suggest this to be just as good: (setq-default bidi-display-reordering 'left-to-right bidi-paragraph-direction 'left-to-right) @@ -261,7 +261,8 @@ users).") (setq highlight-nonselected-windows nil) ;; 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) ;; 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 ;; WSL is involved. We'll need everything we can get. (when IS-WINDOWS - ;; Reduce the workload when doing file IO - (setq w32-get-true-file-attributes nil)) + (setq w32-get-true-file-attributes nil)) ; slightly faster IO ;; Remove command line options that aren't relevant to our current OS; means ;; slightly less to process at startup. diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index 3c30a6de7..62a1a4f52 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -49,8 +49,7 @@ ;; Packages (after! company-files - (pushnew! company-files--regexps - "file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)")) + (add-to-list 'company-files--regexps "file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)")) (use-package! company-prescient diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index c8fe85553..8688311b6 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -122,7 +122,14 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." '(:columns ((counsel-describe-variable-transformer (:width 40)) ; the original transformer (+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 (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 (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)) @@ -153,9 +155,10 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." (all-the-icons-ivy-setup) (after! counsel-projectile - (let ((all-the-icons-ivy-file-commands '(counsel-projectile - counsel-projectile-find-file - counsel-projectile-find-dir))) + (let ((all-the-icons-ivy-file-commands + '(counsel-projectile + counsel-projectile-find-file + counsel-projectile-find-dir))) (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 - :hook (ivy-mode . ivy-prescient-mode) :when (featurep! +prescient) + :hook (ivy-mode . ivy-prescient-mode) + :hook (ivy-prescient-mode . prescient-persist-mode) :init (setq prescient-filter-method (if (featurep! +fuzzy) @@ -354,8 +358,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." (ivy-prescient-re-builder str))) ;; NOTE prescient config duplicated with `company' - (setq prescient-save-file (concat doom-cache-dir "prescient-save.el")) - (prescient-persist-mode +1)) + (setq prescient-save-file (concat doom-cache-dir "prescient-save.el"))) ;;;###package swiper diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index bfbee4b28..a939ca734 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -255,7 +255,6 @@ :desc "M-x" ":" #'execute-extended-command :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer :desc "Org Capture" "X" #'org-capture - ;; C-u is used by evil :desc "Universal argument" "u" #'universal-argument :desc "window" "w" evil-window-map @@ -264,12 +263,10 @@ (:when (featurep! :ui popup) :desc "Toggle last popup" "~" #'+popup/toggle) :desc "Find file" "." #'find-file - :desc "Switch buffer" "," #'switch-to-buffer (:when (featurep! :ui workspaces) :desc "Switch workspace buffer" "," #'persp-switch-to-buffer :desc "Switch buffer" "<" #'switch-to-buffer) - :desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer :desc "Resume last search" "'" (cond ((featurep! :completion ivy) #'ivy-resume) diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index d8f8c0293..7c523817e 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -35,7 +35,7 @@ (defun +default/yank-buffer-filename () "Copy the current buffer's path to the kill ring." (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))) (error "Couldn't find filename in current buffer"))) diff --git a/modules/email/mu4e/README.org b/modules/email/mu4e/README.org index 682b2049b..74ef8b5aa 100644 --- a/modules/email/mu4e/README.org +++ b/modules/email/mu4e/README.org @@ -56,6 +56,7 @@ Run one of the following commands. #+BEGIN_SRC sh sudo pacman -S isync # mbsync +# OR sudo pacman -S offlineimap #+END_SRC diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index d9cd34768..7d4bf782d 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -97,7 +97,8 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.") "v" #'find-variable "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 (defun +emacs-lisp-init-syntax-highlighting-h () (font-lock-add-keywords @@ -122,7 +123,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.") ;;;###package overseer (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 diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 2986dd2bd..f8d84177c 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -3,16 +3,16 @@ (use-package! intero :commands intero-mode - :init - (add-hook! 'haskell-mode-local-vars-hook - (defun +haskell-init-intero-h () - "Initializes `intero-mode' in haskell-mode, unless stack isn't installed. -This is necessary because `intero-mode' doesn't do its own error checks." - (when (derived-mode-p 'haskell-mode) - (if (executable-find "stack") - (intero-mode +1) - (message "Couldn't find stack. Refusing to enable intero-mode."))))) + :hook (haskell-mode-local-vars . +haskell-init-intero-h) :config + (defun +haskell-init-intero-h () + "Initializes `intero-mode' in haskell-mode, unless stack isn't installed. +This is necessary because `intero-mode' doesn't do its own error checks." + (when (derived-mode-p 'haskell-mode) + (if (executable-find "stack") + (intero-mode +1) + (message "Couldn't find stack. Refusing to enable intero-mode.")))) + (setq haskell-compile-cabal-build-command "stack build --fast") (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition) (set-company-backend! 'intero-mode 'intero-company) diff --git a/modules/lang/haskell/+lsp.el b/modules/lang/haskell/+lsp.el index eb54d0084..4b9009e83 100644 --- a/modules/lang/haskell/+lsp.el +++ b/modules/lang/haskell/+lsp.el @@ -6,9 +6,8 @@ :config (when IS-MAC (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) (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)) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 1693decdc..4dff5a27a 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -11,8 +11,8 @@ "An alist mapping languages to babel libraries. This is necessary for babel 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 -when executed.") +For example, (fish . shell) will cause #+BEGIN_SRC fish blocks to load +ob-shell.el when executed.") (defvar +org-babel-load-functions () "A list of functions executed to load the current executing src block. They diff --git a/modules/lang/org/contrib/journal.el b/modules/lang/org/contrib/journal.el index 92eff58af..a8d0fcbf7 100644 --- a/modules/lang/org/contrib/journal.el +++ b/modules/lang/org/contrib/journal.el @@ -22,7 +22,6 @@ (:map org-journal-search-mode-map "C-n" #'org-journal-search-next "C-p" #'org-journal-search-previous) - :localleader (:map org-journal-mode-map "c" #'org-journal-new-entry diff --git a/modules/lang/sh/config.el b/modules/lang/sh/config.el index 9777bda89..cd2e85ff8 100755 --- a/modules/lang/sh/config.el +++ b/modules/lang/sh/config.el @@ -11,7 +11,7 @@ ;;; Packages (use-package! sh-script ; built-in - :mode ("\\.zunit\\'" . sh-mode) + :mode ("\\.\\(?:zunit\\|env\\)\\'" . sh-mode) :mode ("/bspwmrc\\'" . sh-mode) :config (set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) diff --git a/modules/lang/web/+css.el b/modules/lang/web/+css.el index f182a6ef8..238b2bf6a 100644 --- a/modules/lang/web/+css.el +++ b/modules/lang/web/+css.el @@ -24,10 +24,9 @@ (add-hook! '(css-mode-hook sass-mode-hook stylus-mode-hook) #'rainbow-mode) -;; built-in, and contains both css-mode & scss-mode +;; built-in. Contains both css-mode & scss-mode (after! css-mode ;; css-mode hooks apply to scss and less-css modes - (add-hook 'css-mode-hook #'rainbow-delimiters-mode) (map! :localleader :map scss-mode-map "b" #'+css/scss-build @@ -61,5 +60,7 @@ ;;; Tools (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!)) diff --git a/modules/tools/editorconfig/config.el b/modules/tools/editorconfig/config.el index 20d4c8007..600a9c728 100644 --- a/modules/tools/editorconfig/config.el +++ b/modules/tools/editorconfig/config.el @@ -33,7 +33,7 @@ extension, try to guess one." (file-name-extension buffer-file-name)) buffer-file-name (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) ""))))) (funcall orig-fn))) diff --git a/modules/tools/lookup/autoload/lookup.el b/modules/tools/lookup/autoload/lookup.el index 163865c7f..e9da24087 100644 --- a/modules/tools/lookup/autoload/lookup.el +++ b/modules/tools/lookup/autoload/lookup.el @@ -62,30 +62,31 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g. (dolist (mode (doom-enlist modes)) (let ((hook (intern (format "%s-hook" mode))) (fn (intern (format "+lookup--init-%s-handlers-h" mode)))) - (cond ((null (car plist)) - (remove-hook hook fn) - (unintern fn nil)) - ((fset - fn - (lambda () - (cl-destructuring-bind (&key definition references documentation file xref-backend async) - plist - (cl-mapc #'+lookup--set-handler - (list definition - references - documentation - file - xref-backend) - (list '+lookup-definition-functions - '+lookup-references-functions - '+lookup-documentation-functions - '+lookup-file-functions - 'xref-backend-functions) - (make-list 5 async) - (make-list 5 (or (eq major-mode mode) - (and (boundp mode) - (symbol-value mode)))))))) - (add-hook hook fn)))))) + (if (null (car plist)) + (progn + (remove-hook hook fn) + (unintern fn nil)) + (fset + fn + (lambda () + (cl-destructuring-bind (&key definition references documentation file xref-backend async) + plist + (cl-mapc #'+lookup--set-handler + (list definition + references + documentation + file + xref-backend) + (list '+lookup-definition-functions + '+lookup-references-functions + '+lookup-documentation-functions + '+lookup-file-functions + 'xref-backend-functions) + (make-list 5 async) + (make-list 5 (or (eq major-mode mode) + (and (boundp mode) + (symbol-value mode)))))))) + (add-hook hook fn))))) ;; diff --git a/modules/tools/magit/config.el b/modules/tools/magit/config.el index 35decef8e..9bb3d8767 100644 --- a/modules/tools/magit/config.el +++ b/modules/tools/magit/config.el @@ -70,7 +70,7 @@ (set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t) (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" '("-t" "Fetch all tags" ("-t" "--tags"))) (transient-append-suffix 'magit-pull "-r" diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index ad39be7f0..5b2d0688d 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -1,5 +1,10 @@ ;;; 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 :defer t :init diff --git a/modules/ui/fill-column/autoload.el b/modules/ui/fill-column/autoload.el index 7e69130a0..2aede4639 100644 --- a/modules/ui/fill-column/autoload.el +++ b/modules/ui/fill-column/autoload.el @@ -1,5 +1,7 @@ ;;; 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 diff --git a/modules/ui/popup/config.el b/modules/ui/popup/config.el index e849e4cae..17d36419b 100644 --- a/modules/ui/popup/config.el +++ b/modules/ui/popup/config.el @@ -110,6 +110,7 @@ prevent the popup(s) from messing up the UI (or vice versa)." `(let* ((in-popup-p (+popup-buffer-p)) (popups (+popup-windows)) (+popup--inhibit-transient t) + buffer-list-update-hook +popup--last) (dolist (p popups) (+popup/close p 'force)) diff --git a/modules/ui/treemacs/autoload.el b/modules/ui/treemacs/autoload.el index a11fa2de6..f761d3be3 100644 --- a/modules/ui/treemacs/autoload.el +++ b/modules/ui/treemacs/autoload.el @@ -3,6 +3,7 @@ (defun +treemacs--init () (require 'treemacs) (let ((origin-buffer (current-buffer))) + ;; Toggle treemacs without prompting for the first project. (cl-letf (((symbol-function 'treemacs-workspace->is-empty?) (symbol-function 'ignore))) (treemacs--init))