From 8fddddcbc8332eee63797a99a343f785edf96599 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 22 Dec 2012 17:13:43 +0100 Subject: [PATCH] org.el (org-store-link): A double prefix argument now skips module store-link functions * org.el (org-store-link): A double prefix argument now skips module store-link functions to only use Org's core functions. Also, when several modular store-link functions match, ask for which one to use. Thanks to Jonas Bernoulli for this idea. --- lisp/org.el | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 2dcb289fd..a0a125894 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8876,20 +8876,31 @@ type. For a simple example of an export function, see `org-bbdb.el'." This link is added to `org-stored-links' and can later be inserted into an org-buffer with \\[org-insert-link]. -For some link types, a prefix arg is interpreted: -For links to usenet articles, arg negates `org-gnus-prefer-web-links'. -For file links, arg negates `org-context-in-file-links'." +For some link types, a prefix arg is interpreted. +For links to Usenet articles, arg negates `org-gnus-prefer-web-links'. +For file links, arg negates `org-context-in-file-links'. + +A double prefix arg force skipping storing functions that are not +part of Org's core." (interactive "P") (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset (org-with-limited-levels - (let (link cpltxt desc description search txt custom-id agenda-link) + (let (link cpltxt desc description search txt custom-id agenda-link sfuns sfunsn) (cond - - ((run-hook-with-args-until-success 'org-store-link-functions) - (setq link (plist-get org-store-link-plist :link) - desc (or (plist-get org-store-link-plist :description) link))) - + ((and (not (equal arg '(16))) + (setq sfuns + (delete + nil (mapcar (lambda (f) (let (fs) (if (funcall f) (push f fs)))) + org-store-link-functions)) + sfunsn (mapcar (lambda (fu) (symbol-name (car fu))) sfuns)) + (or (and (cdr sfuns) + (funcall (intern + (completing-read "Which function for creating the link? " + sfunsn t (car sfunsn))))) + (funcall (caar sfuns))) + (setq link (plist-get org-store-link-plist :link) + desc (or (plist-get org-store-link-plist :description) link)))) ((org-src-edit-buffer-p) (let (label gc) (while (or (not label) -- 2.11.4.GIT