<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ok, I RTFM'd and solved my problems. I came up with this:<div><br></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">(defun call-PetesLookup ()</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">  "Execute PetesLookup, feeding it the current selected region as a command-line argument."</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">  (interactive)</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">  (progn</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">    (setq searchterm (buffer-substring (point) (mark)))</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">    (call-process "/Users/siemsen/Applications/PetesLookup.app/Contents/MacOS/PetesLookup" nil nil nil searchterm)</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">  )</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">)</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="4"><span class="Apple-style-span" style="font-size: 14px;">(define-key osx-key-mode-map (kbd "A-&") 'call-PetesLookup)</span></font></div><div><br></div><div>I'm certainly no Elisp wizard, so this may not be optimal, but it works.</div><div><br></div><div>Thanks!</div><div><br><div>-- Pete</div><div><br></div><div><br><div><div>On May 4, 2010, at 11:46 AM, <a href="mailto:siemsen@ucar.edu">siemsen@ucar.edu</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>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.<br><br>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.<br><br>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:<br><br>   (define-key osx-key-mode-map (kbd "A-&") (call-process "/Users/siemsen/Applications/PetesLookup.app/Contents/MacOS/PetesLookup" nil nil nil "test"))<br><br>This almost works, but<br><br>Problem 1:<br>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-&.<br><br>Problem 2:<br>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?<br><br>-- Pete<br><br></div></blockquote></div><br></div></div></body></html>