3

I have several [[elisp:org-todo-list][todo list]] links in my Org documents. When I use C-c C-o (org-open-at-point), Org mode asks me whether I really want to open that link. While this is good practice in general, I know that org-todo-list will never break anything in my documents or workflow.

Can I tell Org to just open any link to its todo list without asking for confirmation?

1 Answer 1

4

Can I tell org mode to just open the link without asking for confirmation?

Yes. Org provides the customizable variable org-link-elisp-skip-confirm-regexp. Set it accordingly:

(setq org-link-elisp-skip-confirm-regexp "\\`org-todo-list\\'")

You really want to include the begin-of-string (\` ) and end-of-string (\') matchers to catch links like [[elisp:(remove-all-files); org-todo-list]][Evil link]].

If you use more commands, add them to the regular expression as an alternative via |:

(setq org-link-elisp-skip-confirm-regexp "\\`\\(org-todo-list\\|org-agenda-list\\)\\'")

If you have many commands, you probably want to use a list for that instead:

(let ((safe-commands '(org-agenda-list
                       org-clock-goto
                       org-goto-calendar
                       org-tags-view
                       org-todo-list)))
  (setq org-link-elisp-skip-confirm-regexp
        (concat "\\`\\(" (mapconcat #'symbol-name safe-commands "\\|") "\\)\\'")))

For more information, see org-link-elisp-skip-confirm-regexp's documentation.

3
  • This works great with functions not having any arguments. However, for some reason for functions with arguments adding the string start and/or end delimiters seems no longer to recognize the exception. Without the delimiters it does work (confirming the correct use of regexp within the string), as if the string is not starting/ending with the parentheses. What am I missing (GNU Emacs 29.1)?
    – Phoenix
    Commented Dec 31, 2023 at 13:39
  • @Phoenix do you have a regex that doesn't work as an example?
    – Zeta
    Commented Jan 1 at 19:43
  • An example would be an elisp function I wrote to perform an LDAP search. This function takes a string to look up an object: (LDAPsearch "computername"). So, the only dubious character I can think of is the quotation characters (ASCII character 34), though I escaped everything properly and it works just fine without string delimiters.
    – Phoenix
    Commented Jan 2 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.