unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28150: mail-compose doesnot work correctly with gnus-user-agent
@ 2017-08-19 19:07 Рейх Константин
  2017-08-19 19:33 ` Eli Zaretskii
  2017-09-13 18:20 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Рейх Константин @ 2017-08-19 19:07 UTC (permalink / raw)
  To: 28150

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)





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

* bug#28150: mail-compose doesnot work correctly with gnus-user-agent
  2017-08-19 19:07 bug#28150: mail-compose doesnot work correctly with gnus-user-agent Рейх Константин
@ 2017-08-19 19:33 ` Eli Zaretskii
  2017-09-13 18:20 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-08-19 19:33 UTC (permalink / raw)
  To: Рейх Константин,
	Lars Ingebrigtsen
  Cc: 28150

> From: Рейх Константин
> 	<reich-cv@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.





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

* bug#28150: mail-compose doesnot work correctly with gnus-user-agent
  2017-08-19 19:07 bug#28150: mail-compose doesnot work correctly with gnus-user-agent Рейх Константин
  2017-08-19 19:33 ` Eli Zaretskii
@ 2017-09-13 18:20 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2017-09-13 18:20 UTC (permalink / raw)
  To: Рейх Константин
  Cc: 28150

Рейх Константин <reich-cv@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





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

end of thread, other threads:[~2017-09-13 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-19 19:07 bug#28150: mail-compose doesnot work correctly with gnus-user-agent Рейх Константин
2017-08-19 19:33 ` Eli Zaretskii
2017-09-13 18:20 ` Lars Ingebrigtsen

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