From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master 1b0a922 1/2: Make M-x show obsolete commands (Bug#43300) Date: Sun, 13 Sep 2020 15:35:38 -0400 Message-ID: References: <20200913130614.15564.25449@vcs0.savannah.gnu.org> <20200913130616.6B79C20B2C@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27841"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 13 21:36:31 2020 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 1kHXnb-0007Ax-7u for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Sep 2020 21:36:31 +0200 Original-Received: from localhost ([::1]:47756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHXna-0000aD-AJ for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Sep 2020 15:36:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHXms-0008RL-0k for emacs-devel@gnu.org; Sun, 13 Sep 2020 15:35:46 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHXmp-0000Dw-VY for emacs-devel@gnu.org; Sun, 13 Sep 2020 15:35:45 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 99E184410AA; Sun, 13 Sep 2020 15:35:41 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E8191441095; Sun, 13 Sep 2020 15:35:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1600025739; bh=S6tN2Cgp8toeb+V64X8cidfM4Xrsf4twGHOWLJTtqkU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dCLP2C3zUAO+rOkTjcNJTTv5gLY+mGwBOJEBDsFFw5x2OcWG9PrCqNEXwhxnepVnk rJS7jgIpEeGeONcFyucELtyzNXwraf6DDP2fvdm1y/aYDeeiBsxEgAz2XUUjXvwo6y MubT3/HjnxaiYLh61KSguETmmbOYQvrHdfwpz1ahTDMdlb7dAQFoHrFf29QwnWD6z+ 18e29MzAw7C9C/wpI9RndZd9CDWSV7M7qNFuRAdvq4+kHbjXwbnsxPbLRAIgGD/r1D ApdxwpuQAAlNfnHsFL19NcxD9o4shtnED2rY+o6Y5lqae+DgDx9pJKyqoXhO4ICuYN wQyFre5f0ZgKw== Original-Received: from alfajor (unknown [45.72.232.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B529012053A; Sun, 13 Sep 2020 15:35:39 -0400 (EDT) In-Reply-To: <20200913130616.6B79C20B2C@vcs0.savannah.gnu.org> (Stefan Kangas's message of "Sun, 13 Sep 2020 09:06:16 -0400 (EDT)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/13 15:03:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:255565 Archived-At: > Make M-x show obsolete commands (Bug#43300) > * lisp/simple.el (read-extended-command): Don't hide obsolete > commands. > (read-extended-command--annotation): Show an annotation for obsolete > commands that says what their new name is. I think this doesn't push users away from obsolete commands strongly enough. If removing them from the list of completions is not an option any more, then maybe we could/should force a kind of "confirmation". e.g. `M-x RET` would emit a short "Really call obsolete `obsolete-command`?" and wait for an extra RET before going ahead. Stefan > lisp/simple.el | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) > > diff --git a/lisp/simple.el b/lisp/simple.el > index b5002dd..16ff863 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -1881,22 +1881,17 @@ to get different commands to edit and resubmit." > '(metadata > (annotation-function . read-extended-command--annotation) > (category . command)) > - (let ((pred > - (if (memq action '(nil t)) > - ;; Exclude obsolete commands from completions. > - (lambda (sym) > - (and (funcall pred sym) > - (or (equal string (symbol-name sym)) > - (not (get sym 'byte-obsolete-info))))) > - pred))) > - (complete-with-action action obarray string pred)))) > + (complete-with-action action obarray string pred))) > #'commandp t nil 'extended-command-history))) > > (defun read-extended-command--annotation (command-name) > - (let* ((function (and (stringp command-name) (intern-soft command-name))) > - (binding (where-is-internal function overriding-local-map t))) > - (when (and binding (not (stringp binding))) > - (format " (%s)" (key-description binding))))) > + (let* ((fun (and (stringp command-name) (intern-soft command-name))) > + (binding (where-is-internal fun overriding-local-map t)) > + (obsolete (get fun 'byte-obsolete-info))) > + (cond (obsolete > + (format " (%s)" (car obsolete))) > + ((and binding (not (stringp binding))) > + (format " (%s)" (key-description binding)))))) > > (defcustom suggest-key-bindings t > "Non-nil means show the equivalent key-binding when M-x command has one.