diff options
author | Yuchen Pei <id@ypei.org> | 2025-01-17 09:48:03 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2025-01-17 09:48:03 +1100 |
commit | ddb5b07e1e43c7b44877bae9d786dbb80ca95311 (patch) | |
tree | 9b1dc12efc8913dcacd8ff62f1624fc02507a1a1 /emacs/.emacs.d/lisp/my/my-magit.el | |
parent | e7d07c825a29621cd1be7d787d5e1565bc3d3513 (diff) |
[emacs] Adding buttons to infobox
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-magit.el')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-magit.el | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-magit.el b/emacs/.emacs.d/lisp/my/my-magit.el index efb3c84..eabed05 100644 --- a/emacs/.emacs.d/lisp/my/my-magit.el +++ b/emacs/.emacs.d/lisp/my/my-magit.el @@ -32,23 +32,26 @@ (require 'my-project) (require 'org) -(defun my-magit-clone-org-source (arg) - (interactive "P") - (let* ((url (or (org-entry-get (point) "Source") - (org-entry-get (point) "Website"))) - (default-base-dir - (alist-get "3p" my-projects-root-dirs nil nil 'string=)) +(defun my-magit-clone (url prefix-arg) + (let* ((default-base-dir + (alist-get "3p" my-projects-root-dirs nil nil 'string=)) (default-name - (progn (string-match "^.*/\\(.*?\\)\\(\\.git\\)?$" url) - (match-string 1 url))) + (progn (string-match "^.*/\\(.*?\\)\\(\\.git\\)?$" url) + (match-string 1 url))) (dir (read-file-name - (if arg "Clone to: " "Shallow clone to: ") + (if prefix-arg "Clone to: " "Shallow clone to: ") (concat default-base-dir "/") nil nil default-name))) - (if arg + (if prefix-arg (magit-clone-regular url dir nil) - (magit-clone-shallow url dir nil 1)) + (magit-clone-shallow url dir nil 1)))) + +(defun my-magit-clone-org-source (arg) + (interactive "P") + (let* ((url (or (org-entry-get (point) "Source") + (org-entry-get (point) "Website")))) + (my-magit-clone url arg) (org-set-property "Local-source" (format "<file:%s>" dir)))) |