From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: send new reply from gnus hangs Date: Thu, 13 Jun 2019 19:39:11 -0700 Message-ID: <87sgscgab4.fsf@ericabrahamsen.net> References: <87r285nhxb.fsf@telefonica.net> <87k1duml43.fsf@telefonica.net> <87sgsiwehh.fsf@telefonica.net> <87k1du744k.fsf@telefonica.net> <87h88y8ibl.fsf@telefonica.net> <878suas5wv.fsf@telefonica.net> <87d0jmuyrj.fsf@telefonica.net> <87imtetju1.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="181327"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 14 04:43:31 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hbcBf-000l30-4S for ged-emacs-devel@m.gmane.org; Fri, 14 Jun 2019 04:43:31 +0200 Original-Received: from localhost ([::1]:46794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbcBe-00039f-5y for ged-emacs-devel@m.gmane.org; Thu, 13 Jun 2019 22:43:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35395) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbc8U-00033A-RT for emacs-devel@gnu.org; Thu, 13 Jun 2019 22:40:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbc8R-0007li-2N for emacs-devel@gnu.org; Thu, 13 Jun 2019 22:40:13 -0400 Original-Received: from [195.159.176.226] (port=38298 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbc8O-0007hA-ER for emacs-devel@gnu.org; Thu, 13 Jun 2019 22:40:09 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hbc8I-000h8A-0u for emacs-devel@gnu.org; Fri, 14 Jun 2019 04:40:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:InvgcXbNd87fuQMiNjSXS4u29Lg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:237570 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Andy Moreton writes: > On Mon 10 Jun 2019, Óscar Fuentes wrote: > >> Confirmed, reverting that commit fixes the problem. >> >>> Óscar Fuentes writes: >>> >>> The problematic commit is >>> >>> master e51adfbdb7587c2b0b5ba154be210b30db82b4ea >>> Author: Oleh Krehel >>> AuthorDate: Thu Jun 6 16:01:10 2019 +0200 >>> Commit: Oleh Krehel >>> CommitDate: Thu Jun 6 16:01:10 2019 +0200 > > Thanks Óscar, that appears to be the problem. > > Looking at that commit, one call site calls `error' to abort sending the > message, so the return value does not matter, but the other uses > do-posting to set the return value from the `check-message' form, which > is used by its caller. > > AndyM Okay, that worked! What does everyone think of the attached diff? It moves the `message-check' call out of the internal function (that seems like work that should be done by the caller, not the internal function, and helps the call fit in visually), and either returns nil or errors depending on an optional arg. E --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=message-continuation-fix.diff diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 9ce35cece4..012aec0067 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4477,16 +4477,24 @@ message-send-mail-partially (declare-function hashcash-wait-async "hashcash" (&optional buffer)) -(defun message--check-continuation-headers () - (message-check 'continuation-headers +(defun message--check-continuation-headers (&optional errorp) + "Check for continuation headers and possibly fix. +Return t if no fixes are necessary. Prompt the user about fixing +continuation lines and/or sending without fixing. If user opts +not to send, raise an error if ERRORP is non-nil, otherwise +return nil." + (catch 'check (goto-char (point-min)) (while (re-search-forward "^[^ \t\n][^ \t\n:]*[ \t\n]" nil t) (goto-char (match-beginning 0)) (if (y-or-n-p "Fix continuation lines? ") (insert " ") - (forward-line 1) - (unless (y-or-n-p "Send anyway? ") - (error "Failed to send the message")))))) + (forward-line 1) + (unless (y-or-n-p "Send anyway? ") + (if errorp + (error "Failed to send the message") + (throw 'check nil))))) + t)) (defun message--send-mail-maybe-partially () (if (or (not message-send-mail-partially-limit) @@ -4571,7 +4579,8 @@ message-send-mail (if news nil message-deletable-headers))) (message-generate-headers headers)) ;; Check continuation headers. - (message--check-continuation-headers) + (message-check 'continuation-headers + (message--check-continuation-headers 'error)) (message--fold-long-headers) ;; Let the user do all of the above. (run-hooks 'message-header-hook)) @@ -5166,7 +5175,8 @@ message-check-news-header-syntax (if (= (length errors) 1) "this" "these") (if (= (length errors) 1) "" "s") (mapconcat 'identity errors ", "))))))) - (message--check-continuation-headers) + (message-check 'continuation-headers + (message--check-continuation-headers)) ;; Check the Newsgroups & Followup-To headers for syntax errors. (message-check 'valid-newsgroups (let ((case-fold-search t) --=-=-=--