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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39274 in the body.
You can then email your comments to 39274 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Fri, 24 Jan 2020 23:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 24 Jan 2020 23:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 00:25:35 +0100
Severity: wishlist

When I run an obsolete command interactively, e.g.
`M-x eshell-report-bug', there is no indication that this is an
obsolete command which will be removed in a future version of Emacs.

It's good that there is a warning from the byte-compiler, but it
doesn't help with commands that are normally only used interactively.

This leads to a situation where users can happily be using these
commands, and when upgrading find that they no longer exist.  They
also don't know what to use instead without researching online.

Please add a warning along these lines:

(message "The `%s' command is obsolete since version %s, use `%s' instead"
         obsolete-name version current-name)

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sat, 25 Jan 2020 07:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 09:46:38 +0200
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Sat, 25 Jan 2020 00:25:35 +0100
> 
> Please add a warning along these lines:
> 
> (message "The `%s' command is obsolete since version %s, use `%s' instead"
>          obsolete-name version current-name)

Where and when will this warning be displayed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sat, 25 Jan 2020 19:19:02 GMT) Full text and rfc822 format available.

Message #11 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 20:18:01 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Please add a warning along these lines:
>> 
>> (message "The `%s' command is obsolete since version %s, use `%s' instead"
>>          obsolete-name version current-name)
>
> Where and when will this warning be displayed?

I was thinking of something along the lines of the below patch.

Best regards,
Stefan Kangas

[obsolete.diff (text/x-diff, inline)]
diff --git a/lisp/simple.el b/lisp/simple.el
index 8be27745b1..12a413ec0e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1914,6 +1914,12 @@ execute-extended-command
           (while-no-input
             (setq binding (execute-extended-command--shorter
                            (symbol-name function) typed))))
+        (when-let (obsolete (with-temp-buffer
+                              (when (help-fns--obsolete 'foo)
+                                (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"

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sat, 25 Jan 2020 19:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 20:22:52 +0100
[Message part 1 (text/plain, inline)]
Stefan Kangas <stefan <at> marxist.se> writes:

>>> Please add a warning along these lines:
>>> 
>>> (message "The `%s' command is obsolete since version %s, use `%s' instead"
>>>          obsolete-name version current-name)
>>
>> Where and when will this warning be displayed?
>
> I was thinking of something along the lines of the below patch.

Sorry, that had a typo.  See attached instead.

Best regards,
Stefan Kangas

[obsolete2.diff (text/x-diff, inline)]
diff --git a/lisp/simple.el b/lisp/simple.el
index 8be27745b1..f1f0da1fed 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1914,6 +1914,12 @@ execute-extended-command
           (while-no-input
             (setq binding (execute-extended-command--shorter
                            (symbol-name function) typed))))
+        (when-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"

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sat, 25 Jan 2020 20:15:02 GMT) Full text and rfc822 format available.

Message #17 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 22:14:31 +0200
> From: Stefan Kangas <stefan <at> marxist.se>
> Cc: 39274 <at> debbugs.gnu.org
> Date: Sat, 25 Jan 2020 20:22:52 +0100
> 
> >>> (message "The `%s' command is obsolete since version %s, use `%s' instead"
> >>>          obsolete-name version current-name)
> >>
> >> Where and when will this warning be displayed?
> >
> > I was thinking of something along the lines of the below patch.

So for obsolete commands we will now display 2 messages, one after the
other?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sat, 25 Jan 2020 20:31:01 GMT) Full text and rfc822 format available.

Message #20 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: 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.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39274; Package emacs. (Sun, 01 Mar 2020 01:02:01 GMT) Full text and rfc822 format available.

Message #23 received at 39274 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39274 <at> debbugs.gnu.org
Subject: Re: bug#39274: Warn when using obsolete command interactively
Date: Sun, 01 Mar 2020 02:01:38 +0100
tags 39274 + wontfix notabug
close 39274
thanks

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

> 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.

After further testing, it turns out that this is not a good idea,
since it runs a too high risk of obscuring other messages.  I'm
therefore closing this bug.

Sorry about the noise, and thanks for the feedback.

Best regards,
Stefan Kangas




Added tag(s) wontfix and notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 01 Mar 2020 01:02:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 39274 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 01 Mar 2020 01:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 29 Mar 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years ago.

Previous Next


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