all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39274@debbugs.gnu.org
Subject: bug#39274: Warn when using obsolete command interactively
Date: Sat, 25 Jan 2020 21:30:45 +0100	[thread overview]
Message-ID: <87muab8eiy.fsf@marxist.se> (raw)
In-Reply-To: <83eevnpa3c.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Jan 2020 22:14:31 +0200")

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

  reply	other threads:[~2020-01-25 20:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-03-01  1:01           ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muab8eiy.fsf@marxist.se \
    --to=stefan@marxist.se \
    --cc=39274@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.