1
I want to invoke commands from within MS Office application which have a direct effect on my (open) Emacs application, for example
- do a search for the currently selected text in Emacs
I wonder how I can do that. Is there a direct way to send commands to Emacs? I'm running Emacs 24.3.1 on Windows 7 with the server options
;;prevent error message of unsafe server (see http://stackoverflow.com/a/1313577/772434 )
(require 'server)
(and (>= emacs-major-version 23) (defun server-ensure-safe-dir (dir) "Noop" t))
(server-start)
;;(add-to-list 'load-path "~/path/to/org/protocol/")
(require 'org-protocol)
and I'm using org-protocol
thanks, that works so far. However, the output of the commnand is displayed in the terminal. How can I define the command, so that the command is executed in Emacs itself? I tried with emacsclient --eval (org-search-view "mysearchterm") This should create a list with search results and I'd like to have it displayed in an existing or new Emacs buffer. – MostlyHarmless – 2014-07-31T11:39:55.030
The value that your form evaluates to is displayed in your terminal. However, the elisp forms are executed in Emacs itself. For exemple,
org-search-view
evaluates tot
, which is normally not shown anywhere when you run it interactively, but is displayed in your terminal when you run it usingemacsclient
. The useful results of your search are however displayed in an Org Agenda buffer, whether you call it interactively from the command loop, or usingemacsclient
. – François Févotte – 2014-07-31T12:16:29.2471In your case, I think the problem rather comes from the way you call
org-search-view
non-interactively: the pattern should be the 2nd argument. See my edit and the documentation fororg-search-view
. – François Févotte – 2014-07-31T12:16:45.867Thanks again for your help and the suggested changes! It still does not work for me - in the command line I get ERROR: End of file during parsing and there is no visible change in the open emacs buffers – MostlyHarmless – 2014-07-31T12:40:04.940
1Mmm, it looks like your emacs lisp form is incomplete. Either it is a silly copy/paste problem, or (more probably) a problem with quotes in the command line. Unfortunately, I'm no expert on the Windows command line... – François Févotte – 2014-07-31T14:43:46.337
quoting was not entirely correct - see my edit. Now it works fine, thanks again! :-) – MostlyHarmless – 2014-08-01T07:18:22.847