changeset 96498:1f27a4bf06f5

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1309
author Miles Bader <miles@gnu.org>
date Fri, 04 Jul 2008 00:07:47 +0000
parents 885e5368ecb2
children 8d861946c080
files doc/misc/gnus.texi lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/gnus-score.el lisp/gnus/gnus-sum.el
diffstat 5 files changed, 94 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/doc/misc/gnus.texi	Thu Jul 03 15:18:32 2008 +0000
+++ b/doc/misc/gnus.texi	Fri Jul 04 00:07:47 2008 +0000
@@ -8514,10 +8514,13 @@
 @kindex O p (Summary)
 @kindex | (Summary)
 @findex gnus-summary-pipe-output
+@vindex gnus-summary-pipe-output-default-command
 Save the current article in a pipe.  Uhm, like, what I mean is---Pipe
 the current article to a process (@code{gnus-summary-pipe-output}).
 If given a symbolic prefix (@pxref{Symbolic Prefixes}), include the
-complete headers in the piped output.
+complete headers in the piped output.  The
+@code{gnus-summary-pipe-output-default-command} variable can be set to a
+string containing the default command and options (default @code{nil}).
 
 @item O P
 @kindex O P (Summary)
@@ -8613,6 +8616,17 @@
 @findex gnus-summary-save-in-vm
 Save the article in a VM folder.  You have to have the VM mail
 reader to use this setting.
+
+@item gnus-summary-save-in-pipe
+@findex gnus-summary-save-in-pipe
+Pipe the article to a shell command.  This function takes optional one
+argument; if it is a string, it is used as the command; if it is
+@code{nil} or omitted, you will be prompted for the command; if it is
+the symbol @code{default}, the command which the
+@code{gnus-summary-pipe-output-default-command} variable holds or the
+command last used for saving will be used if it is non-@code{nil}.  The
+command should be a string that the shell can interpret (e.g. the
+executable command name and the arguments).
 @end table
 
 The symbol of each function may have the following properties:
@@ -8622,8 +8636,9 @@
 The value non-@code{nil} means save decoded articles.  This is
 meaningful only with @code{gnus-summary-save-in-file},
 @code{gnus-summary-save-body-in-file},
-@code{gnus-summary-write-to-file}, and
-@code{gnus-summary-write-body-to-file}.
+@code{gnus-summary-write-to-file},
+@code{gnus-summary-write-body-to-file}, and
+@code{gnus-summary-save-in-pipe}.
 
 @item :function
 The value specifies an alternative function which appends, not
--- a/lisp/gnus/ChangeLog	Thu Jul 03 15:18:32 2008 +0000
+++ b/lisp/gnus/ChangeLog	Fri Jul 04 00:07:47 2008 +0000
@@ -1,3 +1,22 @@
+2008-07-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-default-article-saver): Add
+	gnus-summary-save-in-pipe to choices.
+	(gnus-summary-save-in-pipe): Add :decode and :headers properties; use
+	gnus-summary-pipe-output-default-command as the default command.
+	(gnus-summary-pipe-to-muttprint): Update gnus-summary-muttprint-program
+	instead of gnus-last-shell-command.
+
+	* gnus-sum.el (gnus-summary-pipe-output-default-command): New user
+	option.
+	(gnus-summary-muttprint-program): Mention the value will be changed.
+	(gnus-summary-save-article): Force showing of all headers.
+	(gnus-summary-pipe-output): Work with the 2nd argument HEADERS.
+
+2008-07-01  Rupert Swarbrick  <rswarbrick@googlemail.com>  (tiny change)
+
+	* gnus-score.el (gnus-score-find-trace): Add "Total score" line.
+
 2008-07-02  Juanma Barranquero  <lekktu@gmail.com>
 
 	* nnimap.el (nnimap-id):
--- a/lisp/gnus/gnus-art.el	Thu Jul 03 15:18:32 2008 +0000
+++ b/lisp/gnus/gnus-art.el	Fri Jul 04 00:07:47 2008 +0000
@@ -552,13 +552,15 @@
 * gnus-summary-save-in-vm (use VM's folder format)
 * gnus-summary-write-to-file (article format -- overwrite)
 * gnus-summary-write-body-to-file (article body -- overwrite)
+* gnus-summary-save-in-pipe (article format)
 
 The symbol of each function may have the following properties:
 
 * :decode
 The value non-nil means save decoded articles.  This is meaningful
 only with `gnus-summary-save-in-file', `gnus-summary-save-body-in-file',
-`gnus-summary-write-to-file', and `gnus-summary-write-body-to-file'.
+`gnus-summary-write-to-file', `gnus-summary-write-body-to-file', and
+`gnus-summary-save-in-pipe'.
 
 * :function
 The value specifies an alternative function which appends, not
@@ -581,6 +583,7 @@
 		(function-item gnus-summary-save-in-vm)
 		(function-item gnus-summary-write-to-file)
 		(function-item gnus-summary-write-body-to-file)
+		(function-item gnus-summary-save-in-pipe)
 		(function)))
 
 (defcustom gnus-article-save-coding-system
@@ -3936,39 +3939,43 @@
 		  gnus-current-headers nil 'gnus-newsgroup-last-directory))
   (gnus-summary-save-body-in-file filename t))
 
+(put 'gnus-summary-save-in-pipe :decode t)
+(put 'gnus-summary-save-in-pipe :headers 'gnus-saved-headers)
 (defun gnus-summary-save-in-pipe (&optional command)
   "Pipe this article to subprocess."
-  (setq command
-	(cond ((and (eq command 'default)
-		    gnus-last-shell-command)
-	       gnus-last-shell-command)
-	      ((stringp command)
-	       command)
-	      (t (gnus-read-shell-command
-		  (format
-		   "Shell command on %s: "
-		   (if (and gnus-number-of-articles-to-be-saved
-			    (> gnus-number-of-articles-to-be-saved 1))
-		       (format "these %d articles"
-			       gnus-number-of-articles-to-be-saved)
-		     "this article"))
-		  gnus-last-shell-command))))
-  (when (string-equal command "")
-    (if gnus-last-shell-command
-	(setq command gnus-last-shell-command)
-      (error "A command is required")))
-  (gnus-eval-in-buffer-window gnus-article-buffer
+  (let ((default (or gnus-summary-pipe-output-default-command
+		     gnus-last-shell-command)))
+    (unless (stringp command)
+      (setq command
+	    (if (and (eq command 'default) default)
+		default
+	      (gnus-read-shell-command
+	       (format
+		"Shell command on %s: "
+		(if (and gnus-number-of-articles-to-be-saved
+			 (> gnus-number-of-articles-to-be-saved 1))
+		    (format "these %d articles"
+			    gnus-number-of-articles-to-be-saved)
+		  "this article"))
+	       default))))
+    (when (string-equal command "")
+      (if default
+	  (setq command default)
+	(error "A command is required"))))
+  (gnus-eval-in-buffer-window gnus-save-article-buffer
     (save-restriction
       (widen)
       (shell-command-on-region (point-min) (point-max) command nil)))
-  (setq gnus-last-shell-command command))
+  (setq gnus-summary-pipe-output-default-command command))
 
 (defun gnus-summary-pipe-to-muttprint (&optional command)
   "Pipe this article to muttprint."
   (setq command (read-string
 		 "Print using command: " gnus-summary-muttprint-program
 		 nil gnus-summary-muttprint-program))
-  (gnus-summary-save-in-pipe command))
+  (let ((gnus-last-shell-command gnus-last-shell-command))
+    (gnus-summary-save-in-pipe command)
+    (setq gnus-summary-muttprint-program gnus-last-shell-command)))
 
 ;;; Article file names when saving.
 
--- a/lisp/gnus/gnus-score.el	Thu Jul 03 15:18:32 2008 +0000
+++ b/lisp/gnus/gnus-score.el	Fri Jul 04 00:07:47 2008 +0000
@@ -2468,6 +2468,9 @@
 		   (file-name-nondirectory file)
 		   (abbreviate-file-name file))))
 	(insert
+	 (format "\nTotal score: %d"
+		 (apply '+ (mapcar 'caddr trace))))
+	(insert
 	 "\n\nQuick help:
 
 Type `e' to edit score file corresponding to the score rule on current line,
--- a/lisp/gnus/gnus-sum.el	Thu Jul 03 15:18:32 2008 +0000
+++ b/lisp/gnus/gnus-sum.el	Fri Jul 04 00:07:47 2008 +0000
@@ -1242,8 +1242,19 @@
   :group 'gnus-summary
   :type '(choice boolean regexp))
 
+(defcustom gnus-summary-pipe-output-default-command nil
+  "Command (and optional arguments) used to pipe article to subprocess.
+This will be used as the default command if it is non-nil.  The value
+will be updated if you modify it when executing the command
+`gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
+  :version "23.1" ;; No Gnus
+  :group 'gnus-summary
+  :type '(radio (const :tag "None" nil) (string :tag "Command")))
+
 (defcustom gnus-summary-muttprint-program "muttprint"
-  "Command (and optional arguments) used to run Muttprint."
+  "Command (and optional arguments) used to run Muttprint.
+The value will be updated if you modify it when executing the command
+`gnus-summary-muttprint'."
   :version "22.1"
   :group 'gnus-summary
   :type 'string)
@@ -11583,7 +11594,7 @@
 					      gnus-display-mime-function))
 		(gnus-article-prepare-hook (when decode
 					     gnus-article-prepare-hook)))
-	    (gnus-summary-select-article t nil nil article)
+	    (gnus-summary-select-article t t nil article)
 	    (gnus-summary-goto-subject article)))
 	(with-current-buffer save-buffer
 	  (erase-buffer)
@@ -11608,12 +11619,19 @@
 If N is a negative number, pipe the N previous articles.
 If N is nil and any articles have been marked with the process mark,
 pipe those articles instead.
-If HEADERS (the symbolic prefix), include the headers, too."
+If HEADERS (the symbolic prefix) is given, force including all headers."
   (interactive (gnus-interactive "P\ny"))
   (require 'gnus-art)
-  (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
-	(gnus-save-all-headers (or headers gnus-save-all-headers)))
-    (gnus-summary-save-article arg t))
+  (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
+    (if headers
+	(let ((gnus-save-all-headers t)
+	      (headers (get gnus-default-article-saver :headers)))
+	  (unwind-protect
+	      (progn
+		(put gnus-default-article-saver :headers nil)
+		(gnus-summary-save-article arg t))
+	    (put gnus-default-article-saver :headers headers)))
+      (gnus-summary-save-article arg t)))
   (let ((buffer (get-buffer "*Shell Command Output*")))
     (when (and buffer
 	       (not (zerop (buffer-size buffer))))