Org 中的链接会渲染成如下情况
我现在复制光标下的链接用的是 C-c C-l
,然后 C-x h
+ M-w
。
不知道有没有更方便的命令,还是像 获取光标所在字符串的方法? 自己写一个?
;; From https://www.reddit.com/r/emacs/comments/erro41/weekly_tipstricketc_thread/
(defun org-copy-entire-link-at-point ()
"Save the link at point in the kill ring."
(interactive)
(when (org-in-regexp org-link-bracket-re 1)
(kill-ring-save (match-beginning 0) (match-end 0))
(message "%s" (car kill-ring))))
(defun org-with-link (fn)
"Call function FN with the target of the link at point to the kill ring."
(if-let* ((link (when (org-in-regexp org-bracket-link-regexp)
(org-link-unescape (match-string-no-properties 1)))))
(funcall fn link)
(user-error "Not in a link.")))
(defun org-copy-link-at-point ()
"Copy the target of the link at point to the kill ring."
(interactive)
(org-with-link (lambda (link)
(kill-new link)
(message "%s" link))))
感觉这个人像是玩 爵士鼓的。
咋一看以为什么高科技