Gnus development mailing list
 help / color / mirror / Atom feed
* add a gnus-summary-pipe-output-default-command variable
@ 2008-06-29 18:42 jidanni
  2008-06-30  0:35 ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: jidanni @ 2008-06-29 18:42 UTC (permalink / raw)
  To: ding

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



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-06-29 18:42 add a gnus-summary-pipe-output-default-command variable jidanni
@ 2008-06-30  0:35 ` Katsumi Yamaoka
  2008-07-01 16:01   ` jidanni
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2008-06-30  0:35 UTC (permalink / raw)
  To: ding

[-- 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

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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-06-30  0:35 ` Katsumi Yamaoka
@ 2008-07-01 16:01   ` jidanni
  2008-07-02 11:47     ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: jidanni @ 2008-07-01 16:01 UTC (permalink / raw)
  To: ding

I see. Also please document gnus-last-shell-command in Info, for users
who just want a first default if there is none yet. Thanks.



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-07-01 16:01   ` jidanni
@ 2008-07-02 11:47     ` Katsumi Yamaoka
  2008-07-09 18:26       ` David Engster
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2008-07-02 11:47 UTC (permalink / raw)
  To: ding

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

> I see. Also please document gnus-last-shell-command in Info, for users
> who just want a first default if there is none yet. Thanks.

I considered using of `gnus-last-shell-command' for setting the
default (or the initial) command by a user, but reached the
conclusion that it is better to provide options individually for
the features (as you suggested).  Currently those are pipe and
muttprint.  So, `gnus-last-shell-command' is still an internal
variable and I think it is not worth being mentioned in Info.
Now you can use `gnus-summary-pipe-output-default-command' for
`gnus-summary-pipe-output' (and `gnus-summary-save-in-pipe') as
well as `gnus-summary-muttprint-program' for
`gnus-summary-pipe-to-muttprint'.

BTW, I've fixed some bugs in relation to the saving articles
features:

1. The functions set to `gnus-default-article-saver' can't be
   controlled by the `:headers' property.
   cf. (info "(gnus)Saving Articles")

2. The 2nd argument HEADERS passed to `gnus-summary-pipe-output'
   is not effective.

3. `gnus-summary-pipe-output' and `gnus-summary-save-in-pipe'
   always pass decoded articles to the pipe.

The last one might not be a bug but I believe there must be
demand of piping raw articles to a shell command.  The default
behavior is unchanged.

Regards,



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-07-02 11:47     ` Katsumi Yamaoka
@ 2008-07-09 18:26       ` David Engster
  2008-07-10  8:56         ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: David Engster @ 2008-07-09 18:26 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:
> BTW, I've fixed some bugs in relation to the saving articles
> features:

The command `gnus-summary-save-in-pipe' does not work for me
anymore. This is due to the change from `gnus-article-buffer' to
`gnus-save-article-buffer' in l.3965 in gnus-art.el. For example, if I
do something like

(gnus-summary-save-in-pipe "bogofilter -v -n")

in the summary buffer, I get an error because gnus-save-article-buffer
is nil:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  get-buffer(nil)
  get-buffer-window-list(nil nil visible)
  gnus-get-buffer-window(nil visible)
  (let* ((GnusStartBufferWindow ...) (buf gnus-save-article-buffer) (w ...)) (unwind-protect (progn ... ...) (select-window GnusStartBufferWindow)))
  (gnus-eval-in-buffer-window gnus-save-article-buffer (save-restriction (widen) (shell-command-on-region ... ... command nil)))
  gnus-summary-save-in-pipe("bogofilter -vvv -n")

-David



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-07-09 18:26       ` David Engster
@ 2008-07-10  8:56         ` Katsumi Yamaoka
  2008-07-10 23:59           ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2008-07-10  8:56 UTC (permalink / raw)
  To: ding

>>>>> David Engster wrote:
> The command `gnus-summary-save-in-pipe' does not work for me
> anymore. This is due to the change from `gnus-article-buffer' to
> `gnus-save-article-buffer' in l.3965 in gnus-art.el. For example, if I
> do something like

> (gnus-summary-save-in-pipe "bogofilter -v -n")

> in the summary buffer, I get an error because gnus-save-article-buffer
> is nil:

I forgot to try running `g-s-save-in-pipe' independently, sorry.
The cause is that I changed the buffer `gnus-article-buffer' to
`gnus-save-article-buffer' (in which there are article contents)
so that a raw article may also be piped.  I'll fix it soon.



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-07-10  8:56         ` Katsumi Yamaoka
@ 2008-07-10 23:59           ` Katsumi Yamaoka
  2008-07-11  7:45             ` David Engster
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2008-07-10 23:59 UTC (permalink / raw)
  To: ding

>>>>> Katsumi Yamaoka wrote:
>>>>>> David Engster wrote:
>> The command `gnus-summary-save-in-pipe' does not work for me
>> anymore. This is due to the change from `gnus-article-buffer' to
>> `gnus-save-article-buffer' in l.3965 in gnus-art.el. For example, if I
>> do something like

>> (gnus-summary-save-in-pipe "bogofilter -v -n")

>> in the summary buffer, I get an error because gnus-save-article-buffer
>> is nil:

> I forgot to try running `g-s-save-in-pipe' independently, sorry.
> The cause is that I changed the buffer `gnus-article-buffer' to
> `gnus-save-article-buffer' (in which there are article contents)
> so that a raw article may also be piped.  I'll fix it soon.

Fixed in the Gnus CVS trunk.  Please test.



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

* Re: add a gnus-summary-pipe-output-default-command variable
  2008-07-10 23:59           ` Katsumi Yamaoka
@ 2008-07-11  7:45             ` David Engster
  0 siblings, 0 replies; 8+ messages in thread
From: David Engster @ 2008-07-11  7:45 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> I forgot to try running `g-s-save-in-pipe' independently, sorry.
>> The cause is that I changed the buffer `gnus-article-buffer' to
>> `gnus-save-article-buffer' (in which there are article contents)
>> so that a raw article may also be piped.  I'll fix it soon.
>
> Fixed in the Gnus CVS trunk.  Please test.

Works for me. Thanks!

-David



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

end of thread, other threads:[~2008-07-11  7:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-29 18:42 add a gnus-summary-pipe-output-default-command variable jidanni
2008-06-30  0:35 ` Katsumi Yamaoka
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

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