all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using `call-process-shell-command' in `process-lines'
@ 2007-11-26 14:11 Juanma Barranquero
  2007-11-26 15:35 ` Stefan Monnier
  0 siblings, 1 reply; 38+ messages in thread
From: Juanma Barranquero @ 2007-11-26 14:11 UTC (permalink / raw)
  To: Emacs Devel

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  <lekktu@gmail.com>

	* 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

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

end of thread, other threads:[~2007-11-27 22:34 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-26 14:11 Using `call-process-shell-command' in `process-lines' Juanma Barranquero
2007-11-26 15:35 ` Stefan Monnier
2007-11-26 16:01   ` Juanma Barranquero
2007-11-26 16:43     ` Stefan Monnier
2007-11-26 17:01       ` Juanma Barranquero
2007-11-26 17:28         ` Lennart Borgman (gmail)
2007-11-26 17:59           ` Juanma Barranquero
2007-11-26 19:58             ` Lennart Borgman (gmail)
2007-11-26 20:50               ` Eli Zaretskii
2007-11-26 21:25                 ` Lennart Borgman (gmail)
2007-11-26 22:04                   ` Eli Zaretskii
2007-11-26 22:16                     ` Lennart Borgman (gmail)
2007-11-26 22:22                       ` Eli Zaretskii
2007-11-26 22:39                         ` Lennart Borgman (gmail)
2007-11-27  4:08                           ` Eli Zaretskii
2007-11-27 22:34                             ` Lennart Borgman (gmail)
2007-11-26 22:17                     ` Eli Zaretskii
2007-11-26 22:35                       ` Lennart Borgman (gmail)
2007-11-26 20:38           ` Eli Zaretskii
2007-11-26 20:23         ` Eli Zaretskii
2007-11-26 20:30           ` Eli Zaretskii
2007-11-26 20:31           ` Lennart Borgman (gmail)
2007-11-26 20:51             ` Eli Zaretskii
2007-11-26 21:08               ` Lennart Borgman (gmail)
2007-11-26 21:18                 ` Eli Zaretskii
2007-11-26 21:23                   ` Lennart Borgman (gmail)
2007-11-26 21:49                     ` Eli Zaretskii
2007-11-26 22:17                       ` Jason Rumney
2007-11-26 22:29                         ` Eli Zaretskii
2007-11-26 22:30                         ` Jason Rumney
2007-11-27  0:24                           ` Juanma Barranquero
2007-11-26 22:33                         ` Eli Zaretskii
2007-11-26 23:01                           ` Jason Rumney
2007-11-27  4:13                             ` Eli Zaretskii
2007-11-26 20:35           ` Stefan Monnier
2007-11-26 20:59             ` Eli Zaretskii
2007-11-26 21:18               ` Lennart Borgman (gmail)
2007-11-26 16:04   ` Juanma Barranquero

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.