Changes committed gnus/lisp (ChangeLog gnus-art.el gnus-sum.el)

"Katsumi Yamaoka" <[email protected]> Wed, 02 Jul 2008 13:47:36 +0200
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog gnus-art.el gnus-sum.el

* 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.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1884 gnus/lisp/ChangeLog:7.1885
--- ChangeLog:7.1884	Tue Jul  1 22:17:41 2008
+++ ChangeLog	Wed Jul  2 13:47:36 2008
@@ -1,4 +1,19 @@
-2008-07-01  Rupert Swarbrick <[email protected]>  (tiny change)
+2008-07-02  Katsumi Yamaoka  <[email protected]>
+
+	* 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  <[email protected]>  (tiny change)
 
 	* gnus-score.el (gnus-score-find-trace): Add "Total score" line.
 
Index: gnus-art.el
diff -u gnus/lisp/gnus-art.el:7.274 gnus/lisp/gnus-art.el:7.275
--- gnus-art.el:7.274	Wed Jun 11 16:19:44 2008
+++ gnus-art.el	Wed Jul  2 13:47:36 2008
@@ -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.
 
Index: gnus-sum.el
diff -u gnus/lisp/gnus-sum.el:7.229 gnus/lisp/gnus-sum.el:7.230
--- gnus-sum.el:7.229	Sat Jun 14 17:45:03 2008
+++ gnus-sum.el	Wed Jul  2 13:47:36 2008
@@ -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))))