From: Lars Ingebrigtsen Date: Thu, 27 Aug 2020 12:46:27 +0000 (+0200) Subject: Make minibuf-eldef respect minibuffer-default-prompt-format X-Git-Tag: emacs-28.0.90~6355 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=19bff57f609854f257780f20043e96fb2eddc713;p=emacs.git Make minibuf-eldef respect minibuffer-default-prompt-format * lisp/minibuf-eldef.el (minibuffer-default--in-prompt-regexps): Take minibuffer-default-prompt-format into account. --- 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."