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 ".")))))
(t
;; Pass `cmd' rather than `final', for the backtrace's sake.
(prog1 (call-interactively cmd record-flag keys)
- (when (and (symbolp cmd)
- (get cmd 'byte-obsolete-info)
- (not (get cmd 'command-execute-obsolete-warned)))
+ (when-let ((info
+ (and (symbolp cmd)
+ (not (get cmd 'command-execute-obsolete-warned))
+ (get cmd 'byte-obsolete-info))))
(put cmd 'command-execute-obsolete-warned t)
(message "%s" (macroexp--obsolete-warning
- cmd (get cmd 'byte-obsolete-info) "command"))))))))))
+ cmd info "command"
+ (help--key-description-fontified
+ (where-is-internal (car info) nil t))))))))))))
(defun command-execute--query (command)
"Query the user whether to run COMMAND."