Add qwan/paste-stripped-url
qwen 0.6 had the good sense to go untiil end of the line with the regexp, but called the wrong regexp function - or called it wrongly. elisp 'helpfully' gave End of File error. qwen MoE 30 got the correct function, but put in a regexp that only removed the ?. So I added `.*$` by hand, and it passed manual testing. Since I will be using this a lot, no unit-ish test needed. (test everything that can possibly break). Tested on mac, should work on linux (according to MoE30)
This commit is contained in:
+13
-1
@@ -48,7 +48,19 @@ only the description"
|
|||||||
(insert content)))))))
|
(insert content)))))))
|
||||||
(bind-key "C-c r" 'qwan/org-replace-link-by-link-description)
|
(bind-key "C-c r" 'qwan/org-replace-link-by-link-description)
|
||||||
|
|
||||||
(defun org-roam-replace-file-link-by-website-or-description ()
|
(defun strip-url (url)
|
||||||
|
"Remove everything after ? from the url, to hinder tracking."
|
||||||
|
(replace-regexp-in-string "\\?.*$" "" url))
|
||||||
|
|
||||||
|
;; TODO define key for this maybe SPC q is available? no, that is quit.
|
||||||
|
(defun qwan/paste-stripped-url ()
|
||||||
|
"Paste a URL without tracking from the clipboard into the current buffer."
|
||||||
|
(interactive)
|
||||||
|
(let ((url (x-get-selection 'CLIPBOARD)))
|
||||||
|
(when url
|
||||||
|
(insert (strip-url url)))))
|
||||||
|
|
||||||
|
(defun qwan/org-roam-replace-file-link-by-website-or-description ()
|
||||||
"If a linked org-roam file has a website as key,
|
"If a linked org-roam file has a website as key,
|
||||||
use that as the link target instead of the filename.
|
use that as the link target instead of the filename.
|
||||||
Otherwise, remove the link, and leave just the description.
|
Otherwise, remove the link, and leave just the description.
|
||||||
|
|||||||
Reference in New Issue
Block a user