Skip to content

Commit

Permalink
Merge pull request #120 from mijoharas/feature-kill-ring-toggle
Browse files Browse the repository at this point in the history
Add option to not add to kill ring.
  • Loading branch information
sshaw authored Apr 13, 2024
2 parents 57f5406 + a5b87c3 commit f16ced3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions git-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ function set to that function's symbol."
:type '(choice boolean function)
:group 'git-link)

(defcustom git-link-add-to-kill-ring t
"if t also add the link to the kill-ring"
:type 'boolean
:group 'git-link)

(defcustom git-link-use-commit nil
"If non-nil use the latest commit's hash in the link instead of the branch name."
:type 'boolean
Expand Down Expand Up @@ -541,14 +546,18 @@ return (FILENAME . REVISION) otherwise nil."
(list line-start line-end)))))

(defun git-link--new (link)
(kill-new link)
(if git-link-add-to-kill-ring
(kill-new link))

;; prevent URL escapes from being interpreted as format strings
(message (replace-regexp-in-string "%" "%%" link t t))
(setq deactivate-mark t)
(when git-link-open-in-browser
(if (fboundp git-link-open-in-browser)
(funcall git-link-open-in-browser link)
(browse-url link))))
(browse-url link)))
link
)

(defun git-link-codeberg (hostname dirname filename branch commit start end)
(format "https://%s/%s/src/%s/%s"
Expand Down

0 comments on commit f16ced3

Please sign in to comment.