[OS X Emacs] How to call "call-process"

siemsen at ucar.edu siemsen at ucar.edu
Tue May 4 13:46:06 EDT 2010


In Aquamacs 2-preview6, I have some minor problems executing an external program.  The problems are not Aquamacs issues, they come from my lack of understanding of Emacs Lisp.

I have a program named PetesLookup that looks up words in a dictionary (it's more than that, but imagine it's a simple dictionary).  The program takes one string argument on the command line and displays a Cocoa window containing the "definition" of the string.  Then I click an "OK" button or hit RETURN to dismiss the window and terminate the program.

I want to execute the program from Aquamacs.  I want to be able to highlight a word in an Aquamacs frame, hit a special key, and see a window pop up containing the definition of the word.  I defined this in my startup file:

   (define-key osx-key-mode-map (kbd "A-&") (call-process "/Users/siemsen/Applications/PetesLookup.app/Contents/MacOS/PetesLookup" nil nil nil "test"))

This almost works, but

Problem 1:
The PetesLookup program is executed every time I start Aquamacs.  I obviously don't want it to execute when I start Aquamacs, but whenever I hit A-&.

Problem 2:
Unrelated to problem 1, instead of "test", I want to feed the program the currently highlighted string in the edit buffer.  What is the syntax to pass in the string that I've highlighted with the mouse?

-- Pete






More information about the MacOSX-Emacs mailing list