6 changes: 3 additions & 3 deletions bin/doom
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
(user-error (message "Error: %s" (cadr e))
(kill-emacs 2)))

;; UX: Abort if the user is using 'doom' as root, unless ~/.config/emacs is
;; owned by root, in which case we assume the user genuinely wants root to be
;; their primary user account for Emacs.
;; UX: Abort if the user is using 'doom' as root, unless $EMACSDIR is owned by
;; root, in which case we can safely assume the user genuinely wants root to
;; be their primary user account for this session.
(when (equal 0 (user-real-uid))
(unless (equal 0 (file-attribute-user-id (file-attributes doom-emacs-dir)))
(message
Expand Down
15 changes: 7 additions & 8 deletions lisp/cli/install.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,19 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
(setq doom-user-dir (expand-file-name "doom/" xdg-config-dir)))))

(if (file-directory-p doom-user-dir)
(print! (item "Skipping %s (already exists)") (relpath doom-user-dir))
(print! (item "Skipping %s (already exists)") (path doom-user-dir))
(make-directory doom-user-dir 'parents)
(print! (success "Created %s") (relpath doom-user-dir)))
(print! (success "Created %s") (path doom-user-dir)))

;; Create init.el, config.el & packages.el
(print-group!
(mapc (lambda (file)
(cl-destructuring-bind (filename . template) file
(if (file-exists-p! filename doom-user-dir)
(print! (item "Skipping %s (already exists)")
(path filename))
(print! (item "Creating %s%s") (relpath doom-user-dir) filename)
(with-temp-file (doom-path doom-user-dir filename)
(insert-file-contents template))
(setq filename (doom-path doom-user-dir filename))
(if (file-exists-p filename)
(print! (item "Skipping %s (already exists)...") (path filename))
(print! (item "Creating %s...") (path filename))
(with-temp-file filename (insert-file-contents template))
(print! (success "Done!")))))
(let ((template-dir (doom-path doom-emacs-dir "templates")))
`((,doom-module-init-file
Expand Down
29 changes: 28 additions & 1 deletion lisp/cli/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ list remains lean."
(print-group!
(if-let (pin (cdr (assoc package pinned)))
(print! (item "Pinned to %s") pin)
(print! (item "Checked out %s") commit)))
(when commit
(print! (item "Checked out %s") commit))))
;; HACK: Line encoding issues can plague
;; repos with dirty worktree prompts
;; when updating packages or "Local
Expand Down Expand Up @@ -799,5 +800,31 @@ However, in batch mode, print to stdout instead of stderr."
"/dev/null")))
(apply fn args)))

;; If the repo failed to clone correctly (usually due to a connection failure),
;; straight proceeds as normal until a later call produces a garbage result
;; (typically, when it fails to fetch the remote branch of the empty directory).
;; This causes Straight to throw an otherwise cryptic type error when it tries
;; to sanitize the result for its log buffer.
;;
;; This error is a common source of user confusion and false positive bug
;; reports, so this advice catches them to regurgitates a more cogent
;; explanation.
(defadvice! doom-cli--straight-throw-error-on-no-branch-a (fn &rest args)
:around #'straight--process-log
(letf! ((defun shell-quote-argument (&rest args)
(unless (car args)
(error "Package was not properly cloned due to a connection failure, please try again later"))
(apply shell-quote-argument args)))
(apply fn args)))

(defadvice! doom-cli--straight-regurgitate-empty-string-error-a (fn &rest args)
:around #'straight-vc-git-local-repo-name
(condition-case-unless-debug e
(apply fn args)
(wrong-type-argument
(if (eq (cadr e) 'stringp)
(error "Package was not properly cloned due to a connection failure, please try again later")
(signal (car e) (cdr e))))))

(provide 'doom-cli-packages)
;;; packages.el ends here
24 changes: 14 additions & 10 deletions lisp/cli/sync.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
(noupdate? ("-U") "Don't update any packages")
(purge? ("--gc") "Purge orphaned package repos & regraft them")
(jobs ("-j" "--jobs" num) "How many threads to use for native compilation")
(rebuild? ("-b" "--rebuild") "Rebuild, compile, & symlink installed packages")
(auto? ("-B") "Rebuild packages, but only if necessary")
(rebuild? ("-b" "--rebuild") "Rebuild all installed packages, unconditionally")
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
&context context)
"Synchronize your config with Doom Emacs.
Expand All @@ -52,8 +52,6 @@ OPTIONS:
:benchmark t
(when (doom-profiles-bootloadable-p)
(call! '(profiles sync "--reload")))
(when (doom-cli-context-suppress-prompts-p context)
(setq auto? t))
(when jobs
(setq native-comp-async-jobs-number (truncate jobs)))
(run-hooks 'doom-before-sync-hook)
Expand All @@ -75,11 +73,15 @@ OPTIONS:
(when (and old-host (not (equal old-host (system-name))))
(print! (warn "Your system has changed since last sync"))
(setq to-rebuild t))
(when (and to-rebuild (not auto?))
(or (y-or-n-p
(format! " %s" "Your installed packages will need to be recompiled. Do so now?"))
(exit! 0))
(setq rebuild? t)))
(when (and to-rebuild (not (doom-cli-context-suppress-prompts-p context)))
(cond (nobuild?
(print! (warn "Packages must be rebuilt, but -B has prevented it. Skipping...")))
((doom-cli-context-get context 'upgrading)
(print! (warn "Packages will be rebuilt"))
(setq rebuild? t))
((y-or-n-p (format! " %s" "Installed packages must be rebuilt. Do so now?"))
(setq rebuild? t))
((exit! 0)))))
(when (and (not noenvvar?)
(file-exists-p doom-env-file))
(call! '(env)))
Expand All @@ -89,7 +91,9 @@ OPTIONS:
(when (doom-profile-generate)
(print! (item "Restart Emacs or use 'M-x doom/reload' for changes to take effect"))
(run-hooks 'doom-after-sync-hook))
(with-temp-file doom-cli-sync-info-file (prin1 (cons emacs-version (system-name)) (current-buffer)))
(when (or rebuild? (not (file-exists-p doom-cli-sync-info-file)))
(with-temp-file doom-cli-sync-info-file
(prin1 (cons emacs-version (system-name)) (current-buffer))))
t)
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)))

Expand Down
11 changes: 8 additions & 3 deletions lisp/cli/upgrade.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
(defcli! ((upgrade up))
((packages? ("-p" "--packages") "Only upgrade packages, not Doom")
(jobs ("-j" "--jobs" num) "How many CPUs to use for native compilation")
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
&context context)
"Updates Doom and packages.
Expand All @@ -29,10 +30,11 @@ following shell commands:
cd ~/.emacs.d
git pull --rebase
doom clean
doom sync -u"
(let* ((force? (doom-cli-context-suppress-prompts-p context))
(sync-cmd (append '("sync" "-u" "-B") (if jobs `("-j" ,num)))))
(sync-cmd (append '("sync" "-u")
(if nobuild? '("-B"))
(if jobs `("-j" ,num)))))
(cond
(packages?
;; HACK It's messy to use straight to upgrade straight, due to the
Expand All @@ -53,7 +55,9 @@ following shell commands:
;; Reload Doom's CLI & libraries, in case there were any upstream changes.
;; Major changes will still break, however
(print! (item "Reloading Doom Emacs"))
(doom-cli-context-put context 'upgrading t)
(exit! "doom" "upgrade" "-p"
(if nobuild? "-B")
(if force? "--force")
(if jobs (format "--jobs=%d" jobs))))

Expand Down Expand Up @@ -95,6 +99,8 @@ following shell commands:
(sh! "git" "reset" "--hard" (format "origin/%s" branch))
(sh! "git" "clean" "-ffd")))

;; In case of leftover state from a partial/incomplete 'doom upgrade'
(sh! "git" "branch" "-D" target-remote)
(sh! "git" "remote" "remove" doom-upgrade-remote)
(unwind-protect
(let (result)
Expand Down Expand Up @@ -135,7 +141,6 @@ following shell commands:
(ignore (print! (error "Aborted")))
(print! (start "Upgrading Doom Emacs..."))
(print-group!
(doom-compile-clean)
(doom-cli-context-put context 'straight-recipe (doom-upgrade--get-straight-recipe))
(or (and (zerop (car (sh! "git" "reset" "--hard" target-remote)))
(equal (cdr (sh! "git" "rev-parse" "HEAD")) new-rev))
Expand Down
3 changes: 2 additions & 1 deletion lisp/doom-profiles.el
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ Defaults to the profile at `doom-profile-default'."
;; FIX: Make sure this only runs at startup to protect us Emacs' interpreter
;; re-evaluating this file when lazy-loading dynamic docstrings from the
;; byte-compiled init file.
`((when (doom-context-p 'init)
`((when (or (doom-context-p 'init)
(doom-context-p 'reload))
,@(cl-loop for var in doom-autoloads-cached-vars
if (boundp var)
collect `(set-default ',var ',(symbol-value var)))
Expand Down
2 changes: 1 addition & 1 deletion modules/app/everywhere/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:config
(set-yas-minor-mode! 'emacs-everywhere-mode)

;; HACK Inhibit MAJOR-MODE-local-vars-hook in emacs-everywhere buffers,
;; HACK: Inhibit MAJOR-MODE-local-vars-hook in emacs-everywhere buffers,
;; because Doom commonly starts servers and other extraneous services on
;; this hook, which will rarely work well in emacs-everywhere's temporary
;; buffers anyway.
Expand Down
2 changes: 1 addition & 1 deletion modules/completion/corfu/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use the minibuffer such as `query-replace'.")
(corfu-mode +1))))
:config
(setq corfu-auto t
corfu-auto-delay 0.1
corfu-auto-delay 0.18
corfu-auto-prefix 2
global-corfu-modes '((not
erc-mode
Expand Down
14 changes: 0 additions & 14 deletions modules/lang/emacs-lisp/autoload.el
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,6 @@ This generally applies to your private config (`doom-user-dir') or Doom's source
;;
;;; Fontification

;;;###autoload
(defun +emacs-lisp-truncate-pin ()
"Truncates long SHA1 hashes in `package!' :pin's."
(save-excursion
(goto-char (match-beginning 0))
(and (stringp (plist-get (sexp-at-point) :pin))
(search-forward ":pin" nil t)
(let ((start (re-search-forward "\"[^\"\n]\\{12\\}" nil t))
(finish (and (re-search-forward "\"" (line-end-position) t)
(match-beginning 0))))
(when (and start finish)
(put-text-property start finish 'display "...")))))
nil)

(defvar +emacs-lisp--face nil)
;;;###autoload
(defun +emacs-lisp-highlight-vars-and-faces (end)
Expand Down
2 changes: 0 additions & 2 deletions modules/lang/emacs-lisp/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ See `+emacs-lisp-non-package-mode' for details.")
'emacs-lisp-mode
(append `(;; custom Doom cookies
("^;;;###\\(autodef\\|if\\|package\\)[ \n]" (1 font-lock-warning-face t)))
;; Shorten the :pin of `package!' statements to 10 characters
`(("(package!\\_>" (0 (+emacs-lisp-truncate-pin))))
;; highlight defined, special variables & functions
(when +emacs-lisp-enable-extra-fontification
`((+emacs-lisp-highlight-vars-and-faces . +emacs-lisp--face)))))
Expand Down
2 changes: 0 additions & 2 deletions modules/lang/nix/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
:interpreter ("\\(?:cached-\\)?nix-shell" . +nix-shell-init-mode)
:mode "\\.nix\\'"
:init
;; Treat flake.lock files as json. Fall back to js-mode because it's faster
;; than js2-mode, and its extra features aren't needed there.
(add-to-list 'auto-mode-alist
(cons "/flake\\.lock\\'"
(if (modulep! :lang json)
Expand Down
24 changes: 12 additions & 12 deletions modules/lang/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
"(provide 'org-version)\n")))))
:pin "7a6bb0904d01b50680f9028f7c0f3cfc6ae3aa6e")
:pin "e9c288dfaccc2960e5b6889e6aabea700ad4e05a")
(package! org-contrib
:recipe (:host github
:repo "emacsmirror/org-contrib")
:pin "8fbaceb247a775ad1534af97859c740e82cc955a")
:pin "d4056ce5d5611e1c971c151f182a2d407226fdb1")

(package! avy)
(package! htmlize :pin "dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9")
(package! htmlize :pin "09d43dfa44899f194095bb3500a45ec5b34d59c6")
(package! org-yt
:recipe (:host github :repo "TobiasZawada/org-yt")
:pin "56166f48e04d83668f70ed84706b7a4d8b1e5438")
(package! ox-clip :pin "ff117cf3c619eef12eccc0ccbfa3f11adb73ea68")
(package! ox-clip :pin "a549cc8e1747beb6b7e567ffac27e31ba45cb8e8")
(package! toc-org :pin "6d3ae0fc47ce79b1ea06cabe21a3c596395409cd")
(package! org-cliplink :pin "13e0940b65d22bec34e2de4bc8cba1412a7abfbc")

;; TODO Adjust when this is added to GNU ELPA
(when (modulep! +contacts)
(package! org-contacts
:pin "7f03eafaad2e5746949c0bebb98353e939c51ade"
:pin "6660db078f7687af3bc31f702e3e957d4d7654bd"
:recipe (:host nil
:type git
:repo "https://repo.or.cz/org-contacts.git")))
Expand All @@ -71,7 +71,7 @@
(when (modulep! :tools pdf)
(package! org-pdftools :pin "4e420233a153a9c4ab3d1a7e1d7d3211c836f0ac"))
(when (modulep! :tools magit)
(package! orgit :pin "84bcb5c318f01b9ffc8d5aa18a7c393fe9c714b2")
(package! orgit :pin "a57beefa24712430fe6b5016b9273129931a8287")
(when (modulep! :tools magit +forge)
(package! orgit-forge :pin "f2ff9e5ad68b3e860379a1d368ad6d8a9696b719")))
(when (modulep! +brain)
Expand All @@ -84,11 +84,11 @@
(when (modulep! +ipython) ; DEPRECATED
(package! ob-ipython :pin "7147455230841744fb5b95dcbe03320313a77124"))
(when (modulep! +jupyter)
(package! jupyter :pin "da306a6dbda6f1e285281765a311938a1d9db022"))
(package! jupyter :pin "2059d79b2fecf6d25a6c796b69ab954645ec37d1"))
(when (modulep! +journal)
(package! org-journal :pin "605a7eb984a95fc6ec122df800632bf56ff59514"))
(package! org-journal :pin "17b34ce8df9649a73b715c13698220bde1628668"))
(when (modulep! +noter)
(package! org-noter :pin "8be376384772c1f053cb2ce907ddf4d484b390dd"))
(package! org-noter :pin "9e4f57957b8f54db20a4e13bf8d6b32e004ab3e8"))
(when (modulep! +pomodoro)
(package! org-pomodoro :pin "3f5bcfb80d61556d35fc29e5ddb09750df962cc6"))
(when (modulep! +pretty)
Expand All @@ -100,11 +100,11 @@
:recipe (:host github :repo "anler/centered-window-mode")
:pin "80965f6c6afe8d918481433984b493de72af5399")
(package! org-tree-slide :pin "e2599a106a26ce5511095e23df4ea04be6687a8a")
(package! org-re-reveal :pin "7c39d15b841c7a8d197a24c89e5fef5d54e271aa")
(package! org-re-reveal :pin "1944ac53d4cdd0fb250cc575447d5e6320fd5f81")
(package! revealjs
:recipe (:host github :repo "hakimel/reveal.js"
:files ("css" "dist" "js" "plugin"))
:pin "16f6633014672567de85aefd1f4639ffea0dde56"))
:pin "6410c756ea91ded3fa5f6b40a872523e7b8fe723"))
(cond
((modulep! +roam)
(package! org-roam
Expand Down Expand Up @@ -162,6 +162,6 @@
(when (modulep! +hugo)
(package! ox-hugo
:recipe (:host github :repo "kaushalmodi/ox-hugo" :nonrecursive t)
:pin "cb1b6cfd7b080e889352150416c1725f11ba937a"))
:pin "c4156d9d383bf97853ba9e16271b7c4d5e697f49"))
(when (modulep! :lang rst)
(package! ox-rst :pin "99fa790da55b57a3f2e9aa187493ba434a64250e"))
6 changes: 3 additions & 3 deletions modules/tools/magit/packages.el
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;; -*- no-byte-compile: t; -*-
;;; tools/magit/packages.el

(when (package! magit :pin "0963697f24cfbe80f92312044bd9ab28b914b053")
(when (package! magit :pin "0e8f25a8d8011328f2bf082232c720b24c2a12c2")
(when (modulep! +forge)
(package! forge :pin "68771ca4d53c3aea5c860eeb888cee8e9cb5ca37")
(package! forge :pin "2a3b41eb6235b3f39c017c1f86b3928a45c5a64d")
(package! code-review
:recipe (:host github
:repo "doomelpa/code-review"
:files ("graphql" "code-review*.el"))
:pin "e4c34fa284da25d8e0bafbae4300f1db5bdcda44"))
(package! magit-todos :pin "1e9acc0ba63fbc297001bf334d63cb4326be80df"))
(package! magit-todos :pin "332ce763f7336ea356964b92723678aa1ed4640f"))
9 changes: 5 additions & 4 deletions modules/ui/ligatures/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ and cannot run in."
(fboundp 'mac-auto-operator-composition-mode))
(add-hook 'doom-init-ui-hook #'mac-auto-operator-composition-mode 'append))

;; NOTE: the module does not support Emacs 27 and less, but if we still try to enable ligatures,
;; it will end up in catastrophic work-loss errors, so we leave the check here for safety.
;; This module does not support Emacs 27 and less, but if we still try to
;; enable ligatures, it will end up in catastrophic work-loss errors, so we
;; leave the check here for safety.
((and (> emacs-major-version 27)
(or (featurep 'ns)
(string-match-p "HARFBUZZ" system-configuration-features))
(featurep 'composite)) ; Emacs loads `composite' at startup
(featurep 'harfbuzz))
(featurep 'composite)) ; Emacs loads `composite' at startup

(use-package! ligature
:config
Expand Down
2 changes: 1 addition & 1 deletion modules/ui/treemacs/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This must be set before `treemacs' has loaded.")
treemacs-persist-file (concat doom-cache-dir "treemacs-persist")
treemacs-last-error-persist-file (concat doom-cache-dir "treemacs-last-error-persist"))
:config
;; Don't follow the cursor
;; Don't follow the cursor (it's more disruptive/jarring than helpful as a default)
(treemacs-follow-mode -1)

(set-popup-rule! "^ ?\\*Treemacs" :ignore t)
Expand Down
17 changes: 0 additions & 17 deletions modules/ui/workspaces/autoload/ivy.el

This file was deleted.

Loading