Gnus development mailing list
 help / color / mirror / Atom feed
* patches add variable `gnus-confirm-mail-reply-to-news'
@ 2002-05-21  2:41 Benjamin Rutt
  2002-05-21  9:36 ` Simon Josefsson
  2002-06-09  9:45 ` Thomas Skogestad
  0 siblings, 2 replies; 14+ messages in thread
From: Benjamin Rutt @ 2002-05-21  2:41 UTC (permalink / raw)


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

Attached are two patches against today's CVS.  They implement a
feature that lets a user enable an option which will require
confirmation before allowing a mail reply to a usenet article.  This
will help users catch their mistake when they accidently press 'R' to
respond to a usenet article when they really meant to press 'F'.
(FWIW, these patches are inspired by this month's gnu.emacs.gnus
thread rooted by message id <7w4rhgb773.fsf@i19.ruc.dk>).

The first patch is to gnus-msg.el.  For readers of this patch:  I only
added the lines

  ;; 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)
	    (y-or-n-p "Really reply by mail to article author? "))

to the method `gnus-summary-reply', however adding the 'when' at the
top required that the rest of the function be reindented, so the patch
is a little harder to read than normal because of the reindents.

The second patch is to gnus.texi and is pretty straightforward.

Comments welcome.  If someone would like to commit this, please go
ahead as I've signed papers.  Thanks,
-- 
Benjamin

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

Index: gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 6.88
diff -u -r6.88 gnus-msg.el
--- gnus-msg.el	2002/05/01 22:17:08	6.88
+++ gnus-msg.el	2002/05/21 02:24:52
@@ -239,6 +239,13 @@
   :group 'gnus-message
   :type 'boolean)
 
+(defcustom gnus-confirm-mail-reply-to-news
+  nil
+  "If non-nil, you will be asked to confirm a reply by mail to a
+USENET article."
+  :group 'gnus-message
+  :type 'boolean)
+
 ;;; Internal variables.
 
 (defvar gnus-inhibit-posting-styles nil
@@ -978,51 +985,56 @@
   (interactive
    (list (and current-prefix-arg
 	      (gnus-summary-work-articles 1))))
-  (let* ((article
-	  (if (listp (car yank))
-	      (caar yank)
-	    (car yank)))
-	 (gnus-article-reply (or article (gnus-summary-article-number)))
-	 (headers ""))
-    ;; Stripping headers should be specified with mail-yank-ignored-headers.
-    (when yank
-      (gnus-summary-goto-subject article))
-    (gnus-setup-message (if yank 'reply-yank 'reply)
-      (if (not very-wide)
-	  (gnus-summary-select-article)
-	(dolist (article very-wide)
-	  (gnus-summary-select-article nil nil nil article)
-	  (save-excursion
-	    (set-buffer (gnus-copy-article-buffer))
-	    (gnus-msg-treat-broken-reply-to)
-	    (save-restriction
-	      (message-narrow-to-head)
-	      (setq headers (concat headers (buffer-string)))))))
-      (set-buffer (gnus-copy-article-buffer))
-      (gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to)
-      (save-restriction
-	(message-narrow-to-head)
-	(when very-wide
-	  (erase-buffer)
-	  (insert headers))
-	(goto-char (point-max)))
-      (mml-quote-region (point) (point-max))
-      (message-reply nil wide)
+  ;; 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)
+	    (y-or-n-p "Really reply by mail to article author? "))
+    (let* ((article
+	    (if (listp (car yank))
+		(caar yank)
+	      (car yank)))
+	   (gnus-article-reply (or article (gnus-summary-article-number)))
+	   (headers ""))
+      ;; Stripping headers should be specified with mail-yank-ignored-headers.
       (when yank
-	(gnus-inews-yank-articles yank))
-      (when (or gnus-message-replysign gnus-message-replyencrypt)
-	(let (signed encrypted)
-	  (save-excursion
-	    (set-buffer gnus-article-buffer)
-	    (setq signed (memq 'signed gnus-article-wash-types))
-	    (setq encrypted (memq 'encrypted gnus-article-wash-types)))
-	  (cond ((and gnus-message-replysign signed)
-		 (mml-secure-message mml-default-sign-method 'sign))
-		((and gnus-message-replyencrypt encrypted)
-		 (mml-secure-message mml-default-encrypt-method
-				     (if gnus-message-replysignencrypted
-					 'signencrypt
-				       'encrypt)))))))))
+	(gnus-summary-goto-subject article))
+      (gnus-setup-message (if yank 'reply-yank 'reply)
+	(if (not very-wide)
+	    (gnus-summary-select-article)
+	  (dolist (article very-wide)
+	    (gnus-summary-select-article nil nil nil article)
+	    (save-excursion
+	      (set-buffer (gnus-copy-article-buffer))
+	      (gnus-msg-treat-broken-reply-to)
+	      (save-restriction
+		(message-narrow-to-head)
+		(setq headers (concat headers (buffer-string)))))))
+	(set-buffer (gnus-copy-article-buffer))
+	(gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to)
+	(save-restriction
+	  (message-narrow-to-head)
+	  (when very-wide
+	    (erase-buffer)
+	    (insert headers))
+	  (goto-char (point-max)))
+	(mml-quote-region (point) (point-max))
+	(message-reply nil wide)
+	(when yank
+	  (gnus-inews-yank-articles yank))
+	(when (or gnus-message-replysign gnus-message-replyencrypt)
+	  (let (signed encrypted)
+	    (save-excursion
+	      (set-buffer gnus-article-buffer)
+	      (setq signed (memq 'signed gnus-article-wash-types))
+	      (setq encrypted (memq 'encrypted gnus-article-wash-types)))
+	    (cond ((and gnus-message-replysign signed)
+		   (mml-secure-message mml-default-sign-method 'sign))
+		  ((and gnus-message-replyencrypt encrypted)
+		   (mml-secure-message mml-default-encrypt-method
+				       (if gnus-message-replysignencrypted
+					   'signencrypt
+					 'encrypt))))))))))
 
 (defun gnus-summary-reply-with-original (n &optional wide)
   "Start composing a reply mail to the current message.

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

Index: gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 6.279
diff -u -r6.279 gnus.texi
--- gnus.texi	2002/05/16 15:06:53	6.279
+++ gnus.texi	2002/05/21 02:37:44
@@ -10736,6 +10736,11 @@
 If non-@code{nil}, add a @code{to-list} group parameter to mail groups
 that have none when you do a @kbd{a}.
 
+@item gnus-confirm-mail-reply-to-news
+@vindex gnus-confirm-mail-reply-to-news
+If non-@code{nil}, you will be asked to confirm a reply by mail to a
+USENET article.
+
 @end table
 
 

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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21  2:41 patches add variable `gnus-confirm-mail-reply-to-news' Benjamin Rutt
@ 2002-05-21  9:36 ` Simon Josefsson
  2002-05-21 10:46   ` Kai Großjohann
  2002-06-09  9:45 ` Thomas Skogestad
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Josefsson @ 2002-05-21  9:36 UTC (permalink / raw)
  Cc: ding

On Mon, 20 May 2002, Benjamin Rutt wrote:

> Attached are two patches against today's CVS.  They implement a
> feature that lets a user enable an option which will require
> confirmation before allowing a mail reply to a usenet article.  This
> will help users catch their mistake when they accidently press 'R' to
> respond to a usenet article when they really meant to press 'F'.

This is likely to be annoying.  Can we perhaps use this case to test 
implementing a "Do not ask me again" option?  Bound to ! perhaps?  
Answering ! to the query would customize-save the variable to nil so the 
user won't see the query again.  What do people think?




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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21  9:36 ` Simon Josefsson
@ 2002-05-21 10:46   ` Kai Großjohann
  2002-05-21 12:49     ` Simon Josefsson
  0 siblings, 1 reply; 14+ messages in thread
From: Kai Großjohann @ 2002-05-21 10:46 UTC (permalink / raw)
  Cc: Benjamin Rutt, ding

Simon Josefsson <jas@extundo.com> writes:

> This is likely to be annoying.

Note that the "ask me" option is off by default.  So there is little
potential for annoying.

kai
-- 
Silence is foo!



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21 10:46   ` Kai Großjohann
@ 2002-05-21 12:49     ` Simon Josefsson
  2002-05-21 17:11       ` Benjamin Rutt
  2002-05-22  8:52       ` Russ Allbery
  0 siblings, 2 replies; 14+ messages in thread
From: Simon Josefsson @ 2002-05-21 12:49 UTC (permalink / raw)
  Cc: Benjamin Rutt, ding

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Simon Josefsson <jas@extundo.com> writes:
>
>> This is likely to be annoying.
>
> Note that the "ask me" option is off by default.  So there is little
> potential for annoying.

Oops, I didn't read it carefully.  What about making the default to on
then, and allow the user to never be queried about it in the future
("Don't ask me again")?  People who usually never R to usenet posts
might find the question useful, and leave it enabled, and other people
are only annoyed once.




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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21 12:49     ` Simon Josefsson
@ 2002-05-21 17:11       ` Benjamin Rutt
  2002-05-21 17:19         ` Benjamin Rutt
  2002-05-22  8:52       ` Russ Allbery
  1 sibling, 1 reply; 14+ messages in thread
From: Benjamin Rutt @ 2002-05-21 17:11 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> Oops, I didn't read it carefully.  What about making the default to on
> then, and allow the user to never be queried about it in the future
> ("Don't ask me again")?  People who usually never R to usenet posts
> might find the question useful, and leave it enabled, and other people
> are only annoyed once.

This sounds reasonable.  I'm not exactly sure how to implement this
though.  It reminds me of back when I first used `narrow-to-region'
and it asked me whether I wanted to enable the command permanently.
It doesn't look like I could directly apply novice.el's enable-command
etc. to do this, since there's no command in this case.  (I don't
think we'd want to require confirmation to simply run
gnus-summary-reply).

Maybe the variable `gnus-confirm-mail-reply-to-news' should default to
'ask.  Then, whenever the variable is used, if it has the value 'ask,
then you pose the question "Don't ask me again?" as you suggested.  If
it has the value nil or t, then just use it.

Does anyone know how to use customize to programmatically set a value
and then make it permanent (i.e. save it to the user's `custom-file')?
I think that would be the best approach to take.
-- 
Benjamin



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21 17:11       ` Benjamin Rutt
@ 2002-05-21 17:19         ` Benjamin Rutt
  0 siblings, 0 replies; 14+ messages in thread
From: Benjamin Rutt @ 2002-05-21 17:19 UTC (permalink / raw)


Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:

> Does anyone know how to use customize to programmatically set a
> value and then make it permanent (i.e. save it to the user's
> `custom-file')?

Never mind, I just found `customize-save-variable'.
-- 
Benjamin



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21 12:49     ` Simon Josefsson
  2002-05-21 17:11       ` Benjamin Rutt
@ 2002-05-22  8:52       ` Russ Allbery
  2002-05-22  9:10         ` Simon Josefsson
  1 sibling, 1 reply; 14+ messages in thread
From: Russ Allbery @ 2002-05-22  8:52 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> Oops, I didn't read it carefully.  What about making the default to on
> then, and allow the user to never be queried about it in the future
> ("Don't ask me again")?  People who usually never R to usenet posts
> might find the question useful, and leave it enabled, and other people
> are only annoyed once.

I think setting default behavior that discourages people from taking
things to e-mail from Usenet discussions is a bad idea.  There are
different cultures in different groups, but more often than not this is
something that people are *encouraged* to do unless they're pretty sure
the whole group would be interested.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-22  8:52       ` Russ Allbery
@ 2002-05-22  9:10         ` Simon Josefsson
  2002-05-22 21:44           ` Benjamin Rutt
                             ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Simon Josefsson @ 2002-05-22  9:10 UTC (permalink / raw)
  Cc: ding

Russ Allbery <rra@stanford.edu> writes:

> Simon Josefsson <jas@extundo.com> writes:
>
>> Oops, I didn't read it carefully.  What about making the default to on
>> then, and allow the user to never be queried about it in the future
>> ("Don't ask me again")?  People who usually never R to usenet posts
>> might find the question useful, and leave it enabled, and other people
>> are only annoyed once.
>
> I think setting default behavior that discourages people from taking
> things to e-mail from Usenet discussions is a bad idea.  There are
> different cultures in different groups, but more often than not this is
> something that people are *encouraged* to do unless they're pretty sure
> the whole group would be interested.

I agree. Ok, I added the original patch that defaults to not asking.  Thanks.




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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-22  9:10         ` Simon Josefsson
@ 2002-05-22 21:44           ` Benjamin Rutt
  2002-05-23 21:36           ` Benjamin Rutt
  2002-05-26 16:22           ` Raymond Scholz
  2 siblings, 0 replies; 14+ messages in thread
From: Benjamin Rutt @ 2002-05-22 21:44 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> Russ Allbery <rra@stanford.edu> writes:
>
>> Simon Josefsson <jas@extundo.com> writes:
>>
>>> Oops, I didn't read it carefully.  What about making the default to on
>>> then, and allow the user to never be queried about it in the future
>>> ("Don't ask me again")?  People who usually never R to usenet posts
>>> might find the question useful, and leave it enabled, and other people
>>> are only annoyed once.
>>
>> I think setting default behavior that discourages people from taking
>> things to e-mail from Usenet discussions is a bad idea.  There are
>> different cultures in different groups, but more often than not this is
>> something that people are *encouraged* to do unless they're pretty sure
>> the whole group would be interested.
>
> I agree. Ok, I added the original patch that defaults to not asking.  Thanks.

I agree also, now I can stop working on that y/n/! confirm feature.
:-)  Thanks for adding the patch.
-- 
Benjamin



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-22  9:10         ` Simon Josefsson
  2002-05-22 21:44           ` Benjamin Rutt
@ 2002-05-23 21:36           ` Benjamin Rutt
  2002-05-26 16:22           ` Raymond Scholz
  2 siblings, 0 replies; 14+ messages in thread
From: Benjamin Rutt @ 2002-05-23 21:36 UTC (permalink / raw)


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

Simon Josefsson <jas@extundo.com> writes:

> I agree. Ok, I added the original patch that defaults to not asking.  Thanks.

Slight typo in your changes, the patch below fixes it.
-- 
Benjamin

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

--- gnus-msg.el.~6.89.~	2002-05-23 01:24:09.000000000 -0400
+++ gnus-msg.el	2002-05-23 17:34:07.849461000 -0400
@@ -241,7 +241,7 @@
 
 (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 misstake when reading
+This is done because new users often reply by mistake when reading
 news."
   :group 'gnus-message
   :type 'boolean)

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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-22  9:10         ` Simon Josefsson
  2002-05-22 21:44           ` Benjamin Rutt
  2002-05-23 21:36           ` Benjamin Rutt
@ 2002-05-26 16:22           ` Raymond Scholz
  2002-05-26 19:11             ` Simon Josefsson
  2 siblings, 1 reply; 14+ messages in thread
From: Raymond Scholz @ 2002-05-26 16:22 UTC (permalink / raw)


Simon Josefsson <jas@extundo.com> writes:

> I agree. Ok, I added the original patch that defaults to not asking.  Thanks.

I used to have this in my .gnus for ages:

(setq rs-mailing-lists "list\\.")

;; Patric Mueller in <7iq1t9.m63.ln@bhaak.xodox.com>
;; von mir erweitert um die Abfrage auf Mailinglisten 
(defadvice gnus-summary-reply (around reply-in-news activate)
  (when (or
	 (not (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 rs-mailing-lists gnus-newsgroup-name)))
	 (y-or-n-p "Really, really reply? "))
    ad-do-it))

It adds "support" for virtual groups that contain newsgroups and for
user defined lists (all of my mailing lists) where I usually don't
want to say `R'.

Would it be useful to be added to Gnus or is it too specifically
tailored for my personal needs?

Cheers, Ray
-- 
Sigmentation fault, core dumped.



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-26 16:22           ` Raymond Scholz
@ 2002-05-26 19:11             ` Simon Josefsson
  2002-10-16 15:31               ` Raymond Scholz
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Josefsson @ 2002-05-26 19:11 UTC (permalink / raw)


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

> Simon Josefsson <jas@extundo.com> writes:
>
>> I agree. Ok, I added the original patch that defaults to not asking.  Thanks.
>
> I used to have this in my .gnus for ages:
>
> (setq rs-mailing-lists "list\\.")
>
> ;; Patric Mueller in <7iq1t9.m63.ln@bhaak.xodox.com>
> ;; von mir erweitert um die Abfrage auf Mailinglisten 
> (defadvice gnus-summary-reply (around reply-in-news activate)
>   (when (or
> 	 (not (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 rs-mailing-lists gnus-newsgroup-name)))
> 	 (y-or-n-p "Really, really reply? "))
>     ad-do-it))
>
> It adds "support" for virtual groups that contain newsgroups and for
> user defined lists (all of my mailing lists) where I usually don't
> want to say `R'.
>
> Would it be useful to be added to Gnus or is it too specifically
> tailored for my personal needs?

I didn't test this, but it should add support for setting the variable
to a string or function to get the behaviour you want.  Does it work?

--- gnus-msg.el.~6.90.~	Thu May 23 23:57:20 2002
+++ gnus-msg.el	Sun May 26 21:09:26 2002
@@ -242,9 +242,15 @@
 (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 'boolean)
+  :type '(choice (const :tag "No" nil)
+		 (const :tag "Yes" nil)
+		 (regexp :tag "Iff group matches regexp")
+		 (function :tag "Iff function evaluates to non-nil")))
 
 ;;; Internal variables.
 
@@ -988,7 +994,11 @@
   ;; 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)
+	    (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))




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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-21  2:41 patches add variable `gnus-confirm-mail-reply-to-news' Benjamin Rutt
  2002-05-21  9:36 ` Simon Josefsson
@ 2002-06-09  9:45 ` Thomas Skogestad
  1 sibling, 0 replies; 14+ messages in thread
From: Thomas Skogestad @ 2002-06-09  9:45 UTC (permalink / raw)


* Benjamin Rutt

|   ;; Allow user to require confirmation before replying by mail to the
|   ;; author of a news article.

This comment is incorrect. The correct comment is:

;; Don't _reply_ in news, dimwit!

-- 
http://tiny-tools.sourceforge.net/emacs-elisp.html
http://linuxguiden.linpro.no/pollBooth.php?pollID=7
(add-to-list 'message-syntax-checks '(sender . disabled))
http://www.messengers-of-messiah.org/~csebold/emacs/why.phtml



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

* Re: patches add variable `gnus-confirm-mail-reply-to-news'
  2002-05-26 19:11             ` Simon Josefsson
@ 2002-10-16 15:31               ` Raymond Scholz
  0 siblings, 0 replies; 14+ messages in thread
From: Raymond Scholz @ 2002-10-16 15:31 UTC (permalink / raw)


[Full quote, because the original posting is rather erm... well, what
 time makes of a posting that has been forgotten in a folder named
 "TODO" for some months]

* Simon Josefsson <jas@extundo.com> wrote:

> Raymond Scholz <ray-2002@zonix.de> writes:
>
>> Simon Josefsson <jas@extundo.com> writes:
>>
>>> I agree. Ok, I added the original patch that defaults to not asking.  Thanks.
>>
>> I used to have this in my .gnus for ages:
>>
>> (setq rs-mailing-lists "list\\.")
>>
>> ;; Patric Mueller in <7iq1t9.m63.ln@bhaak.xodox.com>
>> ;; von mir erweitert um die Abfrage auf Mailinglisten 
>> (defadvice gnus-summary-reply (around reply-in-news activate)
>>   (when (or
>> 	 (not (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 rs-mailing-lists gnus-newsgroup-name)))
>> 	 (y-or-n-p "Really, really reply? "))
>>     ad-do-it))
>>
>> It adds "support" for virtual groups that contain newsgroups and for
>> user defined lists (all of my mailing lists) where I usually don't
>> want to say `R'.
>>
>> Would it be useful to be added to Gnus or is it too specifically
>> tailored for my personal needs?
>
> I didn't test this, but it should add support for setting the variable
> to a string or function to get the behaviour you want.  Does it work?
>
> --- gnus-msg.el.~6.90.~	Thu May 23 23:57:20 2002
> +++ gnus-msg.el	Sun May 26 21:09:26 2002
> @@ -242,9 +242,15 @@
>  (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 'boolean)
> +  :type '(choice (const :tag "No" nil)
> +		 (const :tag "Yes" nil)
> +		 (regexp :tag "Iff group matches regexp")
> +		 (function :tag "Iff function evaluates to non-nil")))
>
>  ;;; Internal variables.
>
> @@ -988,7 +994,11 @@
>    ;; 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)
> +	    (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))

This kind of works for news groups but it doesn't for mail because
(gnus-news-group-p gnus-newsgroup-name) is always nil then.  As I
treat mailing lists like news groups regarding personal replies, the
only way to solve this is to disable this condition.  What about
another variable like `gnus-confirm-treat-mail-like-news'?

--- gnus-msg.el	2002/09/25 23:45:17	6.100
+++ gnus-msg.el	2002/10/16 16:22:51
@@ -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
@@ -1025,9 +1040,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))

Cheers, Ray
-- 
"The main failure in computers is usually between keyboard and chair."



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

end of thread, other threads:[~2002-10-16 15:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-21  2:41 patches add variable `gnus-confirm-mail-reply-to-news' Benjamin Rutt
2002-05-21  9:36 ` Simon Josefsson
2002-05-21 10:46   ` Kai Großjohann
2002-05-21 12:49     ` Simon Josefsson
2002-05-21 17:11       ` Benjamin Rutt
2002-05-21 17:19         ` Benjamin Rutt
2002-05-22  8:52       ` Russ Allbery
2002-05-22  9:10         ` Simon Josefsson
2002-05-22 21:44           ` Benjamin Rutt
2002-05-23 21:36           ` Benjamin Rutt
2002-05-26 16:22           ` Raymond Scholz
2002-05-26 19:11             ` Simon Josefsson
2002-10-16 15:31               ` Raymond Scholz
2002-06-09  9:45 ` Thomas Skogestad

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