From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#60933: 30.0.50; ERC >5.5: Make buttonizing more extensible Date: Tue, 23 May 2023 06:35:05 -0700 Message-ID: <87y1lfrx12.fsf__6370.67675577185$1684848988$gmane$org@neverwas.me> References: <878rhzc3gk.fsf@neverwas.me> 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="3732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-erc@gnu.org To: 60933@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 23 15:36:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1q1SBX-0000hE-BA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 May 2023 15:36:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1SBI-00081t-9V; Tue, 23 May 2023 09:36:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1SBG-00081R-3O for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 09:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1SBF-0006y2-Ro for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 09:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q1SBF-0001Go-N7 for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 09:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 May 2023 13:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60933 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60933-submit@debbugs.gnu.org id=B60933.16848489204814 (code B ref 60933); Tue, 23 May 2023 13:36:01 +0000 Original-Received: (at 60933) by debbugs.gnu.org; 23 May 2023 13:35:20 +0000 Original-Received: from localhost ([127.0.0.1]:38676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1SAZ-0001FZ-JQ for submit@debbugs.gnu.org; Tue, 23 May 2023 09:35:20 -0400 Original-Received: from mail-108-mta155.mxroute.com ([136.175.108.155]:35699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1SAX-0001FH-Gf for 60933@debbugs.gnu.org; Tue, 23 May 2023 09:35:18 -0400 Original-Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta155.mxroute.com (ZoneMTA) with ESMTPSA id 18848d2196100074ee.001 for <60933@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Tue, 23 May 2023 13:35:08 +0000 X-Zone-Loop: 2f3128ee4bcb1113778c8f0e2406885e6773eca1a845 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=atI0IrBOEhNgojSci+niocnBjkDOvWx/7dmVBCH31Es=; b=bVn1+r8RXjDvhyuj5zgkDB4IgC SNUui8ZRbt9eMlhCyhaNzk18n8UBXTpFuQbqnRxw+c8p4ZRZ8xr3sGvt9co626ZjXiDIdXX4OOQQL Nf2hbDy0pnUczETFgg+A4uCAChq9yFLbtzd0byDJxgDac7tJQ8qaK0CbFZ31IZCK/WTnE0Gs+9s4s PNVllqKtny3qKHzGRsnzDZitaNEUB/LwrKGgaIxiJrUQXVl75tcgfaixOyT36ve7HmmWVI9oxLpI+ wvUdU7WnfnNr1P+0Lw4H0+egwPuuFO2b3ckygEFAtC4ZTgqyHuDIjxhbwJSUpXgjFpZnPdX7QOJZF uUa1Gapg==; In-Reply-To: <878rhzc3gk.fsf@neverwas.me> (J. P.'s message of "Wed, 18 Jan 2023 06:38:51 -0800") X-Authenticated-Id: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262228 Archived-At: --=-=-= Content-Type: text/plain The new DWIM `erc-tab' command defers to pcomplete inside the prompt area and runs a hook otherwise. But the hook's interface demands that implementing members handle a raw prefix arg for no compelling reason. And most of these members are movement-focused commands whose natural interactive spec tends to be numeric, making for some roundabout boilerplate awkwardness. This patch switches to numeric prefixes everywhere, which is how things likely should have been originally. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-5.6-Simplify-erc-tab-interface.patch Content-Transfer-Encoding: quoted-printable >From 3ad4da1dc674226339af1437de8c0552316d5b89 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 22 May 2023 23:42:11 -0700 Subject: [PATCH] [5.6] Simplify erc-tab interface * etc/ERC-NEWS: Improve section mentioning `erc-tab'. * lisp/erc/erc-button.el (erc-button-alist): Restore a commented out version of the "" entry, which was dropped in 5adda2f4683 "Revise FORM-as-function interface in erc-button-alist" for being redundant and hence wasteful. This may help any unlikely objectors better adapt to the churn. (erc-button-next, erc-button-previous): Don't bother accommodating raw prefix arguments; expect numeric arguments only. * lisp/erc/erc.el (erc-tab): Change interactive spec to lowercase "p". (Bug#60933) --- etc/ERC-NEWS | 12 ++++++------ lisp/erc/erc-button.el | 7 +++---- lisp/erc/erc.el | 8 ++++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index d257bdcbf51..3d110ca43c6 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -215,12 +215,12 @@ changes are encouraged to voice their concerns on the= bug list. *** Miscellaneous changes Two helper macros from GNU ELPA's Compat library are now available to third-party modules as 'erc-compat-call' and 'erc-compat-function'. -In the area of buttons, 'Info-goto-node' has been supplanted by plain -old 'info' in 'erc-button-alist', and the bracketed "" -pattern entry has been removed because it was more or less redundant. -And the "TAB" key is now bound to a new command, 'erc-tab', that only -calls 'completion-at-point' when point is in the input area and -module-specific commands, like 'erc-button-next', otherwise. +In 'erc-button-alist', 'Info-goto-node' has been supplanted by plain +old 'info', and the "" entry has been removed because it was +more or less redundant. In all ERC buffers, the "" key is now +bound to a new command, 'erc-tab', that calls 'completion-at-point' +inside the input area and otherwise dispatches module-specific +commands, like 'erc-button-next'. =20 * Changes in ERC 5.5 diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 4307dc3b860..33b93ff6744 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -128,6 +128,7 @@ erc-button-alist ;; things hard to maintain. '((nicknames 0 erc-button-buttonize-nicks erc-nick-popup 0) (erc-button-url-regexp 0 t browse-url-button-open-url 0) + ;; (" ]+\\) *>" 0 t browse-url-button-open-url 1) ;;; ("(\\(\\([^~\n \t@][^\n \t@]*\\)@\\([a-zA-Z0-9.:-]+\\)\\)" 1 t finger = 2 3) ;; emacs internal ("[`=E2=80=98]\\([a-zA-Z][-a-zA-Z_0-9!*<=3D>+]+\\)['=E2=80=99]" @@ -629,15 +630,13 @@ erc-button-next "Go to the ARGth next button." (declare (advertised-calling-convention (arg) "30.1")) (interactive "p") - (setq arg (pcase arg ((pred listp) (prefix-numeric-value arg)) (_ arg))) - (erc--button-next arg)) + (erc--button-next (or arg 1))) =20 (defun erc-button-previous (&optional arg) "Go to ARGth previous button." (declare (advertised-calling-convention (arg) "30.1")) (interactive "p") - (setq arg (pcase arg ((pred listp) (prefix-numeric-value arg)) (_ arg))) - (erc--button-next (- arg))) + (erc--button-next (- (or arg 1)))) =20 (defun erc-button-previous-of-nick (arg) "Go to ARGth previous button for nick at point." diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 0be9eb69432..b8ad37a55a0 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -4773,11 +4773,11 @@ erc--tab-functions "Functions to try when user hits \\`TAB' outside of input area. Called with a numeric prefix arg.") =20 -(defun erc-tab (&optional arg) +(defun erc-tab (arg) "Call `completion-at-point' when typing in the input area. -Otherwise call members of `erc--tab-functions' with raw prefix -ARG until one of them returns non-nil." - (interactive "P") +Otherwise call members of `erc--tab-functions' with a numeric +prefix ARG until one of them returns non-nil." + (interactive "p") (if (>=3D (point) erc-input-marker) (completion-at-point) (run-hook-with-args-until-success 'erc--tab-functions arg))) --=20 2.40.0 --=-=-=--