Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not add to kill ring. #120

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading