Gnus development mailing list
 help / color / mirror / Atom feed
* Extending `gnus-confirm-mail-reply-to-news'?
@ 2003-01-12 14:11 Raymond Scholz
  2003-01-12 14:18 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Raymond Scholz @ 2003-01-12 14:11 UTC (permalink / raw)


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

Hi!

I've been using this for some weeks now.  If it sounds useful, I'll
write some documentation for gnus.texi too :-)

The patch extends `gnus-confirm-mail-reply-to-news' so that it can be
a regexp or a function too.

Furthermore it introduces a new variable
`gnus-confirm-treat-mail-like-news' which makes Gnus ask for
confirmation if the original article is a mail.


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

Index: gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 6.112
diff -u -r6.112 gnus-msg.el
--- gnus-msg.el	2003/01/12 02:55:46	6.112
+++ gnus-msg.el	2003/01/12 14:00:24
@@ -256,8 +256,23 @@
 (defcustom gnus-confirm-mail-reply-to-news nil
   "If non-nil, Gnus requests confirmation when replying to news.
 This is done because new users often reply by mistake when reading
-news."
+news.
+This can also be a function which should return non-nil iff a
+confirmation is needed, or a regexp, in which case a confirmation is
+asked if the group name matches the regexp."
   :group 'gnus-message
+  :type '(choice (const :tag "No" nil)
+		 (const :tag "Yes" nil)
+		 (regexp :tag "Iff group matches regexp")
+		 (function :tag "Iff function evaluates to non-nil")))
+
+(defcustom gnus-confirm-treat-mail-like-news
+  nil
+  "If non-nil, Gnus will treat mail like news with regard to confirmation
+when replying by mail.  See the `gnus-confirm-mail-reply-to-news' variable
+for fine-tuning this.
+If nil, Gnus will never ask for confirmation if replying to mail."
+  :group 'gnus-message
   :type 'boolean)
 
 (defcustom gnus-summary-resend-default-address t
@@ -1038,9 +1053,15 @@
    (list (and current-prefix-arg
 	      (gnus-summary-work-articles 1))))
   ;; Allow user to require confirmation before replying by mail to the
-  ;; author of a news article.
-  (when (or (not (gnus-news-group-p gnus-newsgroup-name))
-	    (not gnus-confirm-mail-reply-to-news)
+  ;; author of a news article (or mail message).
+  (when (or 
+	    (not (or (gnus-news-group-p gnus-newsgroup-name)
+		     gnus-confirm-treat-mail-like-news))
+	    (not (cond ((stringp gnus-confirm-mail-reply-to-news)
+			(string-match gnus-confirm-mail-reply-to-news gnus-newsgroup-name))
+		       ((functionp gnus-confirm-mail-reply-to-news)
+			(funcall gnus-confirm-mail-reply-to-news))
+		       (t gnus-confirm-mail-reply-to-news)))
 	    (y-or-n-p "Really reply by mail to article author? "))
     (let* ((article
 	    (if (listp (car yank))

[-- Attachment #3: Type: text/plain, Size: 925 bytes --]


Usage:

;; Patric Mueller in <7iq1t9.m63.ln@bhaak.xodox.com>
;; made this it work for nnvirtual too
(defun rs-gnus-confirm-mail-reply-to-news ()
  (or
   (gnus-news-group-p
    (if (gnus-virtual-group-p gnus-newsgroup-name)
	(car (nnvirtual-map-article (cdr gnus-article-current)))
      gnus-newsgroup-name))
   (string-match "^nn.+:list\\." gnus-newsgroup-name)))

(setq gnus-confirm-mail-reply-to-news 'rs-gnus-confirm-mail-reply-to-news)
;(setq gnus-confirm-mail-reply-to-news "list\\.")
;(setq gnus-confirm-mail-reply-to-news t)

;; even ask for confirmation if the original article is a mail
;; article (treat mailing lists like news etc.)
(setq gnus-confirm-treat-mail-like-news t)

Cheers, Ray
-- 
The only agents that insert X-Priority: high headers are 1) Outlook and
2) spammers.  So X-Priority is a pretty reliable header to use to filter
out spam and other annoyances.       (Lars M. Ingebrigtsen in gnus.ding)

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

* Re: Extending `gnus-confirm-mail-reply-to-news'?
  2003-01-12 14:11 Extending `gnus-confirm-mail-reply-to-news'? Raymond Scholz
@ 2003-01-12 14:18 ` Lars Magne Ingebrigtsen
  2003-01-12 15:37   ` Raymond Scholz
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-12 14:18 UTC (permalink / raw)


Raymond Scholz <ray-2003@zonix.de> writes:

> I've been using this for some weeks now.  If it sounds useful, I'll
> write some documentation for gnus.texi too :-)
>
> The patch extends `gnus-confirm-mail-reply-to-news' so that it can be
> a regexp or a function too.

Sounds useful to me, so I've applied the patch.  Could you send me a
ChangeLog entry (as well as the documentation)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: Extending `gnus-confirm-mail-reply-to-news'?
  2003-01-12 14:18 ` Lars Magne Ingebrigtsen
@ 2003-01-12 15:37   ` Raymond Scholz
  2003-01-12 19:53     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Raymond Scholz @ 2003-01-12 15:37 UTC (permalink / raw)


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

* Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:

> Sounds useful to me, so I've applied the patch.  Could you send me a
> ChangeLog entry (as well as the documentation)?

Here it is with some typos fixed in gnus-msg.el as well.  And if
`gnus-confirm-mail-reply-to-news' is defined as a function, the group
name is passed as an argument now.

2003-01-12  Raymond Scholz  <ray-2003@zonix.de>

	* gnus-msg.el (gnus-confirm-mail-reply-to-news):  May be a
	regexp or a function too.
	(gnus-confirm-treat-mail-like-news): New variable.  Ask for
	confirmation even if the original article is mail.

Cheers, Ray
-- 
Ich bin ein Fenster-Wechsel-Fetischist.
                              (Kai Großjohann)

[-- Attachment #2: patch.01 --]
[-- Type: application/octet-stream, Size: 2632 bytes --]

Index: lisp/gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 6.113
diff -u -r6.113 gnus-msg.el
--- lisp/gnus-msg.el	2003/01/12 14:37:20	6.113
+++ lisp/gnus-msg.el	2003/01/12 15:36:30
@@ -257,12 +257,13 @@
   "If non-nil, Gnus requests confirmation when replying to news.
 This is done because new users often reply by mistake when reading
 news.
-This can also be a function which should return non-nil iff a
-confirmation is needed, or a regexp, in which case a confirmation is
-asked if the group name matches the regexp."
+This can also be a function receiving the group name as the only
+parameter which should return non-nil iff a confirmation is needed, or
+a regexp, in which case a confirmation is asked for iff the group name
+matches the regexp."
   :group 'gnus-message
   :type '(choice (const :tag "No" nil)
-		 (const :tag "Yes" nil)
+		 (const :tag "Yes" t)
 		 (regexp :tag "Iff group matches regexp")
 		 (function :tag "Iff function evaluates to non-nil")))
 
@@ -1060,7 +1061,7 @@
 	    (not (cond ((stringp gnus-confirm-mail-reply-to-news)
 			(string-match gnus-confirm-mail-reply-to-news gnus-newsgroup-name))
 		       ((functionp gnus-confirm-mail-reply-to-news)
-			(funcall gnus-confirm-mail-reply-to-news))
+			(funcall gnus-confirm-mail-reply-to-news gnus-newsgroup-name))
 		       (t gnus-confirm-mail-reply-to-news)))
 	    (y-or-n-p "Really reply by mail to article author? "))
     (let* ((article
Index: texi/gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 6.381
diff -u -r6.381 gnus.texi
--- texi/gnus.texi	2003/01/12 14:37:33	6.381
+++ texi/gnus.texi	2003/01/12 15:38:11
@@ -10997,8 +10997,19 @@
 @item gnus-confirm-mail-reply-to-news
 @vindex gnus-confirm-mail-reply-to-news
 If non-@code{nil}, Gnus requests confirmation when replying to news.
+This can also be a function receiving the group name as the only
+parameter which should return non-@code{nil} if a confirmation is
+needed, or a regular expression matching group names, where
+confirmation is should be asked for.
+
 If you find yourself never wanting to reply to mail, but occasionally
 press R anyway, this variable might be for you.
+
+@item gnus-confirm-treat-mail-like-news
+@vindex gnus-confirm-treat-mail-like-news
+If non-@code{nil}, Gnus also requests confirmation according to
+@code{gnus-confirm-mail-reply-to-news} when replying to mail.  This is
+useful for treating mailing lists like newsgroups.
 
 @end table
 

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

* Re: Extending `gnus-confirm-mail-reply-to-news'?
  2003-01-12 15:37   ` Raymond Scholz
@ 2003-01-12 19:53     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-12 19:53 UTC (permalink / raw)


Raymond Scholz <ray-2003@zonix.de> writes:

> Here it is with some typos fixed in gnus-msg.el as well.  And if
> `gnus-confirm-mail-reply-to-news' is defined as a function, the group
> name is passed as an argument now.

Thanks for the patch; I've applied it to Oort Gnus v0.12 (i. e., CVS).

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

end of thread, other threads:[~2003-01-12 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-12 14:11 Extending `gnus-confirm-mail-reply-to-news'? Raymond Scholz
2003-01-12 14:18 ` Lars Magne Ingebrigtsen
2003-01-12 15:37   ` Raymond Scholz
2003-01-12 19:53     ` Lars Magne Ingebrigtsen

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