emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-wiki-discuss] Mac OS X Services Menu and Remember


From: Philipp Grau
Subject: Re: [emacs-wiki-discuss] Mac OS X Services Menu and Remember
Date: Sun, 26 Feb 2006 13:12:49 +0100

Hello, 

* Bruce Durling <address@hidden> [25.02.06 10:38]:
> Does anyone know enough mac mojo to know how to add remember  
> selection to this list? I'll keep hunting around myself. Searching  
> for mac osx services on google is giving me a metric ton of results  
> and almost all of them don't have anything to do with the services menu.

Well, I have to admit that I have no real clue. But from what I see you have
to: 

- Add a entry to Aquamacs Emacs.app/Contents/Info.plist to the 
  NSServices-Array. Just copy "New Buffer Containing Selection" and modify.
  
  I tried the following:
----------8<--------snipp---------8<-------------------------
<dict>
   <key>NSKeyEquivalent</key>
   <dict/>
   <key>NSMenuItem</key>
   <dict>
       <key>default</key>
       <string>Aquamacs Emacs/Remember selection</string>
   </dict>
   <key>NSMessage</key>
   <string>remember-selection</string>
   <key>NSPortName</key>
   <string>Aquamacs Emacs</string>
   <key>NSReturnTypes</key>
   <array/>
   <key>NSSendTypes</key>
   <array>
      <string>NSStringPboardType</string>
   </array>
</dict>  
----------8<--------snipp---------8<-------------------------
  
- Modify Aquamacs Emacs.app/Resources/lisp/term/mac-win.el.gz:
  
  Ungzip it and remove Aquamacs Emacs.app/Resources/lisp/term/mac-win.elc.
  
  Apply the following patch:
  
----------8<--------snipp---------8<-------------------------
  
--- mac-win.el.org      2006-02-26 13:03:27.000000000 +0100
+++ mac-win.el  2006-02-26 12:57:48.000000000 +0100
@@ -1543,6 +1543,12 @@
   (save-buffer) ; It pops up the save dialog.
   )
 
+(defun mac-services-remember-selection () 
+  "Create a new remember buffer containing the selection value for Services"
+  (interactive)
+  (remember)
+  (insert (x-selection-value mac-services-selection))
+  )
 (defun mac-services-mail-selection ()
   "Prepare a mail buffer containing the selection value for Services."
   (interactive)
@@ -1572,6 +1578,8 @@
   'mac-services-open-file)
 (define-key mac-apple-event-map [services perform open-selection]
   'mac-services-open-selection)
+(define-key mac-apple-event-map [services perform remember-selection]
+  'mac-services-remember-selection)
 (define-key mac-apple-event-map [services perform mail-selection]
   'mac-services-mail-selection)
 (define-key mac-apple-event-map [services perform mail-to]  
----------8<--------snipp---------8<-------------------------

- Logout (in order to reload the services menu)

- Login

- Open Safari, load a page, select some text, open 
  Safari->Services->Aquoamacs Emacs->Remember Selection

- Enjoy (hopefully)  

This work for me(TM).

Philipp



























































































> 
> I'm starting to get some traction with this, but if anyone has solved  
> it already it would be great to save some time and head scratching.  
> It would be well cool if this could work, because then I could add  
> things to planner from any Mac app by just selecting the text. w00t!
> 
> cheers,
> Bruce
> a loyal planner (and now muse-mode) addict
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
> 
> iD8DBQFD//GYQtGyfqBKsBwRAqvTAJ0VwK+DmM9R7/yVR426ZHMLUmBLaQCferwJ
> UJ+GglJr/JDpHkcDm6Uhwjg=
> =qfSF
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> emacs-wiki-discuss mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss
\bye
Philipp


-- 
 Philipp Grau               | Freie Universitaet Berlin 
 address@hidden  | Zentraleinrichtung fuer Datenverarbeitung
                            |
    We had joy, we had fun, | we had Pacman on the sun...      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]