From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Adolf Newsgroups: gmane.emacs.devel Subject: Re: Facilitate Customisation of Message-Mode Header Completion Behaviour Date: Wed, 09 Mar 2022 19:27:02 +0100 Message-ID: References: <6910f7c48e2cb8015712a69907391dbe@condition-alpha.com> <85477a895e1b8e7e98208c2f73909319@condition-alpha.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="457"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 09 19:28:02 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nS12Y-000AQU-IK for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 19:28:02 +0100 Original-Received: from localhost ([::1]:49422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nS12X-0002Cu-51 for ged-emacs-devel@m.gmane-mx.org; Wed, 09 Mar 2022 13:28:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nS11f-00014A-FL for emacs-devel@gnu.org; Wed, 09 Mar 2022 13:27:08 -0500 Original-Received: from smtprelay02.ispgateway.de ([80.67.18.14]:6234) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nS11d-0006LV-Lp for emacs-devel@gnu.org; Wed, 09 Mar 2022 13:27:07 -0500 Original-Received: from [46.244.212.74] (helo=condition-alpha.com) by smtprelay02.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nS11b-0007ZT-4R for emacs-devel@gnu.org; Wed, 09 Mar 2022 19:27:03 +0100 In-Reply-To: <85477a895e1b8e7e98208c2f73909319@condition-alpha.com> X-Df-Sender: YWxleGFuZGVyLmFkb2xmQGNvbmRpdGlvbi1hbHBoYS5jb20= Received-SPF: pass client-ip=80.67.18.14; envelope-from=alexander.adolf@condition-alpha.com; helo=smtprelay02.ispgateway.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286969 Archived-At: --=-=-= Content-Type: text/plain Alexander Adolf writes: > Alexander Adolf writes: > >> [...] >> +(defcustom message-email-recipient-header-regexp >> + "^\\([^ :]*-\\)?\\(To\\|B?Cc\\|From\\|Reply-to\\|Mail-Followup-To\\|Mail-Copies-To\\):.*? *\\([^,;]*\\)" >> + "Regexp matching headers that list email addresses." >> :group 'message >> :type 'regexp) >> [...] > > The regular expression should have ended with the colon (':'), that is > > "^\\([^ :]*-\\)?\\(To\\|B?Cc\\|From\\|Reply-to\\|Mail-Followup-To\\|Mail-Copies-To\\):" > > Apologies for the slip. My bad! Updated patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Facilitate-Customisation-of-Message-Mode-Header-Comp.patch >From d40a6d084b975a36173909a33b6da0adfe7a2698 Mon Sep 17 00:00:00 2001 From: Alexander Adolf Date: Wed, 9 Mar 2022 15:26:55 +0100 Subject: [PATCH] Facilitate Customisation of Message-Mode Header Completion Behaviour This commit refactors the regular expression used for recognising message headers containing email addresses into a new defcustom. This brings it on par with the regular expression for recognising headers containing newsgroup names. At the same time, the regular expression for email address headers is extended to match additional headers. For one, this allows users to customise the regular expression for email headers, which was not possible before. On the other hand it facilitates customising the value of message-completion-alist, since having the regular expression (which is the car of the conses in message-completion-alist) in a variable makes changing the function to be called (which is the cdr of the conses in message-completion-alist) easier. --- lisp/gnus/message.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a5b3d40467..9e7dc3a6e0 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8265,17 +8265,23 @@ When FORCE, rebuild the tool bar." 'message-mode-map)))) message-tool-bar-map) -;;; Group name completion. +;;; Group name and email address completion. (defcustom message-newgroups-header-regexp "^\\(Newsgroups\\|Followup-To\\|Posted-To\\|Gcc\\):" - "Regexp that match headers that lists groups." + "Regexp matching headers that list groups." + :group 'message + :type 'regexp) + +(defcustom message-email-recipient-header-regexp + "^\\([^ :]*-\\)?\\(To\\|B?Cc\\|From\\|Reply-to\\|Mail-Followup-To\\|Mail-Copies-To\\):" + "Regexp matching headers that list email addresses." :group 'message :type 'regexp) (defcustom message-completion-alist `((,message-newgroups-header-regexp . ,#'message-expand-group) - ("^\\([^ :]*-\\)?\\(To\\|B?Cc\\|From\\):" . ,#'message-expand-name)) + (,message-email-recipient-header-regexp . ,#'message-expand-name)) "Alist of (RE . FUN). Use FUN for completion on header lines matching RE. FUN should be a function that obeys the same rules as those of `completion-at-point-functions'." -- 2.35.1 --=-=-=--