From 19bff57f609854f257780f20043e96fb2eddc713 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 27 Aug 2020 14:46:27 +0200 Subject: [PATCH] Make minibuf-eldef respect minibuffer-default-prompt-format * lisp/minibuf-eldef.el (minibuffer-default--in-prompt-regexps): Take minibuffer-default-prompt-format into account. --- lisp/minibuf-eldef.el | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el index 01672c027f0..a32d21abb30 100644 --- a/lisp/minibuf-eldef.el +++ b/lisp/minibuf-eldef.el @@ -36,10 +36,24 @@ (defvar minibuffer-eldef-shorten-default) (defun minibuffer-default--in-prompt-regexps () - `(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'" - 1 ,(if minibuffer-eldef-shorten-default " [\\2]")) - ("([^(]+?\\(, default\\(?: is\\)? \\(.*\\)\\)):? \\'" 1) - ("\\( \\[.*\\]\\):? *\\'" 1))) + (cons + (list + (concat + "\\(" + (if (string-match "%s" minibuffer-default-prompt-format) + (concat + (regexp-quote (substring minibuffer-default-prompt-format + 0 (match-beginning 0))) + ".*" + (regexp-quote (substring minibuffer-default-prompt-format + (match-end 0)))) + (regexp-quote minibuffer-default-prompt-format)) + ": *\\)") + 1) + `(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'" + 1 ,(if minibuffer-eldef-shorten-default " [\\2]")) + ("([^(]+?\\(, default\\(?: is\\)? \\(.*\\)\\)):? \\'" 1) + ("\\( \\[.*\\]\\):? *\\'" 1)))) (defcustom minibuffer-eldef-shorten-default nil "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts." -- 2.39.2