Browse Source

Add the ability to highlight the selected text in Skim.app

Make a 'highlight note' upon grabbing a link from Skim.app if the
option 'org-mac-Skim-highlight-selection-p' is t.
Daniil Frumin 12 years ago
parent
commit
77cef42138
1 changed files with 13 additions and 0 deletions
  1. 13 0
      contrib/lisp/org-mac-link-grabber.el

+ 13 - 0
contrib/lisp/org-mac-link-grabber.el

@@ -136,6 +136,12 @@ applications and inserting them in org documents"
   :group 'org-mac-link-grabber
   :group 'org-mac-link-grabber
   :type 'boolean)
   :type 'boolean)
 
 
+(defcustom org-mac-Skim-highlight-selection-p nil
+  "Highlight (using notes) the selection (if present) when grabbing the a link from Skim.app"
+  :tag "Highlight selection in Skim.app"
+  :group 'org-mac-link-grabber
+  :type 'boolean)
+
 
 
 (defun omlg-grab-link ()
 (defun omlg-grab-link ()
   "Prompt the user for an application to grab a link from, then go grab the link, and insert it at point"
   "Prompt the user for an application to grab a link from, then go grab the link, and insert it at point"
@@ -506,6 +512,13 @@ applications and inserting them in org documents"
        "set theContent to contents of (get text for theSelection)\n"
        "set theContent to contents of (get text for theSelection)\n"
        "if theContent is missing value then\n"
        "if theContent is missing value then\n"
        "    set theContent to theTitle & \", p. \" & thePage\n"
        "    set theContent to theTitle & \", p. \" & thePage\n"
+       (when org-mac-Skim-highlight-selection-p
+	 (concat
+	  "else\n"
+          "    tell theDoc\n"
+          "        set theNote to make note with properties {type:highlight note, selection:theSelection}\n"
+          "         set text of theNote to (get text for theSelection)\n"
+          "    end tell\n"))
        "end if\n"
        "end if\n"
        "set theLink to \"skim://\" & thePath & \"::\" & thePage & "
        "set theLink to \"skim://\" & thePath & \"::\" & thePage & "
        "\"::split::\" & theContent\n"
        "\"::split::\" & theContent\n"