From cfc11ec8078e8103f8e029881c3ab5be6a6f35ff Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Wed, 30 Mar 2022 08:42:06 +0200 Subject: [PATCH] Keep Org links after insertion by default When inserting links multiple times, it's annoying to have to go back to the original place the link points to and reinsert it into the stored link list. Using a universal argument to toggle `org-link-keep-stored-after-insertion` is also not an option, as I keep forgetting to use it. Instead, by default keep all links after insertion. To be able to handle the growing list of links, we now provide a function `db/org-clear-stored-links` to set the list of stored links to the empty list. --- init.el | 3 ++- site-lisp/db-org.el | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index e879ace..7a955ad 100644 --- a/init.el +++ b/init.el @@ -744,6 +744,7 @@ db/org-onenote-open db/org-outlook-open db/org-rfc-open + db/org-clear-stored-links db/org-cleanup-continuous-clocks db/find-csv-in-org db/org-mark-current-default-task @@ -952,7 +953,7 @@ org-dblock-write:org-ql)) (use-package ol - :init (setq org-link-keep-stored-after-insertion nil) + :init (setq org-link-keep-stored-after-insertion t) :commands (org-store-link)) (use-package org-id diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index cc5640d..d7d63d7 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -524,6 +524,13 @@ open RFC in HTML format in the default browser." (warn "`db/rfc-cache-path' not defined or not an absolute writable path, opening RFC in browser.") (browse-url (concat "https://tools.ietf.org/html/rfc" number))))) +(defun db/org-clear-stored-links () + "Clear list of stored links by setting `org-stored-links' to NIL. +This might be handy when links are kept by setting +`org-link-keep-stored-after-insertion' to T, but too many links +have accumulated over time." + (interactive) + (setq org-stored-links nil)) ;;; Org Utilities