GNU bug report logs - #39274
Warn when using obsolete command interactively

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Fri, 24 Jan 2020 23:27:02 UTC

Severity: wishlist

Tags: notabug, wontfix

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39274 <at> debbugs.gnu.org
Subject: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 21:30:45 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> 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

[obsolete3.diff (text/x-diff, inline)]
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.

This bug report was last modified 5 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.