Dear folks, The attached patch includes a change for adding a custom variable to easily extend link grabbing capabilities for masOS user. When someone wants to add an additional menu to call an external application, it will be possible by adding a setting to the proposed variable as follows:
#+BEGIN_SRC emacs-lisp (add-to-list 'org-mac-link-descriptors `("P" "apers" org-mac-papers-insert-frontmost-paper-link ,org-mac-grab-Papers-app-p) t) #+END_SRC This example intends to handle Papers.app, not freeware[*1], in macOS. If `org-mac-papers-insert-frontmost-paper-link' and `mac-grab-Papers-app-p' are implemented by user correctly, an appropriate link will be inserted into an org buffer. I don't want put such codes to `org-mac-link.el' directly to avoid unnecessary increase of file size. This scenario can be applied to other applications. The inserted link can be opened by `C-c C-o' if the corresponding link type is configured by `org-link-set-parameters' like the following. #+BEGIN_SRC emacs-lisp (org-link-set-parameters "papers3" :follow (lambda (path) (let ((cmd (concat "open papers3:" path))) (shell-command-to-string cmd) (message "%s" cmd)))) #+END_SRC =================================================== * contrib/lisp/org-mac-link.el: Add a custom list for link descriptors `org-mac-link-descriptors' is added to extend link grabbing capabilities. Modified from a patch proposal by Takaaki Ishikawa. =================================================== Kind regards, Takaaki [*1] http://papersapp.com/mac/ -- Takaaki ISHIKAWA <tak...@ieee.org>
diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el index 8ba485d..fa424e0 100644 --- a/contrib/lisp/org-mac-link.el +++ b/contrib/lisp/org-mac-link.el @@ -217,6 +217,26 @@ :group 'org-mac-link :type 'string) +(defcustom org-mac-link-descriptors + `(("F" "inder" org-mac-finder-insert-selected ,org-mac-grab-Finder-app-p) + ("m" "ail" org-mac-message-insert-selected ,org-mac-grab-Mail-app-p) + ("d" "EVONthink Pro Office" org-mac-devonthink-item-insert-selected + ,org-mac-grab-devonthink-app-p) + ("o" "utlook" org-mac-outlook-message-insert-selected ,org-mac-grab-Outlook-app-p) + ("a" "ddressbook" org-mac-addressbook-insert-selected ,org-mac-grab-Addressbook-app-p) + ("s" "afari" org-mac-safari-insert-frontmost-url ,org-mac-grab-Safari-app-p) + ("f" "irefox" org-mac-firefox-insert-frontmost-url ,org-mac-grab-Firefox-app-p) + ("v" "imperator" org-mac-vimperator-insert-frontmost-url ,org-mac-grab-Firefox+Vimperator-p) + ("c" "hrome" org-mac-chrome-insert-frontmost-url ,org-mac-grab-Chrome-app-p) + ("e" "evernote" org-mac-evernote-note-insert-selected ,org-mac-grab-Evernote-app-p) + ("t" "ogether" org-mac-together-insert-selected ,org-mac-grab-Together-app-p) + ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p) + ("A" "crobat" org-mac-acrobat-insert-page ,org-mac-grab-Acrobat-app-p)) + "Descriptors to select an application." + :tag "A list of descriptors" + :group 'org-mac-link' + :type 'symbol) + ;; In mac.c, removed in Emacs 23. (declare-function do-applescript "org-mac-message" (script)) @@ -238,21 +258,7 @@ "Prompt for an application to grab a link from. When done, go grab the link, and insert it at point." (interactive) - (let* ((descriptors - `(("F" "inder" org-mac-finder-insert-selected ,org-mac-grab-Finder-app-p) - ("m" "ail" org-mac-message-insert-selected ,org-mac-grab-Mail-app-p) - ("d" "EVONthink Pro Office" org-mac-devonthink-item-insert-selected - ,org-mac-grab-devonthink-app-p) - ("o" "utlook" org-mac-outlook-message-insert-selected ,org-mac-grab-Outlook-app-p) - ("a" "ddressbook" org-mac-addressbook-insert-selected ,org-mac-grab-Addressbook-app-p) - ("s" "afari" org-mac-safari-insert-frontmost-url ,org-mac-grab-Safari-app-p) - ("f" "irefox" org-mac-firefox-insert-frontmost-url ,org-mac-grab-Firefox-app-p) - ("v" "imperator" org-mac-vimperator-insert-frontmost-url ,org-mac-grab-Firefox+Vimperator-p) - ("c" "hrome" org-mac-chrome-insert-frontmost-url ,org-mac-grab-Chrome-app-p) - ("e" "evernote" org-mac-evernote-note-insert-selected ,org-mac-grab-Evernote-app-p) - ("t" "ogether" org-mac-together-insert-selected ,org-mac-grab-Together-app-p) - ("S" "kim" org-mac-skim-insert-page ,org-mac-grab-Skim-app-p) - ("A" "crobat" org-mac-acrobat-insert-page ,org-mac-grab-Acrobat-app-p))) + (let* ((descriptors org-mac-link-descriptors) (menu-string (make-string 0 ?x)) input)