unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
@ 2013-04-09 14:17 Michael Heerdegen
  2013-04-10  5:52 ` Katsumi Yamaoka
  2013-04-11 18:03 ` Wolfgang Jenkner
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Heerdegen @ 2013-04-09 14:17 UTC (permalink / raw)
  To: 14166


Hello,

the problem is the following (with my setup):

- I have an active gnus; currently, I'm having a summary buffer showing
  the emacs-dev newsgroup.  I need it for reference for the composition
  of a bug report.

- I do M-x report-emacs-bug

The result is that the mail composition buffer will have a TO field of
"emacs-devel@gnu.org" instead of "bug-gnu-emacs@gnu.org".
`report-emacs-bug' uses the posting-style of the group I'm currently
reading.  Surprising, and not very useful.


Background: I use mail-user-agent == 'gnus-user-agent.  Not sure if
there are other related settings.

And I have this element in `gnus-posting-styles':

("\\(?:\\(?:g\\(?:\\(?:mane\\|nu\\)\\.emacs\\.devel\\)\\)\\)\\'"
  (TO "emacs-devel@gnu.org")
  (BCC #1="michael_heerdegen@web.de")
  . #2=((FCC nil)))

mainly because I read emacs-devel as a group, but want to reply always
to the mailing list (I know about S L, but I want also to be able to use
the standard reply commands.  Please tell me if that's a bad idea).


I debugged a bit.  Here is what's going on:

M-x report-emacs-bug
--> compose-mail
--> (get mail-user-agent 'composefunc) == 'gnus-msg-mail
--> (gnus-setup-message 'message
	(message-mail to subject other-headers continue
		      nil yank-action send-actions return-action))

The macro `gnus-setup-message' binds `#:group' to the value of
`gnus-newsgroup-name', which is "nntp+Gmane:gmane.emacs.devel" in my
case.

Then it does this:

(add-hook 'message-mode-hook
          (if (memq ,config '(reply-yank reply))
              (lambda ()
                (gnus-configure-posting-styles ,group))
            (lambda ()
              ;; There may be an old " *gnus article copy*" buffer.
              (let (gnus-article-copy)
                (gnus-configure-posting-styles ,group)))))


At the end, running `message-mode-hook' changes the TO field
according to the posting style via `gnus-configure-posting-styles'.


Thanks,

Michael.



In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-04-04 on dex, modified by Debian
 (emacs-snapshot package, version 2:20130403-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux 7.0 (wheezy)

Configured using:
 `configure --build x86_64-linux-gnu --host x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man
 --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
 --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
 --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes
 CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'
 CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed
 -znocombreloc''






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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-09 14:17 bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent Michael Heerdegen
@ 2013-04-10  5:52 ` Katsumi Yamaoka
  2013-04-10 13:39   ` Michael Heerdegen
  2013-04-11 18:03 ` Wolfgang Jenkner
  1 sibling, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2013-04-10  5:52 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 14166

Michael Heerdegen wrote:
> the problem is the following (with my setup):

> - I have an active gnus; currently, I'm having a summary buffer showing
>   the emacs-dev newsgroup.  I need it for reference for the composition
>   of a bug report.

> - I do M-x report-emacs-bug

> The result is that the mail composition buffer will have a TO field of
> "emacs-devel@gnu.org" instead of "bug-gnu-emacs@gnu.org".
> `report-emacs-bug' uses the posting-style of the group I'm currently
> reading.  Surprising, and not very useful.

> Background: I use mail-user-agent == 'gnus-user-agent.  Not sure if
> there are other related settings.

> And I have this element in `gnus-posting-styles':

> ("\\(?:\\(?:g\\(?:\\(?:mane\\|nu\\)\\.emacs\\.devel\\)\\)\\)\\'"
>   (TO "emacs-devel@gnu.org")
>   (BCC #1="michael_heerdegen@web.de")
>   . #2=((FCC nil)))

> mainly because I read emacs-devel as a group, but want to reply always
> to the mailing list (I know about S L, but I want also to be able to use
> the standard reply commands.  Please tell me if that's a bad idea).

[...]

There seem to be several solutions, however ideas I have are not
so good.  For example:

1. To make `report-emacs-bug' bind `gnus-posting-styles' to nil
   unconditionally while performing `compose-mail'.  It has to load
   gnus-msg.el, that provides `gnus-posting-styles', before binding
   it to nil if Gnus is not running yet even if `mail-user-agent'
   is not `gnus-user-agent'.  Otherwise, `gnus-posting-styles' will
   be made unbound.  Note that a function `gnus-user-agent' uses,
   that is `gnus-msg-mail', is autoloaded, and it involves many other
   Gnus modules loading.

2. Similar to 1.  But load gnus-msg.el and bind `gnus-posting-styles'
   to nil if and only if `mail-user-agent' equals `gnus-user-agent'.
   I think the source code for it will get ugly.

3. To make `gnus-msg-mail' bind `gnus-posting-styles' to nil if and
   only if `this-command' is `report-emacs-bug'.  It won't work if
   `report-emacs-bug' is called non-interactively.

My second best is 2.  What do others think?





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-10  5:52 ` Katsumi Yamaoka
@ 2013-04-10 13:39   ` Michael Heerdegen
  2013-04-11  0:41     ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Heerdegen @ 2013-04-10 13:39 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 14166

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> There seem to be several solutions, however ideas I have are not
> so good.  For example:
>
> 1. To make `report-emacs-bug' bind `gnus-posting-styles' to nil
>    unconditionally while performing `compose-mail'.  It has to load
>    gnus-msg.el, that provides `gnus-posting-styles', before binding
>    it to nil if Gnus is not running yet even if `mail-user-agent'
>    is not `gnus-user-agent'.  Otherwise, `gnus-posting-styles' will
>    be made unbound.  Note that a function `gnus-user-agent' uses,
>    that is `gnus-msg-mail', is autoloaded, and it involves many other
>    Gnus modules loading.
>
> 2. Similar to 1.  But load gnus-msg.el and bind `gnus-posting-styles'
>    to nil if and only if `mail-user-agent' equals `gnus-user-agent'.
>    I think the source code for it will get ugly.
>
> 3. To make `gnus-msg-mail' bind `gnus-posting-styles' to nil if and
>    only if `this-command' is `report-emacs-bug'.  It won't work if
>    `report-emacs-bug' is called non-interactively.
>
> My second best is 2.  What do others think?

Just want to mention `gnus-inhibit-posting-styles'.  Maybe binding it is
more comfortable?  Dunno, just an idea.


Regards,

Michael.





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-10 13:39   ` Michael Heerdegen
@ 2013-04-11  0:41     ` Katsumi Yamaoka
  2013-04-11 13:51       ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2013-04-11  0:41 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 14166

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

Michael Heerdegen wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> There seem to be several solutions, however ideas I have are not
>> so good.  For example:
>>
>> 1. To make `report-emacs-bug' bind `gnus-posting-styles' to nil
>>    unconditionally while performing `compose-mail'.  It has to load
>>    gnus-msg.el, that provides `gnus-posting-styles', before binding
>>    it to nil if Gnus is not running yet even if `mail-user-agent'
>>    is not `gnus-user-agent'.  Otherwise, `gnus-posting-styles' will
>>    be made unbound.  Note that a function `gnus-user-agent' uses,
>>    that is `gnus-msg-mail', is autoloaded, and it involves many other
>>    Gnus modules loading.
>>
>> 2. Similar to 1.  But load gnus-msg.el and bind `gnus-posting-styles'
>>    to nil if and only if `mail-user-agent' equals `gnus-user-agent'.
>>    I think the source code for it will get ugly.
>>
>> 3. To make `gnus-msg-mail' bind `gnus-posting-styles' to nil if and
>>    only if `this-command' is `report-emacs-bug'.  It won't work if
>>    `report-emacs-bug' is called non-interactively.
>>
>> My second best is 2.  What do others think?

> Just want to mention `gnus-inhibit-posting-styles'.  Maybe binding it isThat
> more comfortable?  Dunno, just an idea.

That will cause a problem similar to the one I mentioned in 1.
If Gnus is neither running nor loaded when performing
`report-emacs-bug', gnus-msg.el will be autoloaded under the condition
where `gnus-inhibit-posting-styles' is let-bound (to non-nil), and
`gnus-inhibit-posting-styles' will get void afterward.

Besides this, I came to realize that a user may want to use
`gnus-posting-styles' so as to add something like `Bcc: me', as
you do.  So, either way is not so good.

Oh, I hit on a good idea!  That's somewhat kludgy but works.
A quick hack is below.  It binds the newsgroup name to
"report-emacs-bug" temporarily while performing `report-emacs-bug'.
So, if you want to add `Bcc: me' to a bug report, you can use
this element in `gnus-posting-styles':

	("report-emacs-bug"
	 (Bcc "michael_heerdegen@web.de"))

WDYT?


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

--- emacsbug.el~	2013-02-11 22:45:54.714731000 +0000
+++ emacsbug.el	2013-04-11 00:37:32.109258200 +0000
@@ -162,7 +162,12 @@
     (setq message-end-point
 	  (with-current-buffer (get-buffer-create "*Messages*")
 	    (point-max-marker)))
-    (compose-mail report-emacs-bug-address topic)
+    (if (eq mail-user-agent 'gnus-user-agent)
+	(progn
+	  (require 'gnus) ;; It defines `gnus-newsgroup-name'.
+	  (let ((gnus-newsgroup-name "report-emacs-bug"))
+	    (compose-mail report-emacs-bug-address topic)))
+      (compose-mail report-emacs-bug-address topic))
     ;; The rest of this does not execute if the user was asked to
     ;; confirm and said no.
     (when (eq major-mode 'message-mode)

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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-11  0:41     ` Katsumi Yamaoka
@ 2013-04-11 13:51       ` Stefan Monnier
  2013-04-11 19:06         ` Wolfgang Jenkner
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2013-04-11 13:51 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Michael Heerdegen, 14166

> +    (if (eq mail-user-agent 'gnus-user-agent)
> +	(progn
> +	  (require 'gnus) ;; It defines `gnus-newsgroup-name'.
> +	  (let ((gnus-newsgroup-name "report-emacs-bug"))
> +	    (compose-mail report-emacs-bug-address topic)))
> +      (compose-mail report-emacs-bug-address topic))

Why would we need such a hack?  `compose-mail' already receives very
clearly the destination address.

more to the point: we start with a call to Gnus's `composefunc' with an
explicit "to" address (with value report-emacs-bug-address).  And we end
with a message that uses a different "to" address.  So the problem seems
to be on Gnus's side only.


        Stefan





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-09 14:17 bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent Michael Heerdegen
  2013-04-10  5:52 ` Katsumi Yamaoka
@ 2013-04-11 18:03 ` Wolfgang Jenkner
  2013-04-11 18:55   ` Michael Heerdegen
  1 sibling, 1 reply; 11+ messages in thread
From: Wolfgang Jenkner @ 2013-04-11 18:03 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 14166

On Tue, Apr 09 2013, Michael Heerdegen wrote:

> And I have this element in `gnus-posting-styles':
>
> ("\\(?:\\(?:g\\(?:\\(?:mane\\|nu\\)\\.emacs\\.devel\\)\\)\\)\\'"
>   (TO "emacs-devel@gnu.org")
>   (BCC #1="michael_heerdegen@web.de")
>   . #2=((FCC nil)))
>
> mainly because I read emacs-devel as a group, but want to reply always
> to the mailing list (I know about S L, but I want also to be able to use
> the standard reply commands.  Please tell me if that's a bad idea).

I read emacs-devel via gmane and use group parameters to reply to the
mailing list instead, see (info "(gnus)Group Parameters").  For example,
my group parameters for gmane.emacs.devel are

((subscribed . t)
 (to-list . "emacs-devel@gnu.org"))

Also, gnus-mailing-list-insinuate can be used for the initial set-up.

Wolfgang





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-11 18:03 ` Wolfgang Jenkner
@ 2013-04-11 18:55   ` Michael Heerdegen
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Heerdegen @ 2013-04-11 18:55 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: 14166

Wolfgang Jenkner <wjenkner@inode.at> writes:

> I read emacs-devel via gmane and use group parameters to reply to the
> mailing list instead, see (info "(gnus)Group Parameters").  For example,
> my group parameters for gmane.emacs.devel are
>
> ((subscribed . t)
>  (to-list . "emacs-devel@gnu.org"))

Although I still think this problem should be fixed - this is a good
hint, many thanks!  I tried this:

--8<---------------cut here---------------start------------->8---
(dolist (entry my-gnus-newsgroups-to-mailing-lists-mapping)
  (add-to-list 'gnus-parameters
               `(,(car entry) (subscribed . t) (to-list . ,(cdr entry)))))
--8<---------------cut here---------------end--------------->8---

where `my-gnus-newsgroups-to-mailing-lists-mapping' is an alist
((group-regexp . mailing-list-name) ...) I already had defined (I'm
indeed subscribed to all of those).  And it seems to work very well,
without provoking this bug.


Regards,

Michael.





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-11 13:51       ` Stefan Monnier
@ 2013-04-11 19:06         ` Wolfgang Jenkner
  2013-04-12  1:53           ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Jenkner @ 2013-04-11 19:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, Katsumi Yamaoka, 14166

On Thu, Apr 11 2013, Stefan Monnier wrote:

> more to the point: we start with a call to Gnus's `composefunc' with an
> explicit "to" address (with value report-emacs-bug-address).  And we end
> with a message that uses a different "to" address.  So the problem seems
> to be on Gnus's side only.

The Gnus callee behaves as documented, so you'd normally expect the
caller to put up with it.  Personally, though, I don't think there's
a bug here at all, just an example of legitimate foot-shooting ;-)

Wolfgang






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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-11 19:06         ` Wolfgang Jenkner
@ 2013-04-12  1:53           ` Katsumi Yamaoka
  2013-04-12  7:39             ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2013-04-12  1:53 UTC (permalink / raw)
  To: Wolfgang Jenkner, Stefan Monnier; +Cc: Michael Heerdegen, 14166

Wolfgang Jenkner wrote:
> On Thu, Apr 11 2013, Stefan Monnier wrote:
>> more to the point: we start with a call to Gnus's `composefunc' with an
>> explicit "to" address (with value report-emacs-bug-address).  And we end
>> with a message that uses a different "to" address.  So the problem seems
>> to be on Gnus's side only.

> The Gnus callee behaves as documented, so you'd normally expect the
> caller to put up with it.  Personally, though, I don't think there's
> a bug here at all, just an example of legitimate foot-shooting ;-)

Thanks for your help.  I'd like to fix this problem in this manner:

Background:
  The composefunc of `gnus-user-agent' is `gnus-msg-mail', that is
called by not only `compose-mail' but also some Gnus internals.
  A posting style corresponding to a currently opened group is
applied when running `gnus-msg-mail'.  No problem if it is used
within Gnus.  However, the posting style may get meaningless or
harmful if it is called outside of Gnus.  This suggests that every
user will be able to be a foot-shooter.

・Rename `gnus-msg-mail' to `gnus-msg-mail-1'.
・Create `gnus-msg-mail' that calls `gnus-msg-mail-1' with `let'-
  binding of `gnus-newsgroup-name' to "gnus-user-agent".
・Use `gnus-msg-mail' for composefunc exclusively.  Make Gnus
  internals use `gnus-msg-mail-1' instead of `gnus-msg-mail'.
・A user who want to use a posting style even when `compose-mail'
  is used may add it for the group named "gnus-user-agent".

Those changes will be done within Gnus.  Any other suggestion is
welcome.  My only anxiety is such a pseudo group name.

Regards,

P.S. I'm not a posting style user.





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-12  1:53           ` Katsumi Yamaoka
@ 2013-04-12  7:39             ` Katsumi Yamaoka
  2013-04-12 15:18               ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2013-04-12  7:39 UTC (permalink / raw)
  To: 14166; +Cc: Michael Heerdegen, Wolfgang Jenkner

Katsumi Yamaoka wrote:
> Wolfgang Jenkner wrote:
>> On Thu, Apr 11 2013, Stefan Monnier wrote:
>>> more to the point: we start with a call to Gnus's `composefunc' with an
>>> explicit "to" address (with value report-emacs-bug-address).  And we end
>>> with a message that uses a different "to" address.  So the problem seems
>>> to be on Gnus's side only.

>> The Gnus callee behaves as documented, so you'd normally expect the
>> caller to put up with it.  Personally, though, I don't think there's
>> a bug here at all, just an example of legitimate foot-shooting ;-)

> Thanks for your help.  I'd like to fix this problem in this manner:

> Background:
>   The composefunc of `gnus-user-agent' is `gnus-msg-mail', that is
> called by not only `compose-mail' but also some Gnus internals.
>   A posting style corresponding to a currently opened group is
> applied when running `gnus-msg-mail'.  No problem if it is used
> within Gnus.  However, the posting style may get meaningless or
> harmful if it is called outside of Gnus.  This suggests that every
> user will be able to be a foot-shooter.

After having consulted the Gnus code, I changed my mind as follows:

> ・Rename `gnus-msg-mail' to `gnus-msg-mail-1'.

Unnecessary.

> ・Create `gnus-msg-mail' that calls `gnus-msg-mail-1' with `let'-
>   binding of `gnus-newsgroup-name' to "gnus-user-agent".

Change this to:
・Make `gnus-msg-mail' `let'-bind `gnus-newsgroup-name' to "".

> ・Use `gnus-msg-mail' for composefunc exclusively.  Make Gnus
>   internals use `gnus-msg-mail-1' instead of `gnus-msg-mail'.
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Currently there's no Gnus internal that had better use
`gnus-msg-mail-1' instead of `gnus-msg-mail'.

> ・A user who want to use a posting style even when `compose-mail'
>   is used may add it for the group named "gnus-user-agent".

Replace this paragraph with:

・The default posting style, that begins with ".*" and the like,
  will be applied to a mail that `compose-mail' originates.

So, what I'm going to do now is simply to modify `gnus-msg-mail'.
Maybe an Info for this is unnecessary.

Regards,





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

* bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent
  2013-04-12  7:39             ` Katsumi Yamaoka
@ 2013-04-12 15:18               ` Katsumi Yamaoka
  0 siblings, 0 replies; 11+ messages in thread
From: Katsumi Yamaoka @ 2013-04-12 15:18 UTC (permalink / raw)
  To: 14166-done; +Cc: Michael Heerdegen, Wolfgang Jenkner

Katsumi Yamaoka <yamaoka@jpl.org> wrote:
> So, what I'm going to do now is simply to modify `gnus-msg-mail'.

Done.





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

end of thread, other threads:[~2013-04-12 15:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-09 14:17 bug#14166: 24.3.50; report-emacs-bug and mail-user-agent == 'gnus-user-agent Michael Heerdegen
2013-04-10  5:52 ` Katsumi Yamaoka
2013-04-10 13:39   ` Michael Heerdegen
2013-04-11  0:41     ` Katsumi Yamaoka
2013-04-11 13:51       ` Stefan Monnier
2013-04-11 19:06         ` Wolfgang Jenkner
2013-04-12  1:53           ` Katsumi Yamaoka
2013-04-12  7:39             ` Katsumi Yamaoka
2013-04-12 15:18               ` Katsumi Yamaoka
2013-04-11 18:03 ` Wolfgang Jenkner
2013-04-11 18:55   ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).