How do I control emacs from a terminal?

2020-07-29 17:37发布

问题:

I'm trying to drive emacs on OSX using Dragon Naturally Speaking running inside a Windows VM. Rather than running emacs in the VM, I'd like to drive an emacs (built from the HEAD of the repository) already running on the mac side of things. So, after a hunt through the emacs lisp manual I came up with the following snippets of lisp (currently running from the scratch buffer while I work stuff out):

;; This part is run from an emacsclient -t session
(defvar slave-frame last-event-frame)

;; and this is run in a GUI frame
(defadvice handle-switch-frame (after update-slave-redirect-advice activate)
  (unless (eq last-event-frame slave-frame)
    (redirect-frame-focus slave-frame last-event-frame)))

And all is well. I type into the terminal window, displaying buffer A and my typing appears in the GUI frame busily dsplaying buffer B. Great. Until I do C-x C-f or any other command that needs the minibuffer, at which point I get the error Terminal 1 is locked, cannot read from it.

I'm I barking up the wrong tree here, or is there a way to make redirect-frame-focus work nicely with commands that use the minibuffer?

回答1:

Piers,

What behavior do you want, redirection to a minibuffer on the (Windows) client or a minibuffer on the server? Also, what version/flavor of emacs are you using?



标签: emacs elisp