This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

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

2 posts · 6627 views

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:
(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

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

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:
(eshell-command (format "sleep 0.5 && i3-msg focus left && xdotool type %s" (yank)))