Minor refactors & comment revision

This commit is contained in:
Henrik Lissner 2020-11-19 23:00:13 -05:00
parent 0d6c32ff25
commit 4dab595ad3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 20 additions and 24 deletions

View file

@ -6,7 +6,7 @@
:; [ "${__DOOMCODE:-0}" -eq 128 ] && { "`$EMACS -Q --batch --eval '(princ temporary-file-directory)'`/doom.sh" "$0" "$@" && true; __DOOMCODE=$?; } :; [ "${__DOOMCODE:-0}" -eq 128 ] && { "`$EMACS -Q --batch --eval '(princ temporary-file-directory)'`/doom.sh" "$0" "$@" && true; __DOOMCODE=$?; }
:; exit $__DOOMCODE :; exit $__DOOMCODE
;; The garbage collector isn't important during CLI ops. A higher threshold ;; The garbage collector isn't as important during CLI ops. A higher threshold
;; makes it 15-30% faster, but set it too high and we risk spiralling memory ;; makes it 15-30% faster, but set it too high and we risk spiralling memory
;; usage in longer sessions. ;; usage in longer sessions.
(setq gc-cons-threshold 134217728) ; 128mb (setq gc-cons-threshold 134217728) ; 128mb
@ -16,8 +16,7 @@
(setq load-prefer-newer t) (setq load-prefer-newer t)
;; Ensure Doom runs out of this file's parent directory, where Doom is ;; Ensure Doom runs out of this file's parent directory, where Doom is
;; presumably installed. EMACSDIR is set in the shell script preamble earlier in ;; presumably installed. Use the EMACSDIR envvar to change this.
;; this file.
(setq user-emacs-directory (setq user-emacs-directory
(if (getenv "EMACSDIR") (if (getenv "EMACSDIR")
(file-name-as-directory (expand-file-name (getenv "EMACSDIR"))) (file-name-as-directory (expand-file-name (getenv "EMACSDIR")))
@ -62,11 +61,9 @@
(load (expand-file-name "core/core.el" user-emacs-directory) nil t) (load (expand-file-name "core/core.el" user-emacs-directory) nil t)
(require 'core-cli) (require 'core-cli)
;; Use our own home-grown debugger to display and log errors + backtraces. ;; I use our own home-grown debugger so we can capture and store backtraces,
;; Control over its formatting is important, because Emacs produces ;; make them more presentable, and make it easier for users to produce better
;; difficult-to-read debug information otherwise. By making its errors more ;; bug reports!
;; presentable (and storing them somewhere users can access later) we go a long
;; way toward making it easier for users to write better bug reports.
(setq debugger #'doom-cli--debugger (setq debugger #'doom-cli--debugger
debug-on-error t debug-on-error t
debug-ignored-errors nil) debug-ignored-errors nil)
@ -83,12 +80,12 @@
;; return a boolean, integer (error code) or throw an 'exit event, which ;; return a boolean, integer (error code) or throw an 'exit event, which
;; we handle specially. ;; we handle specially.
(apply #'doom-cli-execute :doom (cdr (member "--" argv)))) (apply #'doom-cli-execute :doom (cdr (member "--" argv))))
;; Any non-zero integer is treated as an error code. ;; Any non-zero integer is treated as an explicit exit code.
((and (pred integerp) code) code) ((and (pred integerp) code) code)
;; If, instead, we were given a list or string, copy these as shell script ;; If, instead, we were given a string or list of strings, copy these as
;; commands to a temp script file which this script will execute after this ;; shell script commands to a temporary script file which this script will
;; session finishes. Also accepts special keywords, like `:restart', to rerun ;; execute after this session finishes. Also accepts special keywords, like
;; the current command. ;; `:restart', to rerun the current command.
((and (or (pred consp) ((and (or (pred consp)
(pred stringp) (pred stringp)
(pred keywordp)) (pred keywordp))

View file

@ -25,7 +25,7 @@
(defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix))) (defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix)))
;; Unix tools look for HOME, but this is normally not defined on Windows. ;; Unix tools look for HOME, but this is normally not defined on Windows.
(when (and IS-WINDOWS (null (getenv "HOME"))) (when (and IS-WINDOWS (null (getenv-internal "HOME")))
(setenv "HOME" (getenv "USERPROFILE"))) (setenv "HOME" (getenv "USERPROFILE")))
;; Ensure `doom-core-dir' is in `load-path' ;; Ensure `doom-core-dir' is in `load-path'
@ -74,7 +74,7 @@
(defvar doom-init-time nil (defvar doom-init-time nil
"The time it took, in seconds, for Doom Emacs to initialize.") "The time it took, in seconds, for Doom Emacs to initialize.")
(defvar doom-debug-p (or (getenv "DEBUG") init-file-debug) (defvar doom-debug-p (or (getenv-internal "DEBUG") init-file-debug)
"If non-nil, Doom will log more. "If non-nil, Doom will log more.
Use `doom-debug-mode' to toggle it. The --debug-init flag and setting the DEBUG Use `doom-debug-mode' to toggle it. The --debug-init flag and setting the DEBUG
@ -95,7 +95,7 @@ envvar will enable this at startup.")
"The root directory for Doom's modules. Must end with a slash.") "The root directory for Doom's modules. Must end with a slash.")
(defconst doom-local-dir (defconst doom-local-dir
(if-let (localdir (getenv "DOOMLOCALDIR")) (if-let (localdir (getenv-internal "DOOMLOCALDIR"))
(expand-file-name (file-name-as-directory localdir)) (expand-file-name (file-name-as-directory localdir))
(concat doom-emacs-dir ".local/")) (concat doom-emacs-dir ".local/"))
"Root directory for local storage. "Root directory for local storage.
@ -120,11 +120,11 @@ Use this for files that change often, like cache files. Must end with a slash.")
"Where Doom's documentation files are stored. Must end with a slash.") "Where Doom's documentation files are stored. Must end with a slash.")
(defconst doom-private-dir (defconst doom-private-dir
(if-let (doomdir (getenv "DOOMDIR")) (if-let (doomdir (getenv-internal "DOOMDIR"))
(expand-file-name (file-name-as-directory doomdir)) (expand-file-name (file-name-as-directory doomdir))
(or (let ((xdgdir (or (let ((xdgdir
(expand-file-name "doom/" (expand-file-name "doom/"
(or (getenv "XDG_CONFIG_HOME") (or (getenv-internal "XDG_CONFIG_HOME")
"~/.config")))) "~/.config"))))
(if (file-directory-p xdgdir) xdgdir)) (if (file-directory-p xdgdir) xdgdir))
"~/.doom.d/")) "~/.doom.d/"))
@ -214,7 +214,7 @@ users).")
;; 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 at ;; dependencies it pulls in from all corners of the globe. Let's try to be at
;; least a little more discerning. ;; least a little more discerning.
(setq gnutls-verify-error (not (getenv "INSECURE")) (setq gnutls-verify-error (not (getenv-internal "INSECURE"))
gnutls-algorithm-priority gnutls-algorithm-priority
(when (boundp 'libgnutls-version) (when (boundp 'libgnutls-version)
(concat "SECURE128:+SECURE192:-VERS-ALL" (concat "SECURE128:+SECURE192:-VERS-ALL"

View file

@ -13,7 +13,7 @@ to contribute to our fine corner of the interwebs.
* Table of Contents :TOC_3: * Table of Contents :TOC_3:
- [[#where-can-i-help][Where can I help?]] - [[#where-can-i-help][Where can I help?]]
- [[#reporting-issues][Reporting issues]] - [[#reporting-issues][Reporting issues]]
- [[#collect-backtraces-of-any-error-messages][Collect backtraces of any error messages]] - [[#acquire-a-backtrace-from-errors][Acquire a backtrace from errors]]
- [[#create-a-step-by-step-reproduction-guide][Create a step-by-step reproduction guide]] - [[#create-a-step-by-step-reproduction-guide][Create a step-by-step reproduction guide]]
- [[#include-information-about-your-doom-install][Include information about your Doom install]] - [[#include-information-about-your-doom-install][Include information about your Doom install]]
- [[#debugging-crashes-with-gdb][Debugging crashes with gdb]] - [[#debugging-crashes-with-gdb][Debugging crashes with gdb]]

View file

@ -159,6 +159,7 @@ This is ignored by ccls.")
(set-lookup-handlers! 'cmake-mode (set-lookup-handlers! 'cmake-mode
:documentation '+cc-cmake-lookup-documentation-fn)) :documentation '+cc-cmake-lookup-documentation-fn))
(use-package! company-cmake ; for `cmake-mode' (use-package! company-cmake ; for `cmake-mode'
:when (featurep! :completion company) :when (featurep! :completion company)
:after cmake-mode :after cmake-mode

View file

@ -11,7 +11,7 @@ ALIASES is a flat list of alias -> command pairs. e.g.
\"bye\" \"echo goodbye world\")" \"bye\" \"echo goodbye world\")"
(or (cl-evenp (length aliases)) (or (cl-evenp (length aliases))
(signal 'wrong-number-of-arguments (list 'even (length aliases)))) (signal 'wrong-number-of-arguments (list 'even (length aliases))))
(after! eshell (after! em-alias
(while aliases (while aliases
(let ((alias (pop aliases)) (let ((alias (pop aliases))
(command (pop aliases))) (command (pop aliases)))

View file

@ -92,9 +92,7 @@ You should use `set-eshell-alias!' to change this.")
(add-hook! 'eshell-mode-hook (add-hook! 'eshell-mode-hook
(defun +eshell-remove-fringes-h () (defun +eshell-remove-fringes-h ()
(set-window-fringes nil 0 0) (set-window-fringes nil 0 0)
(set-window-margins nil 1 nil))) (set-window-margins nil 1 nil))
(add-hook! 'eshell-mode-hook
(defun +eshell-enable-text-wrapping-h () (defun +eshell-enable-text-wrapping-h ()
(visual-line-mode +1) (visual-line-mode +1)
(set-display-table-slot standard-display-table 0 ?\ ))) (set-display-table-slot standard-display-table 0 ?\ )))