[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using `call-process-shell-command' in `process-lines'
From: |
Juanma Barranquero |
Subject: |
Using `call-process-shell-command' in `process-lines' |
Date: |
Mon, 26 Nov 2007 15:11:48 +0100 |
Does anyone see a problem with this change, and specifically in
non-Windows environments?
The goal is to make `process-lines' (and so, `authors' and
`check-declare-directory') to be more Windows-friendly; frienldy as in
"now it works", I mean :).
Juanma
2007-11-26 Juanma Barranquero <address@hidden>
* subr.el (process-lines): Execute args as a shell command,
not as a program.
* emacs-lisp/authors.el (authors): Don't hardcode `find'.
Use `shell-quote-argument'.
* emacs-lisp/check-declare.el (check-declare-directory):
Don't hardcode `find' and `grep'. `Use shell-quote-argument'.
Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.571
diff -u -2 -r1.571 subr.el
--- lisp/subr.el 22 Nov 2007 20:14:12 -0000 1.571
+++ lisp/subr.el 26 Nov 2007 12:16:25 -0000
@@ -1541,11 +1541,11 @@
;;;; Process stuff.
-(defun process-lines (program &rest args)
- "Execute PROGRAM with ARGS, returning its output as a list of lines.
-Signal an error if the program returns with a non-zero exit status."
+(defun process-lines (command &rest args)
+ "Execute shell COMMAND with ARGS, returning its output as a list of lines.
+Signal an error if the command returns with a non-zero exit status."
(with-temp-buffer
- (let ((status (apply 'call-process program nil (current-buffer) nil args)))
+ (let ((status (apply 'call-process-shell-command command nil
(current-buffer) nil args)))
(unless (eq status 0)
- (error "%s exited with status %s" program status))
+ (error "%s exited with status %s" command status))
(goto-char (point-min))
(let (lines)
Index: lisp/emacs-lisp/authors.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/authors.el,v
retrieving revision 1.47
diff -u -2 -r1.47 authors.el
--- lisp/emacs-lisp/authors.el 17 Nov 2007 03:43:54 -0000 1.47
+++ lisp/emacs-lisp/authors.el 26 Nov 2007 12:46:30 -0000
@@ -588,5 +588,6 @@
(interactive "DEmacs source directory: ")
(setq root (expand-file-name root))
- (let ((logs (process-lines "find" root "-name" "ChangeLog*"))
+ (let ((logs (process-lines find-program root
+ "-name" (shell-quote-argument "ChangeLog*")))
(table (make-hash-table :test 'equal))
(buffer-name "*Authors*")
@@ -600,5 +601,6 @@
(message "Scanning %s..." log)
(authors-scan-change-log log table)))
- (let ((els (process-lines "find" root "-name" "*.el")))
+ (let ((els (process-lines find-program root
+ "-name" (shell-quote-argument "*.el"))))
(dolist (file els)
(message "Scanning %s..." file)
Index: lisp/emacs-lisp/check-declare.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/check-declare.el,v
retrieving revision 1.9
diff -u -2 -r1.9 check-declare.el
--- lisp/emacs-lisp/check-declare.el 24 Nov 2007 03:11:14 -0000 1.9
+++ lisp/emacs-lisp/check-declare.el 26 Nov 2007 12:36:27 -0000
@@ -245,7 +245,8 @@
(message "%s" m)
(message "%s" m2)
- (setq files (process-lines "find" root "-name" "*.el"
- "-exec" "grep" "-l"
- "^[ ]*(declare-function" "{}" ";"))
+ (setq files (process-lines find-program root
+ "-name" (shell-quote-argument "*.el")
+ "-exec" grep-program "-l"
+ (shell-quote-argument "^[\t
]*(declare-function") "{}" ";"))
(message "%s%d found" m2 (length files))
(when files
- Using `call-process-shell-command' in `process-lines',
Juanma Barranquero <=
- Re: Using `call-process-shell-command' in `process-lines', Stefan Monnier, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Juanma Barranquero, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Stefan Monnier, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Juanma Barranquero, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Lennart Borgman (gmail), 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Juanma Barranquero, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Lennart Borgman (gmail), 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Eli Zaretskii, 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Lennart Borgman (gmail), 2007/11/26
- Re: Using `call-process-shell-command' in `process-lines', Eli Zaretskii, 2007/11/26