From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?=D0=A0=D0=B5=D0=B9=D1=85_?= =?UTF-8?Q?=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B8=D0=BD?= Newsgroups: gmane.emacs.bugs Subject: bug#28150: mail-compose doesnot work correctly with gnus-user-agent Date: Sat, 19 Aug 2017 22:07:18 +0300 Message-ID: <968221503169638@web32j.yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1503169698 11383 195.159.176.226 (19 Aug 2017 19:08:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 19 Aug 2017 19:08:18 +0000 (UTC) To: 28150@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 19 21:08:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj96P-0002Sr-Vi for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Aug 2017 21:08:10 +0200 Original-Received: from localhost ([::1]:52934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dj96W-0000km-Bx for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Aug 2017 15:08:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dj96M-0000jx-LU for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dj96J-000491-G9 for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dj96J-00048k-Bi for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:08:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dj96I-0000nR-KV for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=D0=A0=D0=B5=D0=B9=D1=85_?= =?UTF-8?Q?=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B8=D0=BD?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Aug 2017 19:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28150 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15031696563026 (code B ref -1); Sat, 19 Aug 2017 19:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Aug 2017 19:07:36 +0000 Original-Received: from localhost ([127.0.0.1]:45827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj95s-0000mk-9e for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:07:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj95q-0000mW-0Z for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:07:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dj95j-0003lQ-Nm for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:07:28 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dj95j-0003lJ-Kd for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:07:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dj95i-0000U1-H9 for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:07:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dj95f-0003jK-AP for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:07:26 -0400 Original-Received: from forward106j.mail.yandex.net ([5.45.198.249]:42859) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dj95e-0003hK-Qu for bug-gnu-emacs@gnu.org; Sat, 19 Aug 2017 15:07:23 -0400 Original-Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 090871804368 for ; Sat, 19 Aug 2017 22:07:19 +0300 (MSK) Original-Received: from web32j.yandex.ru (web32j.yandex.ru [5.45.198.135]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yztfxtV4VT-7IUS7hTR; Sat, 19 Aug 2017 22:07:18 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1503169638; bh=T8mAt/60fqXXJu7sIBoSNbCImxkre/1lOrg61UGJyiM=; h=From:To:Subject:Message-Id:Date; b=BF8aJ7DDA7vtFSYmbSKJN2j0yo5NyXcMuDeTCPPHcuLlOTgKF14Ac4F6gVuB0fLqi gu+PZGyh/8YUgEpJhBqRgyPtKT68GD5vL0y8mpwFSi+yC+Q2Em9+Tnxrf9hSdtno/o Cx1z4Qn7hVrdMxgKcgRXZ7zD9N8nKeiMcKIwLth0= Authentication-Results: mxback6o.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by web32j.yandex.ru with HTTP; Sat, 19 Aug 2017 22:07:18 +0300 Envelope-From: reich-cv@yandex.ru X-Mailer: Yamail [ http://yandex.ru ] 5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135920 Archived-At: 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)