diff options
author | Yuchen Pei <hi@ypei.me> | 2022-10-20 15:56:27 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-10-20 15:56:27 +1100 |
commit | e0408b2cb6dd773a512a15c55dfe46e4babed654 (patch) | |
tree | c0fe672a7f94cd3eb19510ebbe973d3db8d48ad2 | |
parent | 179461ba0ec028a408a836c2f277e3f3a998c33a (diff) |
org store and capture
-rw-r--r-- | luwak.el | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -89,6 +89,24 @@ When non-nill, swap the tor-switch in prefix-arg effect." index)) (reverse index))) +(defun luwak-guess-title () + (save-excursion + (goto-char (point-min)) + (re-search-forward "^[^[:space:]]" nil t) + (buffer-substring-no-properties (1- (point)) + (progn (end-of-line 1) (point))))) + +(defun luwak-org-store-link () + (when (derived-mode-p 'luwak-mode) + (org-link-store-props + :type "luwak" + :link (plist-get luwak-data :url) + :description (luwak-guess-title)))) + +(org-link-set-parameters "luwak" + :follow #'luwak-open + :store #'luwak-org-store-link) + (defun luwak-open (url) "Open URL in luwak." (interactive "sUrl to open: ") |