From 7061f0dd46975836e79df9df8ad8b183f10920ef Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 9 Dec 2023 11:43:39 +0000 Subject: use new project-prefix-or-any-command --- .emacs.d/init.el | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 4d5c0369..447ffe8a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -410,14 +410,7 @@ windows side-by-side in the frame." '(org-yank-folded-subtrees nil) '(proced-enable-color-flag t) '(proced-show-remote-processes t) - '(project-switch-commands - '((project-find-file "Find file") (project-find-regexp "Find regexp") - (project-find-dir "Find directory") - (project-dired "Root Dired" "C-x C-j") (project-vc-dir "VC-Dir") - (spw/project-vc-root-diff "VC-Diff" "D") - (spw/project-vc-print-root-log "VC-Log" "L") - (transient-cycles-cmd-spw/project-eshell "Eshell"))) - '(project-switch-use-entire-map t) + '(project-switch-commands 'project-prefix-or-any-command) '(rcirc-default-full-name "Sean Whitton [spwhitton@spwhitton.name]") '(rcirc-default-nick "spwhitton") '(rcirc-default-user-name "spwhitton") @@ -463,6 +456,7 @@ windows side-by-side in the frame." '(transient-cycles-window-buffers-mode t) '(uniquify-buffer-name-style 'post-forward nil (uniquify)) '(use-short-answers t) + '(vc-deduce-backend-nonvc-modes t) '(vc-find-revision-no-save t) '(vc-follow-symlinks t) '(vc-git-diff-switches '("--patch-with-stat" "-M" "-C") nil nil "We might also consider -B.") @@ -1866,6 +1860,7 @@ Some ideas behind these behaviours are as follows. (ring-insert ring buffer)) (ring-insert ring (current-buffer)) ring))) +(put 'spw/project-eshell 'project-related t) (spw/reclaim-keys-from dired-x dired-mode-map "\M-!") (spw/reclaim-keys-from term term-raw-map "\M-!" "\M-&") @@ -1903,6 +1898,7 @@ Some ideas behind these behaviours are as follows. ;; Bind into project-prefix-map, rather than adding a remap, so that we ;; have it under C-x 4 p, C-x 5 p etc. too. :keymap project-prefix-map))) +(put 'transient-cycles-cmd-spw/project-eshell 'project-related t) ;;;; Miscellaneous functions & commands @@ -2102,13 +2098,6 @@ Some ideas behind these behaviours are as follows. (mapcan #'dirs-below contents))))) (dirs-below (expand-file-name "~/src"))))) -(defmacro spw/with-project-root-dired (&rest body) - (declare (indent 0)) - `(progn (require 'project) - (with-current-buffer - (dired-noselect (project-root (project-current t))) - ,@body))) - (defun spw/clone-repo () (interactive) (let* ((method @@ -3003,6 +2992,7 @@ mutt's review view, after exiting EDITOR." (spw/macroexp-for (cmd) (compose-mail compose-mail-other-window compose-mail-other-frame + mailscripts-prepare-patch mailscripts-git-format-patch-attach bongo-playlist) (let ((new (intern (concat "spw/" (symbol-name cmd))))) @@ -3991,10 +3981,6 @@ unread." (global-set-key "\C-cvH" #'magit-reflog-head) (global-set-key "\C-cvO" #'magit-reflog-other) -(spw/defun-pass-to-gdbmacs spw/mailscripts-prepare-patch () - (interactive) - ;; Ensure the current buffer is one `vc-deduce-backend' can handle. - (spw/with-project-root-dired (mailscripts-prepare-patch))) (spw/when-library-available mailscripts (global-set-key "\C-cvm" #'spw/mailscripts-prepare-patch) ;; Want a dedicated binding for this because often need it with Debian BTS. @@ -4153,18 +4139,8 @@ unread." (derived-mode-p 'diff-mode))) (log-edit-show-diff))) -;;; If we just add `vc-print-root-log' to `project-switch-commands', it seems -;;; to work, but if you try to expand any commits it'll try to run git(1) in -;;; the old project/dir, not the new one. `vc-root-diff' has issues too. -;;; So add these commands instead. - -(defun spw/project-vc-root-diff () - (interactive) - (spw/with-project-root-dired (vc-root-diff nil))) - -(defun spw/project-vc-print-root-log () - (interactive) - (spw/with-project-root-dired (vc-print-root-log))) +(spw/feature-define-keys ((project project-prefix-map)) + "L" #'vc-print-root-log "D" #'vc-root-diff "\C-x\C-j" #'project-dired) (defun spw/eshell-find-git-subcommand () (or (and-let* ((gitdir -- cgit v1.2.3