2

I'm trying to write a complex (to me) dired function, where I want to open a xterm window which will launch an application (fbot) with many arguments and input all marked dired files into that statement. This is based on that if I run in dired & followed by this

xterm -e filebot -script fn:amc  /home/zeltak/mounts/lraid/raid/ztmp/amc  --output "/home/zeltak/mounts/lraid/raid/ztmp/" --def @/home/zeltak/.config/filebot/Q.txt --action move --conflict skip -non-strict  --mode interactive *

It works exactly as expected. So I tried fiddling with a function based on that and this is where I am in now which doesn't seem to work:

(defun z/dired-media-filebot-xterm ()
"filebot amc interactive"
(interactive)
(start-process "xterm -e filebot -script fn:amc  /home/zeltak/mounts/lraid/raid/ztmp/amc  --output "/home/zeltak/mounts/lraid/raid/ztmp/" --def @/home/zeltak/.config/filebot/Q.txt --action move --conflict skip -non-strict  --mode interactive * &" nil "filebot" file)
)
1

Do you need to use xterm? Dired already has a function to run shell commands on a list of files: dired-do-shell-command, that seems like an easier place to start. If for some reason you do need to run your command through xterm, it might be simpler to wrap it up in a shell script, then call that shell script via dired-do-shell-command:

#!/bin/bash
xterm -e filebot <argument list> @1

Update

I don't have filebot available to test with, but this works for me:

#!/bin/bash
xterm -e nano $1

If that works for you, your problem must be with filebot. If it doesn't work for you, I'm not sure what else to try.

  • thx @Tyler. well the filebot command is interactive and will present menus via a ncurses interface. will emacs be able to deal with that? – zeltak Feb 23 '17 at 14:34
  • also @tyler, the above simple bash script launches a xterm window which closes after a second when i launch it from dired (& tst.sh) – zeltak Feb 23 '17 at 14:37
  • No, you can't use ncurses within Emacs (or maybe via term-mode, but I find that a pain). You should be able to call xterm from a script as I describe though. – Tyler Feb 23 '17 at 14:37
  • hmm so i cant seem to get it to work for me. this is current script: paste.xinu.at/lHH7x. yet it just flashes a xterm window for 1 sec? i use it by marking a dired file, pressing & then paste test.sh * – zeltak Feb 23 '17 at 14:45
  • see my updated answer – Tyler Feb 23 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.