emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix fortune's handling of arguments


From: mail
Subject: [PATCH] Fix fortune's handling of arguments
Date: Wed, 10 Sep 2008 22:58:01 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

On the current CVS, since before August 7th, the custom
fortune-program-options doesn't behave properly. To reproduce, assuming
you have some fortune cookies in /usr/share/games/fortunes/:

emacs -Q
(set-variable 'fortune-file "/usr/share/games/fortunes/")
(set-variable 'fortune-program-options "-s")
(fortune)

Using the string "-s " instead of "-s" has the same result.

The following patch fixes this by changing the type of
fortune-program-options to a list of strings so that call-process can be
called properly. Using this patch one sets the variable more like:

(set-variable 'fortune-program-options '("-s"))

--
Shut off engine before fueling.

===File ~/src/emacs/fortune-args.patch======================
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index 5e25eba..b008443 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -87,9 +87,9 @@ Normally you won't have a reason to change it."
   "Program to select a fortune cookie."
   :type 'string
   :group 'fortune)
-(defcustom fortune-program-options ""
-  "Options to pass to the fortune program (a string)."
-  :type 'string
+(defcustom fortune-program-options ()
+  "Options to pass to the fortune program."
+  :type '(repeat string)
   :group 'fortune)
 (defcustom fortune-strfile "strfile"
   "Program to compute a new fortune database."
@@ -299,11 +299,10 @@ when supplied, specifies the file to choose the fortune 
from."
       (if fortune-always-compile
          (fortune-compile fort-file))

-      (call-process
-        fortune-program  ;; programm to call
-       nil fortune-buffer nil ;; INFILE BUFFER DISPLAYP
-       (concat fortune-program-options fort-file)))))
-
+      (apply 'call-process
+             fortune-program  ;; program to call
+             nil fortune-buffer nil ;; INFILE BUFFER DISPLAYP
+             fortune-file fortune-program-options))))

 ;;;###autoload
 (defun fortune (&optional file)
============================================================





reply via email to

[Prev in Thread] Current Thread [Next in Thread]