[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shell-command - missing shell-quote-argument for program?
From: |
Lennart Borgman |
Subject: |
Re: shell-command - missing shell-quote-argument for program? |
Date: |
Fri, 13 Oct 2006 23:26:01 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (Windows/20060909) |
Kim F. Storm wrote:
Lennart Borgman <address@hidden> writes:
The author of filesets Thomas Link has replied to me that he currently
does not use Emacs and cannot maintain filesets.el until that situation
changes.
I myself therefore suggest the following patch to filesets.el:
Isolated, it looks ok, but if you look at filesets-quote, maybe
it should use shell-quote-argment too, and we should
use filesets-quote on buffer-file-name below.
But it's too complex for me to follow the logic in filesets.
I just printed filesets.el - 40 pages ;-)
Yes, I missed filesets-quote. It is used in
filesets-get-quoted-selection. This is in turned used only in
filesets-command:
("Grep <<selection>>"
"grep"
("-n " filesets-get-quoted-selection " " "<<file-name>>"))
This is a shell command so in filesets-get-quoted-selection I think that
shell-quote-argument should be used.
filesets-quote is also used in filesets-run-cmd--repl-fn:
((equal arg "<<file-name>>")
(filesets-quote (buffer-file-name)))
filesets-rum-cmd--repl-fn is only used in filesets-run-cmd where it is
used two times. The first use of this function looks like this
(cond
((stringp fn)
(let* ((args
(let ((txt ""))
(dolist (this args txt)
(setq txt
(concat txt
(filesets-run-cmd--repl-fn
this
(lambda (this)
(if (equal txt "") "" " ")
(format "%s" this))))))))
(cmd (concat fn " " args)))
(filesets-cmd-show-result
cmd (shell-command-to-string cmd))))
What is intended is probably something like this:
(cond
((stringp fn)
(let* ((args
(let ((txt ""))
(dolist (this args txt)
(setq txt
(concat txt
(if (equal txt "")
"" " ")
(shell-quote-argument this))))))
(setq fn (shell-quote-argument fn))
(cmd (concat fn " " args)))
(filesets-cmd-show-result
cmd (shell-command-to-string cmd))))
Coming this far I looked a bit more carefully at filesets-run-cmd. And I
do not understand what it is doing. The code below is from this
function. I have however replaced the name of the loop variable from
"this" to "file". Further down in the function neither "file" or
"buffer" is used. Seems strange to me. Can someone explain what the code
does or what it was supposed to do? :
(dolist (file files nil)
(save-excursion
(save-restriction
(let ((buffer (filesets-find-file file)))
(when buffer
(goto-char (point-min))
BTW the optional argument in (defun filesets-run-cmd--repl-fn (arg
&optional format-fn) should not be optional I think. Leaving it out will
result in (funcall nil ...).
Index: filesets.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/filesets.el,v
retrieving revision 1.29
diff -c -r1.29 filesets.el
*** filesets.el 13 Aug 2006 17:05:12 -0000 1.29
--- filesets.el 6 Oct 2006 13:15:12 -0000
***************
*** 1701,1707 ****
ok)
t)))
(when ok
! (let ((cmd (format txt (buffer-file-name))))
(message "Filesets: %s" cmd)
(filesets-cmd-show-result cmd
(shell-command-to-string cmd))))))
--- 1701,1707 ----
ok)
t)))
(when ok
! (let ((cmd (format txt (shell-quote-argument (buffer-file-name)))))
(message "Filesets: %s" cmd)
(filesets-cmd-show-result cmd
(shell-command-to-string cmd))))))
--
address@hidden
http://OurComments.org/blog/
- Re: shell-command - missing shell-quote-argument for program?, (continued)
- Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/07
- Re: shell-command - missing shell-quote-argument for program?, Andreas Schwab, 2006/10/08
- Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/08
- Re: shell-command - missing shell-quote-argument for program?, Andreas Schwab, 2006/10/08
- Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/09
- Re: shell-command - missing shell-quote-argument for program?, Kim F. Storm, 2006/10/09
Re: shell-command - missing shell-quote-argument for program?, Kim F. Storm, 2006/10/06
Re: shell-command - missing shell-quote-argument for program?, Lennart Borgman, 2006/10/06
Re: shell-command - missing shell-quote-argument for program?, Thomas Link, 2006/10/13
Re: shell-command - missing shell-quote-argument for program?, Lennart Borgman, 2006/10/13
Re: [Bulk] Re: shell-command - missing shell-quote-argument for program?, Thomas Link, 2006/10/14
Re: shell-command - missing shell-quote-argument for program?, Richard Stallman, 2006/10/14
Re: shell-command - missing shell-quote-argument for program?, Eli Zaretskii, 2006/10/14
Message not available