unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: mail@justinbogner.com
To: emacs-devel@gnu.org
Subject: [PATCH] Fix fortune's handling of arguments
Date: Wed, 10 Sep 2008 22:58:01 -0600	[thread overview]
Message-ID: <87zlmfcm92.fsf@justinbogner.com> (raw)

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	other threads:[~2008-09-11  4:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11  4:58 mail [this message]
2008-09-11 12:08 ` [PATCH] Fix fortune's handling of arguments John Paul Wallington
2008-09-11 16:36   ` mail
2008-09-20 20:55 ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zlmfcm92.fsf@justinbogner.com \
    --to=mail@justinbogner.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).