(eshell-command "command %s") is not working with xdotool

Discussion of Emacs Lisp
Post Reply
masei
Posts: 1
Joined: Thu May 23, 2013 11:11 pm

(eshell-command "command %s") is not working with xdotool

Post by masei » Thu May 23, 2013 11:30 pm

Hi,

I am new to this forum and after years of using emacs without much lisp knoweledge I am working on training my elisp now.
I use emacs very often on differnt linux machines.
One thing I try to do is using emacs as an alternative for my keyboard-macro system. I want to use my yasnippets on the system as well.
I am using i3 as my Window-Manager. There is the function "i3-msg focus left" to focus the last used window.
Plan is:
* working in a specific window (browser etc)
* poping up emacsclient with *mymacro*-buffer
* typing phrase (with yasnippet completion
* typing shortcut for the pasting-function
* pasting function kills the paragraph backwards and pastes the killring in the last used window

I tried this, but it does not work:

Code: Select all

(defun pasting-function ()
(interactive)
(backward-kill-paragraph 1)
(eshell-command "sleep 0.5 && i3-msg focus left && xdotool type %s"(yank)))
Everthing it does is switching to the last window and pasting "%s" there.
Has anyone a short suggestion why this is happening?

Thanks very much for a hint!

Regard Marc Seibert

edgar-rft
Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: (eshell-command "command %s") is not working with xdotoo

Post by edgar-rft » Mon May 27, 2013 3:32 pm

masei wrote:Everthing it does is switching to the last window and pasting "%s" there.
Has anyone a short suggestion why this is happening?
Because you've told xdotool to type %s, and this is exactly what it does.

If you want %s to be replaced by the return value of (yank) then you need (format ...) as shown here:

Code: Select all

(eshell-command (format "sleep 0.5 && i3-msg focus left && xdotool type %s" (yank)))

Post Reply