diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-02-28 11:46:00 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-02-28 11:46:00 +0000 |
commit | e3aa4c70064f0e5d20fd60e186dfa3ad25a988a4 (patch) | |
tree | adce1072a53c210c3f5cd56c32bf777252781339 /.emacs.d | |
parent | e0a7cc97fd987e758a6133bf1ae0a11188f7b65e (diff) | |
download | dotfiles-e3aa4c70064f0e5d20fd60e186dfa3ad25a988a4.tar.gz |
Improve project switching
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/lisp/init-project.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/.emacs.d/lisp/init-project.el b/.emacs.d/lisp/init-project.el index 100f9bf..3d4363b 100644 --- a/.emacs.d/lisp/init-project.el +++ b/.emacs.d/lisp/init-project.el @@ -39,6 +39,10 @@ project-recentf-files nil 'file-name-history nil) project-root))) (message "recentf is not enabled"))) + (defun project-switch-src-project () + (interactive) + (let ((default-directory "~/src/")) + (call-interactively #'project-switch-project))) (add-to-list 'project-switch-commands '(?h "Recentf" project-recentf) t) (add-to-list 'project-switch-commands '(?m "Magit" magit-status) t) @@ -55,7 +59,8 @@ ;; Add this hook last so so that vc takes precedence over local (add-hook 'project-find-functions 'project-try-local 90) :bind - ("C-x p P" . project-switch-project) + ("C-x p P" . project-switch-src-project) + ("C-x p M-p" . project-switch-project) ("C-x f" . project-recentf)) (use-package perspective @@ -92,7 +97,8 @@ (car (seq-filter (lambda (pr) (string-match-p persp pr)) (project-known-project-roots)))))) (defun switch-project (proj) "Switch to project or already open project perspective." - (interactive (list (project-prompt-project-dir))) + (interactive (list (let ((default-directory "~/src/")) ;; TODO make this customisable + (project-prompt-project-dir)))) (let* ((persp-name (file-name-nondirectory (directory-file-name proj))) (persp (gethash persp-name (perspectives-hash)))) (unless (equal persp (persp-curr)) |