From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45393: 27.1; Make remove-hook (interactive Date: Mon, 04 Jan 2021 19:39:58 +0200 Message-ID: <8735zgob2p.fsf@mail.linkov.net> References: <87r1ngbqss.fsf@thb.lt> <87eejeiglg.fsf@gnus.org> 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="12931"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Thibault Polge , 45393@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 04 19:09:38 2021 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 1kwUIT-0003C4-VW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jan 2021 19:09:37 +0100 Original-Received: from localhost ([::1]:42352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwUIS-0002qx-Tj for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Jan 2021 13:09:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwUHv-0002ma-Fg for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 13:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwUHv-0003Zg-7Z for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 13:09:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kwUHv-0005EO-38 for bug-gnu-emacs@gnu.org; Mon, 04 Jan 2021 13:09:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Jan 2021 18:09:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45393 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 45393-submit@debbugs.gnu.org id=B45393.160978372820054 (code B ref 45393); Mon, 04 Jan 2021 18:09:03 +0000 Original-Received: (at 45393) by debbugs.gnu.org; 4 Jan 2021 18:08:48 +0000 Original-Received: from localhost ([127.0.0.1]:60235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwUHg-0005DN-7t for submit@debbugs.gnu.org; Mon, 04 Jan 2021 13:08:48 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:54973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwUHe-0005Cy-Lj for 45393@debbugs.gnu.org; Mon, 04 Jan 2021 13:08:47 -0500 Original-Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 0F525100006; Mon, 4 Jan 2021 18:08:38 +0000 (UTC) In-Reply-To: <87eejeiglg.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 25 Dec 2020 06:45:31 +0100") 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" Xref: news.gmane.io gmane.emacs.bugs:197324 Archived-At: --=-=-= Content-Type: text/plain >> The attached patch makes `remove-hook` interactive. > > Looks good; applied to Emacs 28 (after some minor white-space changes to > make the lines shorter than 80 characters). It's difficult to use this feature without a default value. Here's the patch that adds it: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=remove-hook-default.patch diff --git a/lisp/subr.el b/lisp/subr.el index 1acc3c3250..ad0c812ed3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1749,7 +1749,11 @@ remove-hook functions have the same representation under `princ', the first one will be removed." (interactive - (let* ((hook (intern (completing-read "Hook variable: " obarray #'boundp t))) + (let* ((default (and (symbolp (variable-at-point)) + (symbol-name (variable-at-point)))) + (hook (intern (completing-read + (format-prompt "Hook variable" default) + obarray #'boundp t nil nil default))) (local (and (local-variable-p hook) --=-=-=--