Advertisement
Guest User

Untitled

a guest
Mar 4th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- These properties are meant to be editable by you.
  2. property emacsClientLocation : "/usr/local/Cellar/emacs/HEAD-9f56d04/bin/emacsclient"
  3. property emacsSocketLocation : "/var/folders/r5/bvgmmyp57397sx47ftscn7sm0000gn/T/emacs501/server"
  4.  
  5. -- Beyond this point, there be dragons. Proceed at your peril. --
  6.  
  7. on open location thisURL
  8.     set urlString to decodeText(thisURL)
  9.     set pageTitle to decodeText(getPageTitle(thisURL))
  10.    
  11.     set emacsSocketLocationParam to "-s " & emacsSocketLocation & " "
  12.     set theCommand to emacsClientLocation & " " & emacsSocketLocationParam & (quoted form of thisURL) & " > /dev/null 2>&1 &"
  13.    
  14.     try
  15.         set result to do shell script theCommand
  16.     on error number exitCode
  17.         display notification "emacsclient exited with code " & exitCode
  18.     end try
  19.    
  20.     display notification "Saved \"" & pageTitle & "\""
  21.    
  22.     if urlString contains "capture" then
  23.         if application "Emacs" is running then
  24.             tell application "Emacs" to activate
  25.         end if
  26.     end if
  27. end open location
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement