mirror of
https://github.com/NinjaTrappeur/my-repo-pins.git
synced 2024-06-17 19:11:57 +02:00
h-jump-to-project: implement local project jump
Open a fuzzy-autocomplete mini-buffer to retrieve a project contained in code-root. Once selected, open the said project folder. First project milestone reached \0/
This commit is contained in:
parent
168345712b
commit
bc30dfa02f
23
h.el
23
h.el
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
(defcustom h-code-root nil
|
||||
"Directory containing the git projects.
|
||||
"Root directory containing all your projects.
|
||||
h.el organise the git repos you'll checkout in a tree fashion.
|
||||
|
||||
All the code fetched using h.el will end up in this root directory. A
|
||||
|
@ -49,6 +49,13 @@ local directory"
|
|||
:type 'directory
|
||||
:group 'h-group)
|
||||
|
||||
(defun h--safe-get-code-root ()
|
||||
"Ensure ‘h-code-root’ is correctly set, then canonalize the path.
|
||||
Errors out if ‘h-code-root’ has not been set yet."
|
||||
(progn (when (not h-code-root)
|
||||
(error "h-code-root has not been set. Please point it to your code root"))
|
||||
(file-name-as-directory h-code-root)))
|
||||
|
||||
(defcustom h-git-bin "git"
|
||||
"Path pointing to the git binary.
|
||||
By default, it'll look for git in the current $PATH."
|
||||
|
@ -103,5 +110,19 @@ an empty list."
|
|||
(mapcar remove-code-root-prefix projects-absolute-path)))
|
||||
projects-relative-to-code-root)))
|
||||
|
||||
(defun h-jump-to-project ()
|
||||
"Open a project contained in the ‘h-code-root’ directory.
|
||||
If the project is not here yet, check it out from the available sources."
|
||||
(interactive)
|
||||
(let* ((selected-project-from-coderoot
|
||||
(completing-read
|
||||
"Available projects: "
|
||||
(h--get-code-root-projects (h--safe-get-code-root))
|
||||
nil t ""))
|
||||
(selected-project-absolute-path (concat (h--safe-get-code-root) selected-project-from-coderoot)))
|
||||
(if (file-directory-p selected-project-absolute-path)
|
||||
(find-file selected-project-absolute-path)
|
||||
(error "NOT IMPLEMENTED: cannot checkout a new project for now"))))
|
||||
|
||||
(provide 'h)
|
||||
;;; h.el ends here
|
||||
|
|
Loading…
Reference in a new issue