GNU bug report logs - #28150
mail-compose doesnot work correctly with gnus-user-agent

Previous Next

Package: emacs;

Reported by: Рейх Константин <reich-cv <at> yandex.ru>

Date: Sat, 19 Aug 2017 19:08:02 UTC

Severity: minor

Tags: notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28150 in the body.
You can then email your comments to 28150 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28150; Package emacs. (Sat, 19 Aug 2017 19:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Рейх Константин <reich-cv <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 19 Aug 2017 19:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Рейх Константин <reich-cv <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: mail-compose doesnot work correctly with gnus-user-agent
Date: Sat, 19 Aug 2017 22:07:18 +0300
Hi, 

I noticed that if Gnus isn't running, mail-compose doesnot use gnus even if i set
(setq mail-user-agent 'gnus-user-agent)

The reason is that gnus-msg-mail uses plain Message mode if gnus isn't running. Is this a bug or feature? 
It seems reasonable to assume that if I set gnus-user-agent I want to use gnus, nothing else.

One can define new mail user agent like:


diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 85969edc81..bb65d3aaab 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -574,6 +574,24 @@ instead."
   'gnus-msg-mail 'message-send-and-exit
   'message-kill-buffer 'message-send-hook)
 
+(define-mail-user-agent 'gnus-user-agent-2
+  'gnus-msg-mail-2 'message-send-and-exit
+  'message-kill-buffer 'message-send-hook)
+
+(defun gnus-msg-mail-2 (&optional to subject other-headers continue switch-action yank-action send-actions return-action)
+  "Start editing a mail message to be sent.
+Like `gnus-msg-mail', but if Gnus isn't running, start it"
+  (interactive)
+  (if (not (gnus-alive-p))
+      (save-window-excursion
+	(let ((inhibit-redisplay t))
+	  (gnus))))
+  (gnus-msg-mail to subject other-headers continue switch-action yank-action send-actions return-action)  
+  )
+
+
+
+
 (defun gnus-setup-posting-charset (group)
   (let ((alist gnus-group-posting-charset-alist)
 	(group (or group ""))


Or even redefine the function gnus-msg-mail:


diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 85969edc81..c2952b671f 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -528,32 +528,30 @@ Thank you for your help in stamping out bugs.
   "Start editing a mail message to be sent.
 Like `message-mail', but with Gnus paraphernalia, particularly the
 Gcc: header for archiving purposes.
-If Gnus isn't running, a plain `message-mail' setup is used
-instead."
+If Gnus isn't running, start it."
   (interactive)
   (if (not (gnus-alive-p))
-      (progn
-	(message "Gnus not running; using plain Message mode")
-	(message-mail to subject other-headers continue
-		      nil yank-action send-actions return-action))
-    (let ((buf (current-buffer))
-	  ;; Don't use posting styles corresponding to any existing group.
-	  (group-name gnus-newsgroup-name)
-	  mail-buf)
-      (unwind-protect
-	  (progn
-	    (setq gnus-newsgroup-name "")
-	    (gnus-setup-message 'message
-	      (message-mail to subject other-headers continue
-			    nil yank-action send-actions return-action)))
-	(with-current-buffer buf
-	  (setq gnus-newsgroup-name group-name)))
-      (when switch-action
-	(setq mail-buf (current-buffer))
-	(switch-to-buffer buf)
-	(apply switch-action mail-buf nil))
-      ;; COMPOSEFUNC should return t if succeed.  Undocumented ???
-      t)))
+      (save-window-excursion
+	(let ((inhibit-redisplay t))
+	  (gnus))))
+  (let ((buf (current-buffer))
+	;; Don't use posting styles corresponding to any existing group.
+	(group-name gnus-newsgroup-name)
+	mail-buf)
+    (unwind-protect
+	(progn
+	  (setq gnus-newsgroup-name "")
+	  (gnus-setup-message 'message
+	    (message-mail to subject other-headers continue
+			  nil yank-action send-actions return-action)))
+      (with-current-buffer buf
+	(setq gnus-newsgroup-name group-name)))
+    (when switch-action
+      (setq mail-buf (current-buffer))
+      (switch-to-buffer buf)
+      (apply switch-action mail-buf nil))
+    ;; COMPOSEFUNC should return t if succeed.  Undocumented ???
+    t))
 
 ;;;###autoload
 (defun gnus-button-mailto (address)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28150; Package emacs. (Sat, 19 Aug 2017 19:35:02 GMT) Full text and rfc822 format available.

Message #8 received at 28150 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Рейх Константин
 <reich-cv <at> yandex.ru>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28150 <at> debbugs.gnu.org
Subject: Re: bug#28150: mail-compose doesnot work correctly with
 gnus-user-agent
Date: Sat, 19 Aug 2017 22:33:32 +0300
> From: Рейх Константин
> 	<reich-cv <at> yandex.ru>
> Date: Sat, 19 Aug 2017 22:07:18 +0300
> 
> I noticed that if Gnus isn't running, mail-compose doesnot use gnus even if i set
> (setq mail-user-agent 'gnus-user-agent)
> 
> The reason is that gnus-msg-mail uses plain Message mode if gnus isn't running. Is this a bug or feature? 

It must be a feature, because it was explicitly added in commit
7582f844.  Perhaps Lars can shed some light on this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28150; Package emacs. (Wed, 13 Sep 2017 18:21:01 GMT) Full text and rfc822 format available.

Message #11 received at 28150 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Рейх Константин <reich-cv <at> yandex.ru>
Cc: 28150 <at> debbugs.gnu.org
Subject: Re: bug#28150: mail-compose doesnot work correctly with
 gnus-user-agent
Date: Wed, 13 Sep 2017 20:20:28 +0200
Рейх Константин <reich-cv <at> yandex.ru> writes:

> The reason is that gnus-msg-mail uses plain Message mode if gnus isn't
> running. Is this a bug or feature?

It's a feature -- starting Gnus can take a long time, and you need to
have Gnus started to use stuff like Gcc: and the like from Message mode.

So I think the current behaviour makes sense.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Sep 2017 18:21:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 28150 <at> debbugs.gnu.org and Рейх Константин <reich-cv <at> yandex.ru> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Sep 2017 18:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.