From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#39274: Warn when using obsolete command interactively Date: Sat, 25 Jan 2020 21:30:45 +0100 Message-ID: <87muab8eiy.fsf@marxist.se> References: <878slw8mj4.fsf@marxist.se> <837e1gq8pt.fsf@gnu.org> <87sgk38hw6.fsf@marxist.se> <87pnf78ho3.fsf@marxist.se> <83eevnpa3c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="4238"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39274@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 25 21:31:11 2020 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 1ivS5H-00013t-G9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jan 2020 21:31:11 +0100 Original-Received: from localhost ([::1]:57354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivS5G-0007Qf-AI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jan 2020 15:31:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53733) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivS59-0007QK-2v for bug-gnu-emacs@gnu.org; Sat, 25 Jan 2020 15:31:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivS58-00087i-5I for bug-gnu-emacs@gnu.org; Sat, 25 Jan 2020 15:31:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50388) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ivS58-00087b-26 for bug-gnu-emacs@gnu.org; Sat, 25 Jan 2020 15:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ivS57-0004QT-V7 for bug-gnu-emacs@gnu.org; Sat, 25 Jan 2020 15:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Jan 2020 20:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39274 X-GNU-PR-Package: emacs Original-Received: via spool by 39274-submit@debbugs.gnu.org id=B39274.157998425617003 (code B ref 39274); Sat, 25 Jan 2020 20:31:01 +0000 Original-Received: (at 39274) by debbugs.gnu.org; 25 Jan 2020 20:30:56 +0000 Original-Received: from localhost ([127.0.0.1]:56361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ivS52-0004QB-HS for submit@debbugs.gnu.org; Sat, 25 Jan 2020 15:30:56 -0500 Original-Received: from ted.gofardesign.uk ([67.225.143.91]:58792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ivS50-0004Px-7g for 39274@debbugs.gnu.org; Sat, 25 Jan 2020 15:30:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; 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=shoZXH/+izS5YseQffP6Fs9WZ6lCRREVUN0iYp4T/Ko=; b=eHg9ez+y5IUVZ+1/MD0auU7kMI 0Vtu/hbNRBSRns0rVvsYCJe8bVDvZoZgrmepwbIf4POgK/NSaPMayMoC9qSrrhjyzLQn63ROPj19e c0xEdKS/sglbq/4tDLnOQyTMM8B1oolP3TXFPPWuZ7byXCk870hsxbBX6517V4aK6Ora1YRTUcbk0 v9Ev/aZxGOyurJyssirnGeqC+VFxNfYJ9EFFWrwMY8tPQUWnCjANkfeYOUgpgaH+USEtZYjrMbvSj 3EKhHHxpBVtWbrUacH3fsEeVHOMORaW31A4zryfJjBfwK5IqYD6X6/ldxsE84wzMNsCMpt5TH9tF9 qM4F+6lA==; Original-Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:34584 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1ivS4t-001M5y-KW; Sat, 25 Jan 2020 15:30:47 -0500 In-Reply-To: <83eevnpa3c.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Jan 2020 22:14:31 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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:175283 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > So for obsolete commands we will now display 2 messages, one after the > other? We could display only one or the other, like in the attached patch. Now that you mention it, that probably would make more sense. Best regards, Stefan Kangas --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=obsolete3.diff diff --git a/lisp/simple.el b/lisp/simple.el index 8be27745b1..f04bae2e90 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1914,16 +1914,23 @@ execute-extended-command (while-no-input (setq binding (execute-extended-command--shorter (symbol-name function) typed)))) - (when binding - (with-temp-message - (format-message "You can run the command `%s' with %s" - function - (if (stringp binding) - (concat "M-x " binding " RET") - (key-description binding))) - (sit-for (if (numberp suggest-key-bindings) - suggest-key-bindings - 2)))))))) + (require 'help-fns) + (if-let ((obsolete (with-temp-buffer + (when (help-fns--obsolete function) + (buffer-string) + (goto-char (point-max)) + (delete-indentation 2))))) + (message obsolete) + (when binding + (with-temp-message + (format-message "You can run the command `%s' with %s" + function + (if (stringp binding) + (concat "M-x " binding " RET") + (key-description binding))) + (sit-for (if (numberp suggest-key-bindings) + suggest-key-bindings + 2))))))))) (defun command-execute (cmd &optional record-flag keys special) ;; BEWARE: Called directly from the C code. --=-=-=--