all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Dired shell command on file asymchronously
       [not found] <mailman.1007.1119560755.2857.help-gnu-emacs@gnu.org>
@ 2005-06-24 12:59 ` Josef.Bauer.NOSPAM
       [not found]   ` <mailman.1102.1119633137.2857.help-gnu-emacs@gnu.org>
  2005-06-24 18:10   ` Luis O. Silva
  2005-06-24 13:06 ` asymchronously Dan Elliott
  1 sibling, 2 replies; 7+ messages in thread
From: Josef.Bauer.NOSPAM @ 2005-06-24 12:59 UTC (permalink / raw)
  Cc: l.o.silva

>>>>> "Luis" == Luis O Silva <l.o.silva@mail.ru> writes:

    Luis> Dear Emacs community, Goal: Being in Dired mode I want to
    Luis> apply a shell command to a file asynchronously.

Hi,

maybe check out my post

 http://groups.google.de/group/gnu.emacs.sources/browse_thread/thread/74f5eef321a64b60/a0bf8a70d3b85ab5?q=dired-do-shell-command-in-background&rnum=1&hl=de#a0bf8a70d3b85ab5

or search for 

 dired-do-shell-command-in-background

in google groups.

Best regards

Josef

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: asymchronously
       [not found] <mailman.1007.1119560755.2857.help-gnu-emacs@gnu.org>
  2005-06-24 12:59 ` Dired shell command on file asymchronously Josef.Bauer.NOSPAM
@ 2005-06-24 13:06 ` Dan Elliott
  2005-06-24 18:17   ` asymchronously Luis O. Silva
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Elliott @ 2005-06-24 13:06 UTC (permalink / raw)


Luis O. Silva wrote:
> Dear Emacs community,
> 
> Goal:
> Being in Dired mode I want to apply a shell command to a file
> asynchronously.
> 
> Details:
> I'm using the extension dired-x.el, Emacs 21.2.1. When in
> Dired mode I use dired-do-shell-command for launching xdvi on
> a .dvi file. I want to use Emacs further while browsing the
> xdvi window, but that is impossible since Emacs waits until
> the xdvi process is terminated.

When I perform a shell command on files, etc. in emacs, I just put a & 
after the command.  This may be to simplistic, but it seems to work.

- dan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dired shell command on file asymchronously
       [not found]   ` <mailman.1102.1119633137.2857.help-gnu-emacs@gnu.org>
@ 2005-06-24 17:43     ` Josef.Bauer.NOSPAM
  2005-06-24 21:19       ` Kevin Rodgers
       [not found]       ` <mailman.1131.1119648589.2857.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Josef.Bauer.NOSPAM @ 2005-06-24 17:43 UTC (permalink / raw)


Hi,

I just found that I added a minor improvement in the meantime. Using
'shell-quote-argument' file names with spaces and such are working.

Here is the new version:

;-----------------------------------------------------------------
(defun dired-do-shell-command-in-background (command)
  "In dired, do shell command in background on the file or directory named on this line."
  (interactive
   (list (dired-read-shell-command (concat "& on " "%s: ") nil (list (dired-get-filename)))))
  (call-process command nil 0 nil (shell-quote-argument (dired-get-filename))))

(add-hook 'dired-load-hook
	  (function (lambda ()
		      (load "dired-x")
		      (define-key dired-mode-map "&" 'dired-do-shell-command-in-background))))

(setq dired-guess-shell-alist-user
      (list (list "\\.wav$" "snack") (list "\\.au$" "snack")
	    (list "\\.doc$" "OOo" ) (list "\\.xls$" "OOo")))
;-----------------------------------------------------------------

Greetings

Josef

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dired shell command on file asymchronously
  2005-06-24 12:59 ` Dired shell command on file asymchronously Josef.Bauer.NOSPAM
       [not found]   ` <mailman.1102.1119633137.2857.help-gnu-emacs@gnu.org>
@ 2005-06-24 18:10   ` Luis O. Silva
  1 sibling, 0 replies; 7+ messages in thread
From: Luis O. Silva @ 2005-06-24 18:10 UTC (permalink / raw)


Hi Josef,

Thank you for your message (24 Jun 2005 14:59:55 +0200), in
which, among other things, you wrote[1]:

   JB> maybe check out my post

   JB> http://groups.google.de/group/gnu.emacs.sources/browse_thread/thread/74f5eef321a64b60/a0bf8a70d3b85ab5?q=dired-do-shell-command-in-background&rnum=1&hl=de#a0bf8a70d3b85ab5

   JB> or search for

   JB>  dired-do-shell-command-in-background

   JB> in google groups.

this seems to be what I needed. Thank you very much. I'll test
your code today.

Thank you,
luis


Footnotes:
[1] The excerpts of your message are prefixed by "JB>".

-- 
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: asymchronously
  2005-06-24 13:06 ` asymchronously Dan Elliott
@ 2005-06-24 18:17   ` Luis O. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Luis O. Silva @ 2005-06-24 18:17 UTC (permalink / raw)


Hi Dan,

Thank you for your message (Fri, 24 Jun 2005 08:06:26 -0500),
in which, among other things, you wrote[1]:

   >> Details: I'm using the extension dired-x.el, Emacs
   >> 21.2.1. When in Dired mode I use dired-do-shell-command
   >> for launching xdvi on a .dvi file. I want to use Emacs
   >> further while browsing the xdvi window, but that is
   >> impossible since Emacs waits until the xdvi process is
   >> terminated.

   Dan> When I perform a shell command on files, etc. in
   Dan> emacs, I just put a & after the command.  This may be
   Dan> to simplistic, but it seems to work.

Thank you for the suggestion. As Josef explain in post:

 http://groups.google.de/group/gnu.emacs.sources/browse_thread/thread/74f5eef321a64b60/a0bf8a70d3b85ab5?q=dired-do-shell-command-in-background&rnum=1&hl=de#a0bf8a70d3b85ab5

this solves the problem just partially. Here I also thank
Emilio for a similar suggestion.

Best regards,
luis



Footnotes:
[1] The excerpts of your message are prefixed by "Dan>".

-- 
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dired shell command on file asymchronously
  2005-06-24 17:43     ` Josef.Bauer.NOSPAM
@ 2005-06-24 21:19       ` Kevin Rodgers
       [not found]       ` <mailman.1131.1119648589.2857.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2005-06-24 21:19 UTC (permalink / raw)


Josef.Bauer.NOSPAM@web.de wrote:
 > I just found that I added a minor improvement in the meantime. Using
 > 'shell-quote-argument' file names with spaces and such are working.
 >
 > Here is the new version:
 >
 > ;-----------------------------------------------------------------
 > (defun dired-do-shell-command-in-background (command)
 >   "In dired, do shell command in background on the file or directory 
named on this line."
 >   (interactive
 >    (list (dired-read-shell-command (concat "& on " "%s: ") nil (list 
(dired-get-filename)))))
 >   (call-process command nil 0 nil (shell-quote-argument 
(dired-get-filename))))

That doesn't make sense to me.  call-process passes its &rest ARGS
directly to PROGRAM, without any word-splitting etc. by the shell.  So
shell-quote-argument is unecessary, and in fact could introduce quoting
characters that would be interpreted as part of the file name.

If COMMAND is actually a shell command (i.e. with redirection operators
etc.) then you must use shell-command instead of call-process.  If it is
just a program, then using call-process is fine -- but again, using
shell-quote-argument with it is not.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dired shell command on file asymchronously
       [not found]       ` <mailman.1131.1119648589.2857.help-gnu-emacs@gnu.org>
@ 2005-06-27 12:54         ` Josef.Bauer.NOSPAM
  0 siblings, 0 replies; 7+ messages in thread
From: Josef.Bauer.NOSPAM @ 2005-06-27 12:54 UTC (permalink / raw)


    Josef> (call-process command nil 0 nil (shell-quote-argument
    Josef> (dired-get-filename))))

    Kevin> That doesn't make sense to me.  call-process passes its
    Kevin> &rest ARGS directly to PROGRAM, without any word-splitting
    Kevin> etc. by the shell.  So shell-quote-argument is unecessary,
    Kevin> and in fact could introduce quoting characters that would
    Kevin> be interpreted as part of the file name.

I think you are right: It works better without the
shell-quote-argument. Please excuse that mistake --- I told you I'm
far from a lisp guru!

Always trying to avoid such things like spaces in filenames I don't
need this very often. I think I had a case where it worked with the
shell-quote-argument but I can't remember what it was.

Best regards

Josef

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-27 12:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1007.1119560755.2857.help-gnu-emacs@gnu.org>
2005-06-24 12:59 ` Dired shell command on file asymchronously Josef.Bauer.NOSPAM
     [not found]   ` <mailman.1102.1119633137.2857.help-gnu-emacs@gnu.org>
2005-06-24 17:43     ` Josef.Bauer.NOSPAM
2005-06-24 21:19       ` Kevin Rodgers
     [not found]       ` <mailman.1131.1119648589.2857.help-gnu-emacs@gnu.org>
2005-06-27 12:54         ` Josef.Bauer.NOSPAM
2005-06-24 18:10   ` Luis O. Silva
2005-06-24 13:06 ` asymchronously Dan Elliott
2005-06-24 18:17   ` asymchronously Luis O. Silva

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.