But I discovered a major issue with my patch. So here's a new one which is less intrusive. I also added explanation for the current priority order in the cond.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index b8ada2c..7c3d4e3 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,16 +2574,23 @@ isearch--describe-regexp-mode
(when (eq regexp-function t)
(setq regexp-function #'word-search-regexp))
(let ((description
- ;; Don't use a description on the default search mode.
- (cond ((equal regexp-function search-default-mode) "")
- (regexp-function
- (and (symbolp regexp-function)
- (or (get regexp-function 'isearch-message-prefix)
- "")))
- (isearch-regexp "regexp ")
- ;; We're in literal mode. If the default mode is not
- ;; literal, then describe it.
- ((functionp search-default-mode) "literal "))))
+ (cond
+ ;; 1. Don't use a description on the default search mode,
+ ;; only if the default search mode is non-nil.
+ ((and search-default-mode
+ (equal regexp-function search-default-mode)) "")
+ ;; 2. Use the `isearch-message-prefix' set for
+ ;; `regexp-function' if available.
+ (regexp-function
+ (and (symbolp regexp-function)
+ (or (get regexp-function 'isearch-message-prefix)
+ "")))
+ ;; 3. Else if `isearch-regexp' is non-nil, set description
+ ;; to "regexp ".
+ (isearch-regexp "regexp ")
+ ;; 4. And finally, if we're in literal mode (AND if default
+ ;; mode is not literal too), then describe it.
+ ((functionp search-default-mode) "literal "))))
(if space-before
;; Move space from the end to the beginning.
(replace-regexp-in-string "\\(.*\\) \\'" " \\1" description)