From ec5827a48e4553c7816f93d205502ba778351e4d Mon Sep 17 00:00:00 2001
From: Takaaki ISHIKAWA <takaxp@ieee.org>
Date: Thu, 15 Jun 2017 22:42:27 +0900
Subject: [PATCH] org-mac-link: Add a custom list for link descriptors

* contrib/lisp/org-mac-link.el: Add a custom list for link descriptors

Adding a custom variable named `org-mac-link-descriptors' 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 new setting to the list.

Modified from a patch proposal by Takaaki Ishikawa.
---
 contrib/lisp/org-mac-link.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

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)
 
-- 
2.10.1 (Apple Git-78)

