unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Fix fortune's handling of arguments
@ 2008-09-11  4:58 mail
  2008-09-11 12:08 ` John Paul Wallington
  2008-09-20 20:55 ` Glenn Morris
  0 siblings, 2 replies; 4+ messages in thread
From: mail @ 2008-09-11  4:58 UTC (permalink / raw)
  To: emacs-devel

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)
============================================================





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

* Re: [PATCH] Fix fortune's handling of arguments
  2008-09-11  4:58 [PATCH] Fix fortune's handling of arguments mail
@ 2008-09-11 12:08 ` John Paul Wallington
  2008-09-11 16:36   ` mail
  2008-09-20 20:55 ` Glenn Morris
  1 sibling, 1 reply; 4+ messages in thread
From: John Paul Wallington @ 2008-09-11 12:08 UTC (permalink / raw)
  To: mail; +Cc: emacs-devel

mail@justinbogner.com writes:

> -      (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))))

Here's a nitpick: the above change should still use `fort-file' instead
of using `fortune-file', right?




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

* Re: [PATCH] Fix fortune's handling of arguments
  2008-09-11 12:08 ` John Paul Wallington
@ 2008-09-11 16:36   ` mail
  0 siblings, 0 replies; 4+ messages in thread
From: mail @ 2008-09-11 16:36 UTC (permalink / raw)
  To: emacs-devel

jpw@pobox.com (John Paul Wallington) writes:

> mail@justinbogner.com writes:
>
>> -      (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))))
>
> Here's a nitpick: the above change should still use `fort-file' instead
> of using `fortune-file', right?
>

Yes, it definitely needs to be fort-file.  Thanks.





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

* Re: [PATCH] Fix fortune's handling of arguments
  2008-09-11  4:58 [PATCH] Fix fortune's handling of arguments mail
  2008-09-11 12:08 ` John Paul Wallington
@ 2008-09-20 20:55 ` Glenn Morris
  1 sibling, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2008-09-20 20:55 UTC (permalink / raw)
  To: mail; +Cc: emacs-devel

Thanks; applied.




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

end of thread, other threads:[~2008-09-20 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-11  4:58 [PATCH] Fix fortune's handling of arguments mail
2008-09-11 12:08 ` John Paul Wallington
2008-09-11 16:36   ` mail
2008-09-20 20:55 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).