Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: add a gnus-summary-pipe-output-default-command variable
Date: Mon, 30 Jun 2008 09:35:20 +0900	[thread overview]
Message-ID: <b4mfxqvbvzr.fsf@jpl.org> (raw)
In-Reply-To: <877ic8krpo.fsf@jidanni.org>

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

>>>>> jidanni@jidanni.org wrote:

> gnus-summary-pipe-output needs a
> gnus-summary-pipe-output-default-command variable, for users who find
> themselves mostly piping to the same command. It should be prompted as
> (Default: blabla) in the minibuffer, so one could just hit RET if OK.

> (P.S., currently if one does a second pipe, but first removes (DEL
> DEL...) the first command replay that one it prompted with, it indeed
> still does that same first command again. Kind of scary.)

Currently the default command that appears in the minibuffer is
the value held by the internal varable `gnus-last-shell-command'
when you invoked the `gnus-summary-pipe-output' command or the
`gnus-summary-muttprint' command previously.  There is the
`gnus-summary-muttprint-program' variable as a user option that
specifies the default command used by `gnus-summary-muttprint',
however it might be unfair that there is no such option for
`gnus-summary-pipe-output'.  Moreover, the command "muttprint"
will be suggested as the default command even if you invoke
`gnus-summary-pipe-output' if you've used `gnus-summary-muttprint'
previously.

The attached patch does:

1. Introduce `gnus-summary-pipe-output-default-command' which
   overrides `gnus-last-shell-command' if it is non-nil.
2. Make `gnus-summary-muttprint' not modify
   `gnus-last-shell-command'.  `gnus-summary-muttprint-program'
   itself holds the modified value.

A non-nil value of `gnus-summary-pipe-output-default-command'
always overrides `gnus-last-shell-command'.  So, my worry is that
one might forget having set it.  WDYT?  I'll commit the changes
if no one comments.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1618 bytes --]

--- gnus-art.el~	2008-06-11 21:40:58 +0000
+++ gnus-art.el	2008-06-30 00:33:21 +0000
@@ -3968,7 +3968,9 @@
   (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.
 
--- gnus-sum.el~	2008-06-15 21:39:57 +0000
+++ gnus-sum.el	2008-06-30 00:33:21 +0000
@@ -1242,6 +1242,13 @@
   :group 'gnus-summary
   :type '(choice boolean regexp))
 
+(defcustom gnus-summary-pipe-output-default-command nil
+  "Command (and optional arguments) used by `gnus-summary-pipe-output'.
+The value will be used as the default command if it is non-nil."
+  :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."
   :version "22.1"
@@ -11612,7 +11619,9 @@
   (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-save-all-headers (or headers gnus-save-all-headers))
+	(gnus-last-shell-command (or gnus-summary-pipe-output-default-command
+				     gnus-last-shell-command)))
     (gnus-summary-save-article arg t))
   (let ((buffer (get-buffer "*Shell Command Output*")))
     (when (and buffer

  reply	other threads:[~2008-06-30  0:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-29 18:42 jidanni
2008-06-30  0:35 ` Katsumi Yamaoka [this message]
2008-07-01 16:01   ` jidanni
2008-07-02 11:47     ` Katsumi Yamaoka
2008-07-09 18:26       ` David Engster
2008-07-10  8:56         ` Katsumi Yamaoka
2008-07-10 23:59           ` Katsumi Yamaoka
2008-07-11  7:45             ` David Engster

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

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

  git send-email \
    --in-reply-to=b4mfxqvbvzr.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).