dev: merging from main and pr7339
This commit is contained in:
commit
3daf85b919
18 changed files with 78 additions and 86 deletions
6
bin/doom
6
bin/doom
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -799,5 +799,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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)))
|
||||
|
@ -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 (and (not rebuild?) (not nobuild?))
|
||||
(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)))
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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))))
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
|
|
|
@ -265,9 +265,12 @@ localleader prefix."
|
|||
(set-keymap-parent doom-leader-map mode-specific-map))
|
||||
((equal doom-leader-alt-key "C-x")
|
||||
(set-keymap-parent doom-leader-map ctl-x-map)))
|
||||
(define-key map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(evil-define-key* doom-leader-key-states map (kbd doom-leader-key) 'doom/leader)
|
||||
(evil-define-key* doom-leader-alt-key-states map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(define-key map (kbd doom-leader-alt-key) #'doom-leader-map)
|
||||
(define-key map (kbd doom-localleader-alt-key) #'doom-localleader-map))
|
||||
(evil-define-key* '(normal visual motion) map (kbd doom-leader-key) #'doom-leader-map)
|
||||
(evil-define-key* '(emacs insert) map (kbd doom-leader-alt-key) #'doom-leader-map)
|
||||
(evil-define-key* '(normal visual motion) map (kbd doom-localleader-key) #'doom-localleader-map)
|
||||
(evil-define-key* '(emacs insert) map (kbd doom-localleader-alt-key) #'doom-localleader-map))
|
||||
(general-override-mode +1))))
|
||||
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -53,7 +53,7 @@ TAB/S-TAB.")
|
|||
(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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)))))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
;;; ui/workspaces/autoload/ivy.el -*- lexical-binding: t; -*-
|
||||
;;;###if (modulep! :completion ivy)
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace--ivy-rich-preview (workspace)
|
||||
(if-let (buffers (when-let (workspace (gethash workspace *persp-hash*))
|
||||
(cl-loop for (type . rest) in (persp-window-conf workspace)
|
||||
if (eq type 'buffer)
|
||||
collect (car leaf)
|
||||
else if (eq type 'leaf)
|
||||
append (cl-loop for (type . leaf) in rest
|
||||
if (eq type 'buffer)
|
||||
collect (car leaf)))))
|
||||
(string-join buffers " ")
|
||||
"*No buffers*"))
|
||||
|
||||
;;; ivy.el ends here
|
|
@ -318,12 +318,7 @@ workspace, otherwise the new workspace is blank."
|
|||
end of the workspace list."
|
||||
(interactive
|
||||
(list (or current-prefix-arg
|
||||
(if (modulep! :completion ivy)
|
||||
(ivy-read "Switch to workspace: "
|
||||
(+workspace-list-names)
|
||||
:caller #'+workspace/switch-to
|
||||
:preselect (+workspace-current-name))
|
||||
(completing-read "Switch to workspace: " (+workspace-list-names))))))
|
||||
(completing-read "Switch to workspace: " (+workspace-list-names)))))
|
||||
(when (and (stringp index)
|
||||
(string-match-p "^[0-9]+$" index))
|
||||
(setq index (string-to-number index)))
|
||||
|
|
|
@ -206,13 +206,6 @@ stored in `persp-save-dir'.")
|
|||
("xt" counsel-projectile-switch-project-action-run-term "invoke term from project root")
|
||||
("X" counsel-projectile-switch-project-action-org-capture "org-capture into project")))
|
||||
|
||||
(when (modulep! :completion ivy)
|
||||
(after! ivy-rich
|
||||
(cl-callf plist-put ivy-rich-display-transformers-list
|
||||
'+workspace/switch-to
|
||||
'(:columns ((ivy-rich-candidate (:width 50))
|
||||
(+workspace--ivy-rich-preview))))))
|
||||
|
||||
(when (modulep! :completion helm)
|
||||
(after! helm-projectile
|
||||
(setcar helm-source-projectile-projects-actions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue