unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39274: Warn when using obsolete command interactively
@ 2020-01-24 23:25 Stefan Kangas
  2020-01-25  7:46 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-01-24 23:25 UTC (permalink / raw)
  To: 39274

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-24 23:25 bug#39274: Warn when using obsolete command interactively Stefan Kangas
@ 2020-01-25  7:46 ` Eli Zaretskii
  2020-01-25 19:18   ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-01-25  7:46 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 39274

> From: Stefan Kangas <stefan@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-25  7:46 ` Eli Zaretskii
@ 2020-01-25 19:18   ` Stefan Kangas
  2020-01-25 19:22     ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-01-25 19:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39274

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Eli Zaretskii <eliz@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: obsolete.diff --]
[-- Type: text/x-diff, Size: 750 bytes --]

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"

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-25 19:18   ` Stefan Kangas
@ 2020-01-25 19:22     ` Stefan Kangas
  2020-01-25 20:14       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-01-25 19:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39274

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

Stefan Kangas <stefan@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: obsolete2.diff --]
[-- Type: text/x-diff, Size: 754 bytes --]

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"

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-25 19:22     ` Stefan Kangas
@ 2020-01-25 20:14       ` Eli Zaretskii
  2020-01-25 20:30         ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-01-25 20:14 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 39274

> From: Stefan Kangas <stefan@marxist.se>
> Cc: 39274@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-25 20:14       ` Eli Zaretskii
@ 2020-01-25 20:30         ` Stefan Kangas
  2020-03-01  1:01           ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-01-25 20:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39274

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Eli Zaretskii <eliz@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: obsolete3.diff --]
[-- Type: text/x-diff, Size: 1755 bytes --]

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.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#39274: Warn when using obsolete command interactively
  2020-01-25 20:30         ` Stefan Kangas
@ 2020-03-01  1:01           ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2020-03-01  1:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 39274

tags 39274 + wontfix notabug
close 39274
thanks

Stefan Kangas <stefan@marxist.se> writes:

> Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-01  1:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-24 23:25 bug#39274: Warn when using obsolete command interactively Stefan Kangas
2020-01-25  7:46 ` Eli Zaretskii
2020-01-25 19:18   ` Stefan Kangas
2020-01-25 19:22     ` Stefan Kangas
2020-01-25 20:14       ` Eli Zaretskii
2020-01-25 20:30         ` Stefan Kangas
2020-03-01  1:01           ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).