mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 11:30:23 +10:00
Minor updates.
This commit is contained in:
@@ -264,6 +264,13 @@ See `doom-real-buffer-p' for an explanation for real buffers."
|
||||
;;
|
||||
;; Interactive commands
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/save-and-kill-buffer ()
|
||||
"Save the current buffer to file, then kill it."
|
||||
(interactive)
|
||||
(save-buffer)
|
||||
(kill-current-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-this-buffer-in-all-windows (buffer &optional dont-save)
|
||||
"Kill BUFFER globally and ensure all windows previously showing this buffer
|
||||
|
||||
@@ -55,19 +55,18 @@ And jumps to your `doom!' block."
|
||||
|
||||
(defmacro doom--if-compile (command on-success &optional on-failure)
|
||||
(declare (indent 2))
|
||||
(let ((windowsym (make-symbol "doom-sync-window")))
|
||||
`(with-current-buffer (compile ,command t)
|
||||
(let ((,windowsym (get-buffer-window (current-buffer))))
|
||||
(select-window ,windowsym)
|
||||
(add-hook
|
||||
'compilation-finish-functions
|
||||
(lambda (_buf status)
|
||||
(if (equal status "finished\n")
|
||||
(progn
|
||||
(delete-window ,windowsym)
|
||||
,on-success)
|
||||
,on-failure))
|
||||
nil 'local)))))
|
||||
`(with-current-buffer (compile ,command t)
|
||||
(let ((w (get-buffer-window (current-buffer))))
|
||||
(select-window w)
|
||||
(add-hook
|
||||
'compilation-finish-functions
|
||||
(lambda (_buf status)
|
||||
(if (equal status "finished\n")
|
||||
(progn
|
||||
(delete-window w)
|
||||
,on-success)
|
||||
,on-failure))
|
||||
nil 'local))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/reload ()
|
||||
|
||||
@@ -20,11 +20,9 @@
|
||||
;;;###autoload
|
||||
(define-minor-mode doom-debug-mode
|
||||
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
|
||||
:init-value doom-debug-p
|
||||
:init-value nil
|
||||
:global t
|
||||
(let ((value
|
||||
(cond ((eq arg 'toggle) (not doom-debug-mode))
|
||||
((> (prefix-numeric-value arg) 0)))))
|
||||
(let ((value doom-debug-mode))
|
||||
(mapc (doom-rpartial #'set value) doom-debug-variables)
|
||||
(message "Debug mode %s" (if value "on" "off"))))
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
||||
(mapcar (doom-rpartial #'doom--resolve-path-forms directory)
|
||||
(cdr spec)))
|
||||
(let ((filevar (make-symbol "file")))
|
||||
`(let* ((file-name-handler-alist nil)
|
||||
(,filevar ,spec))
|
||||
`(let ((,filevar ,spec))
|
||||
(and (stringp ,filevar)
|
||||
,(if directory
|
||||
`(let ((default-directory ,directory))
|
||||
@@ -38,21 +37,19 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
||||
,filevar)))))
|
||||
|
||||
(defun doom--path (&rest segments)
|
||||
(let (file-name-handler-alist)
|
||||
(let ((dir (pop segments)))
|
||||
(unless segments
|
||||
(setq dir (expand-file-name dir)))
|
||||
(while segments
|
||||
(setq dir (expand-file-name (car segments) dir)
|
||||
segments (cdr segments)))
|
||||
dir)))
|
||||
(let ((dir (pop segments)))
|
||||
(unless segments
|
||||
(setq dir (expand-file-name dir)))
|
||||
(while segments
|
||||
(setq dir (expand-file-name (car segments) dir)
|
||||
segments (cdr segments)))
|
||||
dir))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-glob (&rest segments)
|
||||
"Construct a path from SEGMENTS and expand glob patterns.
|
||||
Returns nil if the path doesn't exist."
|
||||
(let* (case-fold-search
|
||||
file-name-handler-alist
|
||||
(dir (apply #'doom--path segments)))
|
||||
(if (string-match-p "[[*?]" dir)
|
||||
(file-expand-wildcards dir t)
|
||||
@@ -105,7 +102,7 @@ be relative to it.
|
||||
The search recurses up to DEPTH and no further. DEPTH is an integer.
|
||||
|
||||
MATCH is a string regexp. Only entries that match it will be included."
|
||||
(let (result file-name-handler-alist)
|
||||
(let (result)
|
||||
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
|
||||
(cond ((file-directory-p file)
|
||||
(appendq!
|
||||
|
||||
@@ -214,7 +214,7 @@ selection of all minor-modes, active or not."
|
||||
"*.org" doom-emacs-dir)
|
||||
#'ignore))
|
||||
:query initial-input
|
||||
:args '("-g" "*.org")
|
||||
:args '("-t" "org")
|
||||
:in doom-emacs-dir
|
||||
:prompt "Search documentation for: "))
|
||||
|
||||
@@ -633,7 +633,11 @@ config blocks in your private config."
|
||||
(unless (executable-find "rg")
|
||||
(user-error "Can't find ripgrep on your system"))
|
||||
(if (fboundp 'counsel-rg)
|
||||
(let ((counsel-rg-base-command (append counsel-rg-base-command dirs)))
|
||||
(let ((counsel-rg-base-command
|
||||
(if (stringp counsel-rg-base-command)
|
||||
(format counsel-rg-base-command
|
||||
(concat "%s " (mapconcat #'shell-quote-argument dirs " ")))
|
||||
(append counsel-rg-base-command dirs))))
|
||||
(counsel-rg query nil "-Lz" prompt))
|
||||
;; TODO Add helm support?
|
||||
(grep-find
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
;;; Bump commands
|
||||
|
||||
(defun doom--package-full-recipe (package plist)
|
||||
(require 'straight)
|
||||
(doom-plist-merge
|
||||
(plist-get plist :recipe)
|
||||
(or (cdr (straight-recipes-retrieve package))
|
||||
|
||||
@@ -106,9 +106,14 @@ in some cases."
|
||||
(thing
|
||||
(thing-at-point thing t))
|
||||
((require 'xref nil t)
|
||||
;; A little smarter than using `symbol-at-point', though in most cases,
|
||||
;; xref ends up using `symbol-at-point' anyway.
|
||||
(xref-backend-identifier-at-point (xref-find-backend)))
|
||||
;; Eglot defines a dummy for `xref-find-backend', so we need a special
|
||||
;; case to avoid xref when using eglot. See
|
||||
;; https://github.com/joaotavora/eglot/issues/503
|
||||
(if (eq (xref-find-backend) 'eglot)
|
||||
(thing-at-point 'symbol t)
|
||||
;; A little smarter than using `symbol-at-point', though in most
|
||||
;; cases, xref ends up using `symbol-at-point' anyway.
|
||||
(xref-backend-identifier-at-point (xref-find-backend))))
|
||||
(prompt
|
||||
(read-string (if (stringp prompt) prompt "")))))
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
;;; core/cli/env.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defcli! env
|
||||
((allow ["-a" "--allow" regexp] "An envvar whitelist regexp")
|
||||
(reject ["-r" "--reject" regexp] "An envvar blacklist regexp")
|
||||
(clear-p ["-c" "--clear"] "Clear and delete your envvar file")
|
||||
(outputfile ["-o" path]
|
||||
((allow ["-a" "--allow" regexp] "An additive envvar whitelist regexp")
|
||||
(reject ["-r" "--reject" regexp] "An additive envvar blacklist regexp")
|
||||
(allow-only ["-A" regexp] "Blacklist everything but REGEXP")
|
||||
(reject-only ["-R" regexp] "Whitelist everything but REGEXP")
|
||||
(clear-p ["-c" "--clear"] "Clear and delete your envvar file")
|
||||
(outputfile ["-o" path]
|
||||
"Generate the envvar file at PATH. Envvar files that aren't in
|
||||
`doom-env-file' won't be loaded automatically at startup. You will need to load
|
||||
them manually from your private config with the `doom-load-envvars-file'
|
||||
@@ -42,7 +44,11 @@ Why this over exec-path-from-shell?
|
||||
(let ((env-file (expand-file-name (or outputfile doom-env-file))))
|
||||
(if (null clear-p)
|
||||
(doom-cli-reload-env-file
|
||||
'force env-file (list allow) (list reject))
|
||||
'force env-file
|
||||
(append (if reject-only (list "."))
|
||||
(delq nil (list allow allow-only)))
|
||||
(append (if allow-only (list "."))
|
||||
(delq nil (list reject reject-only))))
|
||||
(unless (file-exists-p env-file)
|
||||
(user-error! "%S does not exist to be cleared"
|
||||
(path env-file)))
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; core/cli/packages.el
|
||||
|
||||
(defcli! (update u)
|
||||
((discard-p ["--discard"] "All local changes to packages are discarded"))
|
||||
"Updates packages.
|
||||
|
||||
This works by fetching all installed package repos and checking the distance
|
||||
between HEAD and FETCH_HEAD. This can take a while.
|
||||
|
||||
This excludes packages whose `package!' declaration contains a non-nil :freeze
|
||||
or :ignore property."
|
||||
(straight-check-all)
|
||||
(let ((doom-auto-discard discard-p))
|
||||
(when (doom-cli-packages-update)
|
||||
(doom-autoloads-reload))
|
||||
t))
|
||||
(defcli! (update u) (&rest _)
|
||||
"This command was removed."
|
||||
:hidden t
|
||||
(print! (error "This command has been removed.\n"))
|
||||
(print-group!
|
||||
(print! "To update Doom run 'doom upgrade'. To only update packages run 'doom sync -u'."))
|
||||
nil)
|
||||
|
||||
(defcli! (build b)
|
||||
((rebuild-p ["-r"] "Only rebuild packages that need rebuilding"))
|
||||
@@ -122,6 +115,74 @@ list remains lean."
|
||||
(setq straight--recipe-lookup-cache (make-hash-table :test #'eq)
|
||||
doom--cli-updated-recipes t)))
|
||||
|
||||
(defvar doom--expected-eln-files nil)
|
||||
|
||||
(defun doom--elc-file-outdated-p (file)
|
||||
(let ((elc-file (byte-compile-dest-file file)))
|
||||
;; NOTE Ignore missing elc files, they could be missing due to
|
||||
;; `no-byte-compile'. Rebuilding unnecessarily is expensive.
|
||||
(when (and (file-exists-p elc-file)
|
||||
(file-newer-than-file-p file elc-file))
|
||||
(doom-log "%s is newer than %s" file elc-file)
|
||||
t)))
|
||||
|
||||
(defun doom--eln-file-outdated-p (file)
|
||||
(when-let* ((eln-file (comp-output-filename file))
|
||||
(error-file (concat eln-file ".error")))
|
||||
(push eln-file doom--expected-eln-files)
|
||||
(cond ((file-exists-p eln-file)
|
||||
(when (file-newer-than-file-p file eln-file)
|
||||
(doom-log "%s is newer than %s" file eln-file)
|
||||
t))
|
||||
((file-exists-p error-file)
|
||||
(when (file-newer-than-file-p file error-file)
|
||||
(doom-log "%s is newer than %s" file error-file)
|
||||
t))
|
||||
(t
|
||||
(doom-log "%s doesn't exist" eln-file)
|
||||
t))))
|
||||
|
||||
(defun doom--native-compile-done-h (file)
|
||||
(when-let* ((file)
|
||||
(eln-file (comp-output-filename file))
|
||||
(error-file (concat eln-file ".error")))
|
||||
(if (file-exists-p eln-file)
|
||||
(doom-log "Compiled %s" eln-file)
|
||||
(make-directory (file-name-directory error-file) 'parents)
|
||||
(write-region "" nil error-file)
|
||||
(doom-log "Compiled %s" error-file))))
|
||||
|
||||
(defun doom--native-compile-jobs ()
|
||||
"How many async native compilation jobs are queued or in-progress."
|
||||
(if (and (boundp 'comp-files-queue)
|
||||
(fboundp 'comp-async-runnings))
|
||||
(+ (length comp-files-queue)
|
||||
(comp-async-runnings))
|
||||
0))
|
||||
|
||||
(defun doom--wait-for-compile-jobs ()
|
||||
"Wait for all pending async native compilation jobs."
|
||||
(cl-loop for pending = (doom--native-compile-jobs)
|
||||
for tick = 0 then (% (1+ tick) 15)
|
||||
with previous = 0
|
||||
while (not (zerop pending))
|
||||
if (and (zerop tick) (/= previous pending)) do
|
||||
(print! "- Waiting for %d async jobs..." pending)
|
||||
(setq previous pending)
|
||||
else do
|
||||
(let ((inhibit-message t))
|
||||
(sleep-for 0.1)))
|
||||
;; HACK Write .error files for any missing files which still don't exist.
|
||||
;; We'll just assume there was some kind of error...
|
||||
(cl-loop for eln-file in doom--expected-eln-files
|
||||
for error-file = (concat eln-file ".error")
|
||||
unless (or (file-exists-p eln-file)
|
||||
(file-exists-p error-file)) do
|
||||
(make-directory (file-name-directory error-file) 'parents)
|
||||
(write-region "" nil error-file)
|
||||
(doom-log "Compiled %s" error-file))
|
||||
(setq doom--expected-eln-files nil))
|
||||
|
||||
|
||||
(defun doom-cli-packages-install ()
|
||||
"Installs missing packages.
|
||||
@@ -132,6 +193,7 @@ declaration) or dependency thereof that hasn't already been."
|
||||
(print! (start "Installing packages..."))
|
||||
(let ((pinned (doom-package-pinned-list)))
|
||||
(print-group!
|
||||
(add-hook 'comp-async-cu-done-hook #'doom--native-compile-done-h)
|
||||
(if-let (built
|
||||
(doom--with-package-recipes (doom-package-recipe-list)
|
||||
(recipe package type local-repo)
|
||||
@@ -143,11 +205,21 @@ declaration) or dependency thereof that hasn't already been."
|
||||
(when-let (commit (cdr (assoc pkg pinned)))
|
||||
(print! (info "Checked out %s") commit)))
|
||||
straight-use-package-pre-build-functions)))
|
||||
(straight-use-package (intern package)))
|
||||
(straight-use-package (intern package))
|
||||
;; HACK Line encoding issues can plague repos with dirty
|
||||
;; worktree prompts when updating packages or "Local
|
||||
;; variables entry is missing the suffix" errors when
|
||||
;; installing them (see hlissner/doom-emacs#2637), so
|
||||
;; have git handle conversion by force.
|
||||
(when (and IS-WINDOWS (stringp local-repo))
|
||||
(let ((default-directory (straight--repos-dir local-repo)))
|
||||
(when (file-in-directory-p default-directory straight-base-dir)
|
||||
(straight--call "git" "config" "core.autocrlf" "true")))))
|
||||
(error
|
||||
(signal 'doom-package-error (list package e))))))
|
||||
(print! (success "Installed %d packages")
|
||||
(length built))
|
||||
(progn
|
||||
(doom--wait-for-compile-jobs)
|
||||
(print! (success "Installed %d packages") (length built)))
|
||||
(print! (info "No packages need to be installed"))
|
||||
nil))))
|
||||
|
||||
@@ -170,6 +242,7 @@ declaration) or dependency thereof that hasn't already been."
|
||||
(or (if force-p :all straight--packages-to-rebuild)
|
||||
(make-hash-table :test #'equal)))
|
||||
(recipes (doom-package-recipe-list)))
|
||||
(add-hook 'comp-async-cu-done-hook #'doom--native-compile-done-h)
|
||||
(unless force-p
|
||||
(straight--make-build-cache-available))
|
||||
(if-let (built
|
||||
@@ -178,25 +251,27 @@ declaration) or dependency thereof that hasn't already been."
|
||||
;; Ensure packages with outdated files/bytecode are rebuilt
|
||||
(let ((build-dir (straight--build-dir package))
|
||||
(repo-dir (straight--repos-dir local-repo)))
|
||||
(and (or (file-newer-than-file-p repo-dir build-dir)
|
||||
(and (not (plist-get recipe :no-build))
|
||||
(or (file-newer-than-file-p repo-dir build-dir)
|
||||
(file-exists-p (straight--modified-dir (or local-repo package)))
|
||||
;; Doesn't make sense to compare el and elc files
|
||||
;; when the former isn't a symlink to their source.
|
||||
(when straight-use-symlinks
|
||||
(cl-loop for file
|
||||
in (doom-files-in build-dir :match "\\.el$" :full t)
|
||||
for elc-file = (byte-compile-dest-file file)
|
||||
if (and (file-exists-p elc-file)
|
||||
(file-newer-than-file-p file elc-file))
|
||||
return t)))
|
||||
(not (plist-get recipe :no-build))
|
||||
(cl-loop with want-byte = (straight--byte-compile-package-p recipe)
|
||||
with want-native = (if (require 'comp nil t) (straight--native-compile-package-p recipe))
|
||||
with outdated = nil
|
||||
for file in (doom-files-in build-dir :match "\\.el$" :full t)
|
||||
if (or (if want-byte (doom--elc-file-outdated-p file))
|
||||
(if want-native (doom--eln-file-outdated-p file)))
|
||||
do (setq outdated t)
|
||||
finally return outdated))
|
||||
(puthash package t straight--packages-to-rebuild))))
|
||||
(straight-use-package (intern package))))
|
||||
(print! (success "Rebuilt %d package(s)") (length built))
|
||||
(progn
|
||||
(doom--wait-for-compile-jobs)
|
||||
(print! (success "Rebuilt %d package(s)") (length built)))
|
||||
(print! (success "No packages need rebuilding"))
|
||||
nil))))
|
||||
|
||||
|
||||
|
||||
(defun doom-cli-packages-update ()
|
||||
"Updates packages."
|
||||
(doom-initialize-packages)
|
||||
|
||||
@@ -26,7 +26,7 @@ following shell commands:
|
||||
(print! (info "Reloading Doom Emacs"))
|
||||
(doom-cli-execute-after "doom" "upgrade" "-p" (if force-p "-f")))
|
||||
|
||||
((print! "Nothing to do. Doom is up-to-date!")))))
|
||||
((print! "Doom is up-to-date!")))))
|
||||
|
||||
|
||||
;;
|
||||
@@ -47,7 +47,6 @@ following shell commands:
|
||||
|
||||
(defun doom-cli-upgrade (&optional auto-accept-p force-p)
|
||||
"Upgrade Doom to the latest version non-destructively."
|
||||
(require 'vc-git)
|
||||
(let ((default-directory doom-emacs-dir)
|
||||
process-file-side-effects)
|
||||
(print! (start "Preparing to upgrade Doom Emacs and its packages..."))
|
||||
@@ -84,8 +83,8 @@ following shell commands:
|
||||
(or (zerop (car (setq result (doom-call-process "git" "fetch" "--tags" doom-repo-remote branch))))
|
||||
(error "Failed to fetch from upstream"))
|
||||
|
||||
(let ((this-rev (vc-git--rev-parse "HEAD"))
|
||||
(new-rev (vc-git--rev-parse target-remote)))
|
||||
(let ((this-rev (cdr (doom-call-process "git" "rev-parse" "HEAD")))
|
||||
(new-rev (cdr (doom-call-process "git" "rev-parse" target-remote))))
|
||||
(cond
|
||||
((and (null this-rev)
|
||||
(null new-rev))
|
||||
@@ -114,9 +113,9 @@ following shell commands:
|
||||
(print! (start "Upgrading Doom Emacs..."))
|
||||
(print-group!
|
||||
(doom-clean-byte-compiled-files)
|
||||
(unless (and (zerop (car (doom-call-process "git" "reset" "--hard" target-remote)))
|
||||
(equal (vc-git--rev-parse "HEAD") new-rev))
|
||||
(error "Failed to check out %s" (substring new-rev 0 10)))
|
||||
(or (and (zerop (car (doom-call-process "git" "reset" "--hard" target-remote)))
|
||||
(equal (cdr (doom-call-process "git" "rev-parse" "HEAD")) new-rev))
|
||||
(error "Failed to check out %s" (substring new-rev 0 10)))
|
||||
(print! (info "%s") (cdr result))
|
||||
t))))))
|
||||
(ignore-errors
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
(require 'core-packages)
|
||||
(doom-initialize-core-packages)
|
||||
|
||||
;; Don't generate superfluous files when writing temp buffers
|
||||
(setq make-backup-files nil)
|
||||
|
||||
|
||||
;;
|
||||
;;; Variables
|
||||
|
||||
@@ -91,6 +91,8 @@ possible."
|
||||
backup-directory-alist `((".*" . ,(concat doom-cache-dir "backup/"))))
|
||||
|
||||
(after! tramp
|
||||
;; Backing up files on remotes can be incredibly slow and prone to a variety
|
||||
;; of IO errors. Better to disable it altogether in tramp buffers:
|
||||
(add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil)))
|
||||
|
||||
(add-hook! 'after-save-hook
|
||||
@@ -159,23 +161,16 @@ possible."
|
||||
;; 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); depending
|
||||
;; on what is available.
|
||||
(unless IS-WINDOWS
|
||||
(add-hook! 'tty-setup-hook
|
||||
(defun doom-init-clipboard-in-tty-emacs-h ()
|
||||
(and (require 'clipetty nil t)
|
||||
(global-clipetty-mode +1)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Extra file extensions to support
|
||||
|
||||
(push '("/LICENSE\\'" . text-mode) auto-mode-alist)
|
||||
(push '("\\.log\\'" . text-mode) auto-mode-alist)
|
||||
(push '("rc\\'" . conf-mode) auto-mode-alist)
|
||||
(push '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode) auto-mode-alist)
|
||||
(nconc
|
||||
auto-mode-alist
|
||||
'(("/LICENSE\\'" . text-mode)
|
||||
("\\.log\\'" . text-mode)
|
||||
("rc\\'" . conf-mode)
|
||||
("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode)))
|
||||
|
||||
|
||||
;;
|
||||
@@ -258,9 +253,12 @@ possible."
|
||||
(setq savehist-file (concat doom-cache-dir "savehist"))
|
||||
:config
|
||||
(setq savehist-save-minibuffer-history t
|
||||
savehist-autosave-interval nil ; save on kill only
|
||||
savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
|
||||
(add-hook! 'kill-emacs-hook
|
||||
savehist-autosave-interval nil ; save on kill only
|
||||
savehist-additional-variables
|
||||
'(kill-ring ; persist clipboard
|
||||
mark-ring global-mark-ring ; persist marks
|
||||
search-ring regexp-search-ring)) ; persist searches
|
||||
(add-hook! 'savehist-save-hook
|
||||
(defun doom-unpropertize-kill-ring-h ()
|
||||
"Remove text properties from `kill-ring' for a smaller savehist file."
|
||||
(setq kill-ring (cl-loop for item in kill-ring
|
||||
@@ -312,6 +310,7 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
||||
(use-package! better-jumper
|
||||
:hook (doom-first-input . better-jumper-mode)
|
||||
:hook (better-jumper-post-jump . recenter)
|
||||
:commands doom-set-jump-a doom-set-jump-maybe-a doom-set-jump-h
|
||||
:preface
|
||||
;; REVIEW Suppress byte-compiler warning spawning a *Compile-Log* buffer at
|
||||
;; startup. This can be removed once gilbertw1/better-jumper#2 is merged.
|
||||
@@ -542,7 +541,7 @@ files, so we replace calls to `pp' with the much faster `prin1'."
|
||||
(if visual-line-mode
|
||||
(* so-long-threshold
|
||||
(if (derived-mode-p 'text-mode)
|
||||
3
|
||||
4
|
||||
2))
|
||||
so-long-threshold)))
|
||||
(so-long-detected-long-line-p)))
|
||||
|
||||
@@ -251,13 +251,17 @@ or aliases."
|
||||
(declare (doc-string 1) (pure t) (side-effect-free t))
|
||||
`(lambda (&rest _) (interactive) ,@body))
|
||||
|
||||
(defmacro cmd!! (command &rest args)
|
||||
(defmacro cmd!! (command &optional prefix-arg &rest args)
|
||||
"Expands to a closure that interactively calls COMMAND with ARGS.
|
||||
A factory for quickly producing interactive, prefixed commands for keybinds or
|
||||
aliases."
|
||||
(declare (doc-string 1) (pure t) (side-effect-free t))
|
||||
`(lambda (&rest _) (interactive)
|
||||
(funcall-interactively ,command ,@args)))
|
||||
`(lambda (arg &rest _) (interactive "P")
|
||||
(let ((current-prefix-arg (or ,prefix-arg arg)))
|
||||
(,(if args
|
||||
'funcall-interactively
|
||||
'call-interactively)
|
||||
,command ,@args))))
|
||||
|
||||
(defmacro cmds! (&rest branches)
|
||||
"Expands to a `menu-item' dispatcher for keybinds."
|
||||
@@ -324,7 +328,7 @@ The current file is the file from which `add-to-load-path!' is used."
|
||||
`(let ((default-directory ,(dir!))
|
||||
file-name-handler-alist)
|
||||
(dolist (dir (list ,@dirs))
|
||||
(cl-pushnew (expand-file-name dir) load-path))))
|
||||
(cl-pushnew (expand-file-name dir) load-path :test #'string=))))
|
||||
|
||||
(defmacro after! (package &rest body)
|
||||
"Evaluate BODY after PACKAGE have loaded.
|
||||
@@ -486,7 +490,10 @@ advised)."
|
||||
(defmacro add-hook-trigger! (hook-var &rest targets)
|
||||
"TODO"
|
||||
`(let ((fn (intern (format "%s-h" ,hook-var))))
|
||||
(fset fn (lambda (&rest _) (run-hooks ,hook-var) (set ,hook-var nil)))
|
||||
(fset
|
||||
fn (lambda (&rest _)
|
||||
(run-hook-wrapped ,hook-var #'doom-try-run-hook)
|
||||
(set ,hook-var nil)))
|
||||
(put ,hook-var 'permanent-local t)
|
||||
(dolist (on (list ,@targets))
|
||||
(if (functionp on)
|
||||
@@ -632,7 +639,7 @@ testing advice (when combined with `rotate-text').
|
||||
;;
|
||||
;;; Backports
|
||||
|
||||
(when! (not EMACS27+)
|
||||
(when! (version< emacs-version "27.0.90")
|
||||
;; DEPRECATED Backported from Emacs 27
|
||||
(defmacro setq-local (&rest pairs)
|
||||
"Make variables in PAIRS buffer-local and assign them the corresponding values.
|
||||
|
||||
@@ -119,7 +119,8 @@ non-nil."
|
||||
(unless no-config-p
|
||||
(maphash (doom-module-loader doom-module-config-file) doom-modules)
|
||||
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)
|
||||
(load! "config" doom-private-dir t)))))
|
||||
(load! "config" doom-private-dir t)
|
||||
(load custom-file 'noerror (not doom-debug-mode))))))
|
||||
|
||||
|
||||
;;
|
||||
@@ -200,7 +201,7 @@ This doesn't require modules to be enabled. For enabled modules us
|
||||
for default-directory in doom-modules-dirs
|
||||
for path = (concat category "/" module "/" file)
|
||||
if (file-exists-p path)
|
||||
return (expand-file-name path)))
|
||||
return (file-truename path)))
|
||||
|
||||
(defun doom-module-from-path (&optional path enabled-only)
|
||||
"Returns a cons cell (CATEGORY . MODULE) derived from PATH (a file path).
|
||||
@@ -329,7 +330,9 @@ This value is cached. If REFRESH-P, then don't use the cached value."
|
||||
;; packages with package.el, by copying over old `use-package' declarations with
|
||||
;; an :ensure t property. Doom doesn't use package.el, so this will throw an
|
||||
;; error that will confuse beginners, so we disable `:ensure'.
|
||||
(setq use-package-ensure-function #'ignore)
|
||||
(setq use-package-ensure-function
|
||||
(lambda (name &rest _)
|
||||
(message "Ignoring ':ensure t' in '%s' config" name)))
|
||||
;; ...On the other hand, if the user has loaded `package', then we should assume
|
||||
;; they know what they're doing and restore the old behavior:
|
||||
(add-transient-hook! 'package-initialize
|
||||
@@ -463,7 +466,7 @@ to least)."
|
||||
`(unless doom-interactive-p
|
||||
(doom-module-mplist-map
|
||||
(lambda (category module &rest plist)
|
||||
(if (plist-get plist :path)
|
||||
(if (plist-member plist :path)
|
||||
(apply #'doom-module-set category module plist)
|
||||
(message "WARNING Couldn't find the %s %s module" category module)))
|
||||
,@(if (keywordp (car modules))
|
||||
|
||||
@@ -61,9 +61,9 @@ uses a straight or package.el command directly).")
|
||||
;; than pulled, so packages are often out of date with upstream.
|
||||
package-archives
|
||||
(let ((proto (if gnutls-verify-error "https" "http")))
|
||||
`(("gnu" . ,(concat proto "://elpa.gnu.org/packages/"))
|
||||
("melpa" . ,(concat proto "://melpa.org/packages/"))
|
||||
("org" . ,(concat proto "://orgmode.org/elpa/")))))
|
||||
(list (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))
|
||||
(cons "melpa" (concat proto "://melpa.org/packages/"))
|
||||
(cons "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)
|
||||
@@ -97,7 +97,9 @@ uses a straight or package.el command directly).")
|
||||
;; we don't have to deal with them at all.
|
||||
autoload-compute-prefixes nil
|
||||
;; We handle it ourselves
|
||||
straight-fix-org nil)
|
||||
straight-fix-org nil
|
||||
;; HACK Disable native-compilation for some troublesome files
|
||||
comp-deferred-compilation-black-list '("/evil-collection-vterm\\.el$"))
|
||||
|
||||
(defadvice! doom--read-pinned-packages-a (orig-fn &rest args)
|
||||
"Read `:pin's in `doom-packages' on top of straight's lockfiles."
|
||||
@@ -234,10 +236,6 @@ processed."
|
||||
nil-value)
|
||||
plist)))
|
||||
|
||||
(defun doom-package-build-time (package)
|
||||
"TODO"
|
||||
(car (gethash (symbol-name package) straight--build-cache)))
|
||||
|
||||
(defun doom-package-dependencies (package &optional recursive _noerror)
|
||||
"Return a list of dependencies for a package."
|
||||
(let ((deps (nth 1 (gethash (symbol-name package) straight--build-cache))))
|
||||
@@ -293,18 +291,6 @@ installed."
|
||||
((locate-library (symbol-name package))
|
||||
'other)))
|
||||
|
||||
(defun doom-package-changed-recipe-p (name)
|
||||
"Return t if a package named NAME (a symbol) has a different recipe than it
|
||||
was installed with."
|
||||
(cl-check-type name symbol)
|
||||
;; TODO
|
||||
;; (when (doom-package-installed-p name)
|
||||
;; (when-let* ((doom-recipe (assq name doom-packages))
|
||||
;; (install-recipe (doom-package-recipe)))
|
||||
;; (not (equal (cdr quelpa-recipe)
|
||||
;; (cdr (plist-get (cdr doom-recipe) :recipe))))))
|
||||
)
|
||||
|
||||
|
||||
;;; Package getters
|
||||
(defun doom--read-packages (file &optional noeval noerror)
|
||||
@@ -380,21 +366,6 @@ ones."
|
||||
nil 'remove #'equal)
|
||||
(unless unpin pin)))))))
|
||||
|
||||
(defun doom-package-unpinned-list ()
|
||||
"Return an alist mapping package names (strings) to pinned commits (strings)."
|
||||
(let (alist)
|
||||
(dolist (package doom-packages alist)
|
||||
(cl-destructuring-bind
|
||||
(_ &key recipe disable ignore pin unpin &allow-other-keys)
|
||||
package
|
||||
(when (and (not ignore)
|
||||
(not disable)
|
||||
(or unpin
|
||||
(and (plist-member recipe :pin)
|
||||
(null pin))))
|
||||
(cl-pushnew (doom-package-recipe-repo (car package)) alist
|
||||
:test #'equal))))))
|
||||
|
||||
(defun doom-package-recipe-list ()
|
||||
"Return straight recipes for non-builtin packages with a local-repo."
|
||||
(let (recipes)
|
||||
@@ -406,16 +377,6 @@ ones."
|
||||
(push recipe recipes))))
|
||||
(nreverse recipes)))
|
||||
|
||||
(defun doom-package-state-list ()
|
||||
"TODO"
|
||||
(let (alist)
|
||||
(dolist (recipe (hash-table-values straight--repo-cache) alist)
|
||||
(cl-destructuring-bind (&key local-repo type &allow-other-keys)
|
||||
recipe
|
||||
(when (and local-repo (not (eq type 'built-in)))
|
||||
(setf (alist-get local-repo alist nil nil #'equal)
|
||||
(straight-vc-get-commit type local-repo)))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Module package macros
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; core-projects.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar doom-projectile-cache-limit 25000
|
||||
(defvar doom-projectile-cache-limit 10000
|
||||
"If any project cache surpasses this many files it is purged when quitting
|
||||
Emacs.")
|
||||
|
||||
@@ -11,9 +11,9 @@ Emacs.")
|
||||
"If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.")
|
||||
|
||||
(defvar doom-projectile-fd-binary
|
||||
(or (cl-find-if #'executable-find '("fdfind" "fd"))
|
||||
"fd")
|
||||
"name of `fd-find' executable binary")
|
||||
(cl-find-if #'executable-find (list "fdfind" "fd"))
|
||||
"The filename of the `fd' executable. On some distros it's 'fdfind' (ubuntu,
|
||||
debian, and derivatives). On most it's 'fd'.")
|
||||
|
||||
|
||||
;;
|
||||
@@ -26,8 +26,11 @@ Emacs.")
|
||||
projectile-locate-dominating-file)
|
||||
:init
|
||||
(setq projectile-cache-file (concat doom-cache-dir "projectile.cache")
|
||||
;; Auto-discovery is slow to do by default. Better to update the list
|
||||
;; when you need to (`projectile-discover-projects-in-search-path').
|
||||
projectile-auto-discover nil
|
||||
projectile-enable-caching doom-interactive-p
|
||||
projectile-globally-ignored-files '(".DS_Store" "Icon
|
||||
projectile-globally-ignored-files '(".DS_Store" "TAGS")
|
||||
projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o")
|
||||
projectile-kill-buffers-filter 'kill-only-files
|
||||
projectile-known-projects-file (concat doom-cache-dir "projectile.projects")
|
||||
@@ -39,6 +42,12 @@ Emacs.")
|
||||
:config
|
||||
(projectile-mode +1)
|
||||
|
||||
;; Auto-discovery on `projectile-mode' is slow and premature. Let's defer it
|
||||
;; until it's actually needed. Also clean up non-existing projects too!
|
||||
(add-transient-hook! 'projectile-relevant-known-projects
|
||||
(projectile-cleanup-known-projects)
|
||||
(projectile-discover-projects-in-search-path))
|
||||
|
||||
;; Projectile runs four functions to determine the root (in this order):
|
||||
;;
|
||||
;; + `projectile-root-local' -> checks the `projectile-project-root' variable
|
||||
@@ -102,7 +111,9 @@ b) represent blacklisted directories that are too big, change too often or are
|
||||
private. (see `doom-projectile-cache-blacklist'),
|
||||
c) are not valid projectile projects."
|
||||
(when (and (bound-and-true-p projectile-projects-cache)
|
||||
projectile-enable-caching
|
||||
doom-interactive-p)
|
||||
(projectile-cleanup-known-projects)
|
||||
(cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist)
|
||||
for proot in (hash-table-keys projectile-projects-cache)
|
||||
if (or (not (stringp proot))
|
||||
@@ -130,55 +141,54 @@ c) are not valid projectile projects."
|
||||
projectile-project-root-files)
|
||||
projectile-project-root-files-bottom-up nil)))
|
||||
|
||||
;; Some utilities have issues with windows-style paths in MSYS, so emit
|
||||
;; unix-style paths instead.
|
||||
(when IS-WINDOWS
|
||||
(setenv "MSYS_NO_PATHCONV" "1"))
|
||||
|
||||
;; HACK Don't rely on VCS-specific commands to generate our file lists. That's
|
||||
;; 7 commands to maintain, versus the more generic, reliable and
|
||||
;; performant `fd' or `ripgrep'.
|
||||
;; performant `fd' or `ripgrep'.
|
||||
(defadvice! doom--only-use-generic-command-a (vcs)
|
||||
"Only use `projectile-generic-command' for indexing project files.
|
||||
And if it's a function, evaluate it."
|
||||
And if it's a function, evaluate it."
|
||||
:override #'projectile-get-ext-command
|
||||
(if (functionp projectile-generic-command)
|
||||
(funcall projectile-generic-command vcs)
|
||||
projectile-generic-command))
|
||||
|
||||
|
||||
(cond
|
||||
;; If fd exists, use it for git and generic projects. fd is a rust program
|
||||
;; that is significantly faster than git ls-files or find, and it respects
|
||||
;; .gitignore. This is recommended in the projectile docs.
|
||||
((executable-find doom-projectile-fd-binary)
|
||||
(setq projectile-generic-command
|
||||
;; `projectile-generic-command' doesn't typically support a function.
|
||||
;; My `doom--only-use-generic-command-a' advice allows this. I do it
|
||||
;; this way so that future changes to
|
||||
;; `projectile-globally-ignored-directories' are respected.
|
||||
(lambda (_)
|
||||
(concat (format "%s . -0 -H -E .git --color=never --type file --type symlink --follow"
|
||||
doom-projectile-fd-binary)
|
||||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
concat " -E "
|
||||
concat (shell-quote-argument dir))
|
||||
(if IS-WINDOWS " --path-separator=//")))
|
||||
projectile-git-submodule-command nil
|
||||
;; ensure Windows users get fd's benefits
|
||||
projectile-indexing-method 'alien))
|
||||
|
||||
;; Otherwise, resort to ripgrep, which is also faster than find
|
||||
((executable-find "rg")
|
||||
(setq projectile-generic-command
|
||||
(lambda (_)
|
||||
(concat "rg -0 --files --follow --color=never --hidden"
|
||||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
concat " --glob "
|
||||
concat (shell-quote-argument (concat "!" dir)))
|
||||
(if IS-WINDOWS " --path-separator //")))
|
||||
projectile-git-submodule-command nil
|
||||
;; ensure Windows users get rg's benefits
|
||||
projectile-indexing-method 'alien))
|
||||
|
||||
;; Fix breakage on windows in git projects with submodules, since Windows
|
||||
;; doesn't have tr
|
||||
(IS-WINDOWS
|
||||
;; `projectile-generic-command' doesn't typically support a function, but my
|
||||
;; `doom--only-use-generic-command-a' advice allows this. I do it this way so
|
||||
;; that projectile can adapt to remote systems (over TRAMP), rather then look
|
||||
;; for fd/ripgrep on the remote system simply because it exists on the host.
|
||||
;; It's faster too.
|
||||
(setq projectile-git-submodule-command nil
|
||||
projectile-indexing-method 'hybrid
|
||||
projectile-generic-command
|
||||
(lambda (_)
|
||||
(let ((find-exe-fn
|
||||
(if EMACS27+
|
||||
(doom-rpartial #'executable-find t)
|
||||
#'executable-find)))
|
||||
;; If fd exists, use it for git and generic projects. fd is a rust
|
||||
;; program that is significantly faster than git ls-files or find, and
|
||||
;; it respects .gitignore. This is recommended in the projectile docs.
|
||||
(cond
|
||||
((when-let
|
||||
(bin (if (ignore-errors (file-remote-p default-directory nil t))
|
||||
(cl-find-if find-exe-fn (list "fdfind" "fd"))
|
||||
doom-projectile-fd-binary))
|
||||
(concat (format "%s . -0 -H -E .git --color=never --type file --type symlink --follow"
|
||||
bin)
|
||||
(if IS-WINDOWS " --path-separator=/"))))
|
||||
;; Otherwise, resort to ripgrep, which is also faster than find
|
||||
((funcall find-exe-fn "rg")
|
||||
(concat "rg -0 --files --follow --color=never --hidden"
|
||||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
concat " --glob "
|
||||
concat (shell-quote-argument (concat "!" dir)))
|
||||
(if IS-WINDOWS " --path-separator /")))
|
||||
("find . -type f -print0")))))
|
||||
|
||||
(defadvice! doom--projectile-default-generic-command-a (orig-fn &rest args)
|
||||
"If projectile can't tell what kind of project you're in, it issues an error
|
||||
@@ -189,16 +199,7 @@ when using many of projectile's command, e.g. `projectile-compile-command',
|
||||
This suppresses the error so these commands will still run, but prompt you for
|
||||
the command instead."
|
||||
:around #'projectile-default-generic-command
|
||||
:around #'projectile-default-generic-command
|
||||
(ignore-errors (apply orig-fn args)))
|
||||
|
||||
;; Projectile root-searching functions can cause an infinite loop on TRAMP
|
||||
;; connections, so disable them.
|
||||
;; TODO Is this still necessary?
|
||||
(defadvice! doom--projectile-locate-dominating-file-a (file _name)
|
||||
"Don't traverse the file system if on a remote connection."
|
||||
:before-while #'projectile-locate-dominating-file
|
||||
(and (stringp file)
|
||||
(ignore-errors (apply orig-fn args))))
|
||||
|
||||
|
||||
;;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
;;; Variables
|
||||
|
||||
(defvar doom-init-theme-p nil
|
||||
"If non-nil, a theme as been loaded.")
|
||||
"If non-nil, a theme has been loaded.")
|
||||
|
||||
(defvar doom-theme nil
|
||||
"A symbol representing the Emacs theme to load at startup.
|
||||
@@ -13,9 +13,7 @@ This is changed by `load-theme'.")
|
||||
|
||||
(defvar doom-font nil
|
||||
"The default font to use.
|
||||
|
||||
Expects either a `font-spec', font object, an XFT font string or an XLFD font
|
||||
string.
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string.
|
||||
|
||||
This affects the `default' and `fixed-pitch' faces.
|
||||
|
||||
@@ -24,38 +22,33 @@ Examples:
|
||||
(setq doom-font \"Terminus (TTF):pixelsize=12:antialias=off\")")
|
||||
|
||||
(defvar doom-variable-pitch-font nil
|
||||
"The font to use for variable-pitch text.
|
||||
|
||||
Expects either a `font-spec', font object, a XFT font string or XLFD string. See
|
||||
"The default font to use for variable-pitch text.
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
||||
`doom-font' for examples.
|
||||
|
||||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||
size.")
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-serif-font nil
|
||||
"The default font to use for the `fixed-pitch-serif' face.
|
||||
|
||||
Expects either a `font-spec', font object, a XFT font string or XLFD string. See
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
||||
`doom-font' for examples.
|
||||
|
||||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||
size.")
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-unicode-font
|
||||
(if IS-MAC
|
||||
(font-spec :family "Apple Color Emoji")
|
||||
(font-spec :family "Symbola"))
|
||||
"Fallback font for unicode glyphs.
|
||||
"Fallback font for Unicode glyphs.
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
||||
`doom-font' for examples.
|
||||
|
||||
It defaults to Apple Color Emoji on MacOS and Symbola on Linux. Expects either a
|
||||
`font-spec', font object, a XFT font string or XLFD string. See `doom-font' for
|
||||
examples.
|
||||
The defaults on macOS and Linux are Apple Color Emoji and Symbola, respectively.
|
||||
|
||||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||
size.")
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-unicode-extra-fonts nil
|
||||
"Fonts to inject into the unicode charset before `doom-unicode-font'.")
|
||||
"Fonts to inject into the Unicode charset before `doom-unicode-font'.")
|
||||
|
||||
|
||||
;;
|
||||
@@ -139,24 +132,24 @@ size.")
|
||||
(not (eq (current-buffer) (doom-fallback-buffer))))
|
||||
|
||||
(defun doom-highlight-non-default-indentation-h ()
|
||||
"Highlight whitespace that doesn't match your `indent-tabs-mode' setting.
|
||||
"Highlight whitespace at odds with `indent-tabs-mode'.
|
||||
That is, highlight tabs if `indent-tabs-mode' is `nil', and highlight spaces at
|
||||
the beginnings of lines if `indent-tabs-mode' is `t'. The purpose is to make
|
||||
incorrect indentation in the current buffer obvious to you.
|
||||
|
||||
e.g. If you indent with spaces by default, tabs will be highlighted. If you
|
||||
indent with tabs, spaces at BOL are highlighted.
|
||||
|
||||
Does nothing if `whitespace-mode' or 'global-whitespace-mode' is already
|
||||
active or if the current buffer is read-only or not file-visiting."
|
||||
Does nothing if `whitespace-mode' or `global-whitespace-mode' is already active
|
||||
or if the current buffer is read-only or not file-visiting."
|
||||
(unless (or (eq major-mode 'fundamental-mode)
|
||||
buffer-read-only
|
||||
(bound-and-true-p global-whitespace-mode)
|
||||
(null buffer-file-name))
|
||||
(require 'whitespace)
|
||||
(set (make-local-variable 'whitespace-style)
|
||||
(let ((style (if indent-tabs-mode '(indentation) '(tabs tab-mark))))
|
||||
(if whitespace-mode
|
||||
(cl-union style whitespace-active-style)
|
||||
style)))
|
||||
(cl-pushnew 'face whitespace-style)
|
||||
(cl-union (if indent-tabs-mode
|
||||
'(indentation)
|
||||
'(tabs tab-mark))
|
||||
(when whitespace-mode
|
||||
(remq 'face whitespace-active-style))))
|
||||
(cl-pushnew 'face whitespace-style) ; must be first
|
||||
(whitespace-mode +1)))
|
||||
|
||||
|
||||
@@ -178,8 +171,10 @@ active or if the current buffer is read-only or not file-visiting."
|
||||
;; middle-click paste at point, not at click
|
||||
(setq mouse-yank-at-point t)
|
||||
|
||||
;; Enable mouse in terminal Emacs
|
||||
(add-hook 'tty-setup-hook #'xterm-mouse-mode)
|
||||
;; Larger column width for function name in profiler reports
|
||||
(after! profiler
|
||||
(setf (caar profiler-report-cpu-line-format) 80
|
||||
(caar profiler-report-memory-line-format) 80))
|
||||
|
||||
|
||||
;;
|
||||
@@ -222,12 +217,6 @@ active or if the current buffer is read-only or not file-visiting."
|
||||
;; Don't blink the paren matching the one at point, it's too distracting.
|
||||
(setq blink-matching-paren nil)
|
||||
|
||||
;; Some terminals offer two different cursors: a “visible” static cursor and a
|
||||
;; “very visible” blinking one. By default, Emacs uses the very visible cursor
|
||||
;; and switches to it when you start or resume Emacs. If `visible-cursor' is nil
|
||||
;; when Emacs starts or resumes, it uses the normal cursor.
|
||||
(setq visible-cursor nil)
|
||||
|
||||
;; Don't stretch the cursor to fit wide characters, it is disorienting,
|
||||
;; especially for tabs.
|
||||
(setq x-stretch-cursor nil)
|
||||
@@ -255,25 +244,30 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||
(message "Can't kill the fallback buffer.")
|
||||
t)
|
||||
((doom-real-buffer-p buf)
|
||||
(if (and buffer-file-name
|
||||
(buffer-modified-p buf)
|
||||
(not (y-or-n-p
|
||||
(format "Buffer %s is modified; kill anyway?" buf))))
|
||||
(message "Aborted")
|
||||
(set-buffer-modified-p nil)
|
||||
(let (buffer-list-update-hook)
|
||||
(when (or ;; if there aren't more real buffers than visible buffers,
|
||||
;; then there are no real, non-visible buffers left.
|
||||
(not (cl-set-difference (doom-real-buffer-list)
|
||||
(doom-visible-buffers)))
|
||||
;; if we end up back where we start (or previous-buffer
|
||||
;; returns nil), we have nowhere left to go
|
||||
(memq (switch-to-prev-buffer nil t) (list buf 'nil)))
|
||||
(switch-to-buffer (doom-fallback-buffer)))
|
||||
(unless (delq (selected-window) (get-buffer-window-list buf nil t))
|
||||
(kill-buffer buf)))
|
||||
(run-hooks 'buffer-list-update-hook))
|
||||
t))))
|
||||
(let ((visible-p (delq (selected-window) (get-buffer-window-list buf nil t)))
|
||||
(doom-inhibit-switch-buffer-hooks t)
|
||||
(inhibit-redisplay t)
|
||||
buffer-list-update-hook)
|
||||
(unless visible-p
|
||||
(when (and (buffer-modified-p buf)
|
||||
(not (y-or-n-p
|
||||
(format "Buffer %s is modified; kill anyway?"
|
||||
buf))))
|
||||
(user-error "Aborted")))
|
||||
(when (or ;; if there aren't more real buffers than visible buffers,
|
||||
;; then there are no real, non-visible buffers left.
|
||||
(not (cl-set-difference (doom-real-buffer-list)
|
||||
(doom-visible-buffers)))
|
||||
;; if we end up back where we start (or previous-buffer
|
||||
;; returns nil), we have nowhere left to go
|
||||
(memq (switch-to-prev-buffer nil t) (list buf 'nil)))
|
||||
(switch-to-buffer (doom-fallback-buffer)))
|
||||
(unless visible-p
|
||||
(with-current-buffer buf
|
||||
(restore-buffer-modified-p nil))
|
||||
(kill-buffer buf))
|
||||
(run-hooks 'buffer-list-update-hook)
|
||||
t)))))
|
||||
|
||||
|
||||
;;
|
||||
@@ -399,6 +393,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||
(setq ansi-color-for-comint-mode t)
|
||||
|
||||
|
||||
(after! comint
|
||||
(setq comint-prompt-read-only t))
|
||||
|
||||
|
||||
(after! compile
|
||||
(setq compilation-always-kill t ; kill compilation process before starting another
|
||||
compilation-ask-about-save nil ; save all buffers on `compile'
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
|
||||
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
|
||||
|
||||
;; REVIEW Fixes 'void-variable tab-prefix-map' errors caused by packages that
|
||||
;; prematurely use this variable before it was introduced. Remove this in
|
||||
;; a year.
|
||||
(unless (boundp 'tab-prefix-map)
|
||||
(defvar tab-prefix-map (make-sparse-keymap)))
|
||||
|
||||
;; Just the bare necessities
|
||||
(require 'subr-x)
|
||||
(require 'cl-lib)
|
||||
@@ -160,8 +166,8 @@ users).")
|
||||
(set-charset-priority 'unicode)) ; pretty
|
||||
(prefer-coding-system 'utf-8) ; pretty
|
||||
(setq locale-coding-system 'utf-8) ; please
|
||||
;; The clipboard's on Windows could be in an encoding that's wider (or thinner)
|
||||
;; than utf-8, so let Emacs/the OS decide what encoding to use there.
|
||||
;; The clipboard's on Windows could be in a wider (or thinner) encoding than
|
||||
;; utf-8 (likely UTF-16), so let Emacs/the OS decide what encoding to use there.
|
||||
(unless IS-WINDOWS
|
||||
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
||||
|
||||
@@ -169,7 +175,7 @@ users).")
|
||||
;; we do about them, besides changing packages upstream?
|
||||
(setq ad-redefinition-action 'accept)
|
||||
|
||||
;; Make apropos omnipotent. It's more useful this way.
|
||||
;; Make `apropos' et co search more extensively. They're more useful this way.
|
||||
(setq apropos-do-all t)
|
||||
|
||||
;; A second, case-insensitive pass over `auto-mode-alist' is time wasted, and
|
||||
@@ -177,17 +183,19 @@ users).")
|
||||
;; insensitivity).
|
||||
(setq auto-mode-case-fold nil)
|
||||
|
||||
;; Less noise at startup. The dashboard/empty scratch buffer is good enough.
|
||||
;; Reduce *Message* noise at startup. An empty scratch buffer (or the dashboard)
|
||||
;; is more than enough.
|
||||
(setq inhibit-startup-message t
|
||||
inhibit-startup-echo-area-message user-login-name
|
||||
inhibit-default-init t
|
||||
;; Avoid pulling in many packages by starting the scratch buffer in
|
||||
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode'.
|
||||
;; Shave seconds off startup time by starting the scratch buffer in
|
||||
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode', which
|
||||
;; pull in a ton of packages.
|
||||
initial-major-mode 'fundamental-mode
|
||||
initial-scratch-message nil)
|
||||
|
||||
;; Get rid of "For information about GNU Emacs..." message at startup, unless
|
||||
;; we're in a daemon session, where it'll say "Starting Emacs daemon." instead,
|
||||
;; we're in a daemon session where it'll say "Starting Emacs daemon." instead,
|
||||
;; which isn't so bad.
|
||||
(unless (daemonp)
|
||||
(advice-add #'display-startup-echo-area-message :override #'ignore))
|
||||
@@ -233,7 +241,7 @@ users).")
|
||||
(setq abbrev-file-name (concat doom-local-dir "abbrev.el")
|
||||
async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log")
|
||||
bookmark-default-file (concat doom-etc-dir "bookmarks")
|
||||
custom-file (concat doom-private-dir "config.el")
|
||||
custom-file (concat doom-private-dir "custom.el")
|
||||
custom-theme-directory (concat doom-private-dir "themes/")
|
||||
desktop-dirname (concat doom-etc-dir "desktop")
|
||||
desktop-base-file-name "autosave"
|
||||
@@ -271,6 +279,11 @@ config.el instead."
|
||||
(setq-default bidi-display-reordering 'left-to-right
|
||||
bidi-paragraph-direction 'left-to-right)
|
||||
|
||||
;; Disabling the BPA makes redisplay faster, but might produce incorrect display
|
||||
;; reordering of bidirectional text with embedded parentheses and other bracket
|
||||
;; characters whose 'paired-bracket' Unicode property is non-nil.
|
||||
(setq bidi-inhibit-bpa t) ; Emacs 27 only
|
||||
|
||||
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
|
||||
;; in non-focused windows.
|
||||
(setq-default cursor-in-non-selected-windows nil)
|
||||
@@ -294,10 +307,10 @@ config.el instead."
|
||||
;; been determined, but we inhibit it there anyway.
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
|
||||
;; Performance on Windows is considerably worse than elsewhere, especially if
|
||||
;; WSL is involved. We'll need everything we can get.
|
||||
;; Performance on Windows is considerably worse than elsewhere. We'll need
|
||||
;; everything we can get.
|
||||
(when IS-WINDOWS
|
||||
(setq w32-get-true-file-attributes nil ; slightly faster IO
|
||||
(setq w32-get-true-file-attributes nil ; decrease file IO workload
|
||||
w32-pipe-read-delay 0 ; faster ipc
|
||||
w32-pipe-buffer-size (* 64 1024))) ; read more at a time (was 4K)
|
||||
|
||||
@@ -333,10 +346,14 @@ config.el instead."
|
||||
;; File+dir local variables are initialized after the major mode and its hooks
|
||||
;; have run. If you want hook functions to be aware of these customizations, add
|
||||
;; them to MODE-local-vars-hook instead.
|
||||
(defvar doom--inhibit-local-var-hooks nil)
|
||||
|
||||
(defun doom-run-local-var-hooks-h ()
|
||||
"Run MODE-local-vars-hook after local variables are initialized."
|
||||
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
||||
#'doom-try-run-hook))
|
||||
(unless doom--inhibit-local-var-hooks
|
||||
(set (make-local-variable 'doom--inhibit-local-var-hooks) t)
|
||||
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
||||
#'doom-try-run-hook)))
|
||||
|
||||
;; If the user has disabled `enable-local-variables', then
|
||||
;; `hack-local-variables-hook' is never triggered, so we trigger it at the end
|
||||
@@ -502,13 +519,17 @@ to least)."
|
||||
(file-missing
|
||||
;; If the autoloads file fails to load then the user forgot to sync, or
|
||||
;; aborted a doom command midway!
|
||||
(signal 'doom-error
|
||||
(list "Doom is in an incomplete state"
|
||||
"run 'bin/doom sync' on the command line to repair it"))))
|
||||
(if (equal (nth 3 e) doom-autoload-file)
|
||||
(signal 'doom-error
|
||||
(list "Doom is in an incomplete state"
|
||||
"run 'bin/doom sync' on the command line to repair it"))
|
||||
;; Otherwise, something inside the autoloads file is triggering this
|
||||
;; error; forward it!
|
||||
(apply #'doom-autoload-error e))))
|
||||
|
||||
;; Load shell environment, optionally generated from 'doom env'. No need
|
||||
;; to do so if we're in terminal Emacs, where Emacs correctly inherits
|
||||
;; your shell environment there.
|
||||
;; your shell environment.
|
||||
(if (or (display-graphic-p)
|
||||
(daemonp))
|
||||
(doom-load-envvars-file doom-env-file 'noerror))
|
||||
@@ -517,9 +538,9 @@ to least)."
|
||||
;; to configure their packages.
|
||||
(require 'core-modules)
|
||||
|
||||
;; There's a chance the user will want to use package.el or straight later
|
||||
;; on in this interactive session. If that's the case, make sure they're
|
||||
;; properly initialized when they do.
|
||||
;; There's a chance the user will later use package.el or straight in this
|
||||
;; interactive session. If they do, make sure they're properly initialized
|
||||
;; when they do.
|
||||
(autoload 'doom-initialize-packages "core-packages")
|
||||
(autoload 'doom-initialize-core-packages "core-packages")
|
||||
(with-eval-after-load 'package (require 'core-packages))
|
||||
@@ -537,7 +558,7 @@ to least)."
|
||||
(add-hook 'window-setup-hook #'doom-display-benchmark-h 'append)
|
||||
(if doom-debug-p (doom-debug-mode +1))
|
||||
|
||||
;; Load core/core-*.el, the user's private init.el and their config.el
|
||||
;; Load core/core-*.el, the user's private init.el, then their config.el
|
||||
(doom-initialize-modules force-p))
|
||||
|
||||
doom-init-p)
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
:local-repo "straight.el"
|
||||
:files ("straight*.el")
|
||||
:no-build t)
|
||||
:pin "09cfa1b344cbeeea7da2e075df7c19262fb2b9e6")
|
||||
:pin "fc077dda27dc603c6a287d9cffe0bf0ba5018d66")
|
||||
|
||||
;; core-modules.el
|
||||
(package! use-package
|
||||
:type 'core
|
||||
:pin "d2640fec376a8458a669e7526e63e5870d875118")
|
||||
:pin "7d925367ef0857d513d62eab4cb57b7436b9ffe9")
|
||||
|
||||
;; core-ui.el
|
||||
(package! all-the-icons :pin "ed8e44de4fa601309d2bba902c3b37cb73e4daa0")
|
||||
@@ -48,14 +48,10 @@
|
||||
;; optimizations (the original has been abandoned).
|
||||
:recipe (:host github :repo "hlissner/ws-butler")
|
||||
:pin "2bb49d3ee7d2cba133bc7e9cdac416cd1c5e4fe0")
|
||||
(unless IS-WINDOWS
|
||||
(package! clipetty
|
||||
:recipe (:host github :repo "spudlyo/clipetty")
|
||||
:pin "01b39044b9b65fa4ea7d3166f8b1ffab6f740362"))
|
||||
|
||||
;; core-projects.el
|
||||
(package! projectile :pin "7e552b6d876014ca5b4609318ca8a202b2a89014")
|
||||
(package! projectile :pin "bbcf781d3fddb8e00d0dc10eb68bc2528fb409b3")
|
||||
|
||||
;; core-keybinds.el
|
||||
(package! general :pin "a0b17d207badf462311b2eef7c065b884462cb7c")
|
||||
(package! which-key :pin "8b49ae978cceca65967f3544c236f32964ddbed0")
|
||||
(package! which-key :pin "3642c11d5ef9be3c6fb9edb8fd5ec3c370abd889")
|
||||
|
||||
@@ -13,7 +13,7 @@ But before you doom yourself, here are some things you should know:
|
||||
3. Use 'doom upgrade' to update Doom. Doing it any other way will require
|
||||
additional steps. Run 'doom help upgrade' to understand those extra steps.
|
||||
|
||||
4. Access Doom's documentation from within Emacs via 'SPC h D' or 'C-h D' (or
|
||||
'M-x doom/help')
|
||||
4. Access Doom's documentation from within Emacs via 'SPC h d h' or 'C-h d h'
|
||||
(or 'M-x doom/help')
|
||||
|
||||
Have fun!
|
||||
|
||||
Reference in New Issue
Block a user