summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-08-19 19:00:24 +0200
committerStefan Kangas <stefankangas@gmail.com>2022-08-19 19:00:24 +0200
commit935e4da0e1389fd5a8f836ac81dc53d698f4439f (patch)
treebe40d4f59104ecac664193d2bbf0379210fab0c9 /lisp/emacs-lisp
parent021ae515f912d941f0c41d2c6d3c8d322ac9e584 (diff)
downloademacs-935e4da0e1389fd5a8f836ac81dc53d698f4439f.tar.gz
emacs-935e4da0e1389fd5a8f836ac81dc53d698f4439f.tar.bz2
emacs-935e4da0e1389fd5a8f836ac81dc53d698f4439f.zip
Display new keybinding in obsolete command warning
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/simple.el (command-execute): When warning about an obsolete command, display the keybinding for the new command.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/macroexp.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 5ae9d8368f0..40ed0344dfd 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -187,13 +187,15 @@ It should normally be a symbol with position and it defaults to FORM."
msg))
form)))
-(defun macroexp--obsolete-warning (fun obsolescence-data type)
+(defun macroexp--obsolete-warning (fun obsolescence-data type &optional key)
(let ((instead (car obsolescence-data))
(asof (nth 2 obsolescence-data)))
(format-message
"`%s' is an obsolete %s%s%s" fun type
(if asof (concat " (as of " asof ")") "")
(cond ((stringp instead) (concat "; " (substitute-command-keys instead)))
+ ((and instead key)
+ (format-message "; use `%s' (%s) instead." instead key))
(instead (format-message "; use `%s' instead." instead))
(t ".")))))