nit: comment revision and formatting

For clarity, to enforce conventions, and explain the unexplained.
This commit is contained in:
Henrik Lissner 2022-09-13 18:19:56 +02:00
parent 75881c7d45
commit 6ddaed5cdd
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
8 changed files with 54 additions and 34 deletions

View file

@ -1,4 +1,6 @@
;;; doom-editor.el -*- lexical-binding: t; -*- ;;; doom-editor.el --- defaults for text editing in Doom -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(defvar doom-detect-indentation-excluded-modes (defvar doom-detect-indentation-excluded-modes
'(fundamental-mode pascal-mode so-long-mode doom-docs-org-mode) '(fundamental-mode pascal-mode so-long-mode doom-docs-org-mode)

View file

@ -1,4 +1,4 @@
;;; doom-keybinds.el -*- lexical-binding: t; -*- ;;; doom-keybinds.el --- defaults for Doom's keybinds -*- lexical-binding: t; -*-
;;; Commentary: ;;; Commentary:
;; ;;
;; A centralized keybinds system, integrated with `which-key' to preview ;; A centralized keybinds system, integrated with `which-key' to preview

View file

@ -104,7 +104,6 @@ before the user's private module.")
This closure takes two arguments: a cons cell containing (CATEGORY . MODULE) This closure takes two arguments: a cons cell containing (CATEGORY . MODULE)
symbols, and that module's plist." symbols, and that module's plist."
(declare (pure t) (side-effect-free t))
(lambda (module plist) (lambda (module plist)
(let ((doom--current-module module) (let ((doom--current-module module)
(doom--current-flags (cdr (get (car module) (cdr module)))) (doom--current-flags (cdr (get (car module) (cdr module))))

View file

@ -1,4 +1,6 @@
;;; doom-projects.el -*- lexical-binding: t; -*- ;;; doom-projects.el --- defaults for project management in Doom -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(defvar doom-projectile-cache-limit 10000 (defvar doom-projectile-cache-limit 10000
"If any project cache surpasses this many files it is purged when quitting "If any project cache surpasses this many files it is purged when quitting

View file

@ -25,18 +25,18 @@
;;; Reasonable defaults for interactive sessions ;;; Reasonable defaults for interactive sessions
;;; Runtime optimizations ;;; Runtime optimizations
;; A second, case-insensitive pass over `auto-mode-alist' is time wasted. ;; PERF: A second, case-insensitive pass over `auto-mode-alist' is time wasted.
(setq auto-mode-case-fold nil) (setq auto-mode-case-fold nil)
;; Disable bidirectional text scanning for a modest performance boost. I've set ;; PERF: Disable bidirectional text scanning for a modest performance boost.
;; this to `nil' in the past, but the `bidi-display-reordering's docs say that ;; I've set this to `nil' in the past, but the `bidi-display-reordering's docs
;; is an undefined state and suggest this to be just as good: ;; say that 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)
;; Disabling the BPA makes redisplay faster, but might produce incorrect display ;; PERF: Disabling BPA makes redisplay faster, but might produce incorrect
;; reordering of bidirectional text with embedded parentheses and other bracket ;; reordering of bidirectional text with embedded parentheses (and other
;; characters whose 'paired-bracket' Unicode property is non-nil. ;; bracket characters whose 'paired-bracket' Unicode property is non-nil).
(setq bidi-inhibit-bpa t) ; Emacs 27+ only (setq bidi-inhibit-bpa t) ; Emacs 27+ only
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions ;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
@ -82,7 +82,7 @@
(eval-when! (boundp 'w32-get-true-file-attributes) (eval-when! (boundp 'w32-get-true-file-attributes)
(setq w32-get-true-file-attributes nil ; decrease file IO workload (setq w32-get-true-file-attributes nil ; decrease file IO workload
w32-pipe-read-delay 0 ; faster IPC w32-pipe-read-delay 0 ; faster IPC
w32-pipe-buffer-size (* 64 1024))) ; read more at a time (was 4K) w32-pipe-buffer-size (* 64 1024))) ; read more at a time (was 4K)
;; The GC introduces annoying pauses and stuttering into our Emacs experience, ;; The GC introduces annoying pauses and stuttering into our Emacs experience,
;; so we use `gcmh' to stave off the GC while we're using Emacs, and provoke it ;; so we use `gcmh' to stave off the GC while we're using Emacs, and provoke it
@ -300,6 +300,10 @@ If RETURN-P, return the message as a string instead of displaying it."
(float-time (time-subtract (current-time) before-init-time)))))) (float-time (time-subtract (current-time) before-init-time))))))
;;
;;; Let 'er rip!
;;; Load loaddefs
;; Doom caches a lot of information in `doom-autoloads-file'. Module and package ;; Doom caches a lot of information in `doom-autoloads-file'. Module and package
;; autoloads, autodefs like `set-company-backend!', and variables like ;; autoloads, autodefs like `set-company-backend!', and variables like
;; `doom-modules', `doom-disabled-packages', `load-path', `auto-mode-alist', and ;; `doom-modules', `doom-disabled-packages', `load-path', `auto-mode-alist', and
@ -321,6 +325,10 @@ If RETURN-P, return the message as a string instead of displaying it."
(list "Doom is in an incomplete state" (list "Doom is in an incomplete state"
"run 'doom sync' on the command line to repair it"))))) "run 'doom sync' on the command line to repair it")))))
;;; Load envvar file
;; 'doom env' generates an envvar file. This is a snapshot of your shell
;; environment, which Doom loads here. This is helpful in scenarios where Emacs
;; is launched from an environment detached from the user's shell environment.
(when (and (or (display-graphic-p) (when (and (or (display-graphic-p)
(daemonp)) (daemonp))
doom-env-file) doom-env-file)
@ -336,9 +344,10 @@ If RETURN-P, return the message as a string instead of displaying it."
(doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook)) (doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook))
(doom-run-hook-on 'doom-first-input-hook '(pre-command-hook)) (doom-run-hook-on 'doom-first-input-hook '(pre-command-hook))
;; There's a chance the user will later use package.el or straight in this ;;; Setup autoloads for major core libraries
;; interactive session. If they do, make sure they're properly initialized ;; UX: There's a chance the user will later use package.el or straight in this
;; when they do. ;; interactive session. If they do, make sure they're properly initialized
;; when they do.
(autoload 'doom-initialize-packages "doom-packages") (autoload 'doom-initialize-packages "doom-packages")
(eval-after-load 'package '(require 'doom-packages)) (eval-after-load 'package '(require 'doom-packages))
(eval-after-load 'straight '(doom-initialize-packages)) (eval-after-load 'straight '(doom-initialize-packages))

View file

@ -1,4 +1,6 @@
;;; doom-ui.el -*- lexical-binding: t; -*- ;;; doom-ui.el --- defaults for Doom's aesthetics -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code;
;; ;;
;;; Variables ;;; Variables
@ -253,13 +255,14 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; when resizing too many windows at once or rapidly. ;; when resizing too many windows at once or rapidly.
(setq window-resize-pixelwise nil) (setq window-resize-pixelwise nil)
;; Disable tool, menu, and scrollbars. Doom is designed to be keyboard-centric, ;; UI: Doom strives to be keyboard-centric, so I consider these UI elements
;; so these are just clutter (the scrollbar also impacts performance). Whats ;; clutter. Initializing them also costs a morsel of startup time. Whats more,
;; more, the menu bar exposes functionality that Doom doesn't endorse. ;; the menu bar exposes functionality that Doom doesn't endorse. Perhaps one
;; day Doom will support these, but today is not that day.
;; ;;
;; I am intentionally not calling `menu-bar-mode', `tool-bar-mode', and ;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
;; `scroll-bar-mode' because they do extra and unnecessary work that can be more ;; `scroll-bar-mode' because they do extra work to manipulate frame variables
;; concisely and efficiently expressed with these six lines: ;; that isn't necessary this early in the startup process.
(push '(menu-bar-lines . 0) default-frame-alist) (push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist) (push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist) (push '(vertical-scroll-bars) default-frame-alist)
@ -268,9 +271,11 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(setq menu-bar-mode nil (setq menu-bar-mode nil
tool-bar-mode nil tool-bar-mode nil
scroll-bar-mode nil) scroll-bar-mode nil)
;; Note, that disabling `menu-bar-mode' can cause issues on MacOS. See the
;; :os macos module for a fix.
;; The native border "consumes" a pixel of the fringe on righter-most splits, ;; FIX: The native border "consumes" a pixel of the fringe on righter-most
;; `window-divider' does not. Available since Emacs 25.1. ;; splits, `window-divider' does not. Available since Emacs 25.1.
(setq window-divider-default-places t (setq window-divider-default-places t
window-divider-default-bottom-width 1 window-divider-default-bottom-width 1
window-divider-default-right-width 1) window-divider-default-right-width 1)
@ -285,8 +290,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(when IS-LINUX (when IS-LINUX
(setq x-gtk-use-system-tooltips nil)) (setq x-gtk-use-system-tooltips nil))
;; Favor vertical splits over horizontal ones. Monitors are trending toward ;; UX: Favor vertical splits over horizontal ones. Monitors are trending toward
;; wide, rather than tall. ;; wide, rather than tall.
(setq split-width-threshold 160 (setq split-width-threshold 160
split-height-threshold nil) split-height-threshold nil)
@ -309,7 +314,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Typing yes/no is obnoxious when y/n will do ;; Typing yes/no is obnoxious when y/n will do
(if (boundp 'use-short-answers) (if (boundp 'use-short-answers)
(setq use-short-answers t) (setq use-short-answers t)
;; DEPRECATED Remove when we drop 27.x support ;; DEPRECATED: Remove when we drop 27.x support
(advice-add #'yes-or-no-p :override #'y-or-n-p)) (advice-add #'yes-or-no-p :override #'y-or-n-p))
;; Try to keep the cursor out of the read-only portions of the minibuffer. ;; Try to keep the cursor out of the read-only portions of the minibuffer.

View file

@ -344,7 +344,8 @@ users).")
;; ones) abuse it to build paths for storage/cache files (instead of correctly ;; ones) abuse it to build paths for storage/cache files (instead of correctly
;; using `locate-user-emacs-file'). This change ensures that said data files ;; using `locate-user-emacs-file'). This change ensures that said data files
;; are never saved to the root of your emacs directory *and* saves us the ;; are never saved to the root of your emacs directory *and* saves us the
;; trouble setting a million directory/file variables. ;; trouble of setting a million directory/file variables. But it may throw off
;; anyone (or any package) that uses it to search for your Emacs initfiles.
(setq user-emacs-directory doom-cache-dir) (setq user-emacs-directory doom-cache-dir)
;; ...However, this may surprise packages (and users) that read ;; ...However, this may surprise packages (and users) that read
@ -380,6 +381,7 @@ Otherwise, `en/disable-command' (in novice.el.gz) is hardcoded to write them to
;; ;;
;;; Reasonable, global defaults ;;; Reasonable, global defaults
;;; Reduce unnecessary/unactionable warnings/logs
;; Disable warnings from the legacy advice API. They aren't actionable or ;; Disable warnings from the legacy advice API. They aren't actionable or
;; useful, and often come from third party packages. ;; useful, and often come from third party packages.
(setq ad-redefinition-action 'accept) (setq ad-redefinition-action 'accept)
@ -396,6 +398,7 @@ Otherwise, `en/disable-command' (in novice.el.gz) is hardcoded to write them to
(setq debug-on-error init-file-debug (setq debug-on-error init-file-debug
jka-compr-verbose init-file-debug) jka-compr-verbose init-file-debug)
;;; Stricter security defaults
;; Emacs is essentially one huge security vulnerability, what with all the ;; Emacs is essentially one huge security vulnerability, what with all the
;; dependencies it pulls in from all corners of the globe. Let's try to be a ;; dependencies it pulls in from all corners of the globe. Let's try to be a
;; *little* more discerning. ;; *little* more discerning.

View file

@ -12,7 +12,7 @@
;;; Compatibilty fixes ;;; Compatibilty fixes
;; Curse Lion and its sudden but inevitable fullscreen mode! ;; Curse Lion and its sudden but inevitable fullscreen mode!
;; NOTE Meaningless to railwaycat's emacs-mac build ;; This is meaningless to railwaycat's emacs-mac build though.
(setq ns-use-native-fullscreen nil) (setq ns-use-native-fullscreen nil)
;; Visit files opened outside of Emacs in existing frame, not a new one ;; Visit files opened outside of Emacs in existing frame, not a new one
@ -29,11 +29,11 @@
(require 'ns-auto-titlebar nil t) (require 'ns-auto-titlebar nil t)
(ns-auto-titlebar-mode +1)) (ns-auto-titlebar-mode +1))
;; HACK On MacOS, disabling the menu bar makes MacOS treat Emacs as a ;; HACK: On MacOS, disabling the menu bar makes MacOS treat Emacs as a
;; non-application window -- which means it doesn't automatically capture ;; non-application window -- which means it doesn't automatically capture
;; focus when it is started, among other things, so enable the menu-bar for ;; focus when it is started, among other things, so enable the menu-bar for
;; GUI frames, but keep it disabled in terminal frames because there it ;; GUI frames, but keep it disabled in terminal frames because there it
;; activates an ugly, in-frame menu bar. ;; activates an ugly, in-frame menu bar.
(add-hook! '(window-setup-hook after-make-frame-functions) (add-hook! '(window-setup-hook after-make-frame-functions)
(defun doom-init-menu-bar-in-gui-frames-h (&optional frame) (defun doom-init-menu-bar-in-gui-frames-h (&optional frame)
"Re-enable menu-bar-lines in GUI frames." "Re-enable menu-bar-lines in GUI frames."