From 10cb469ee81c0ff2ad3740e7099227d0a6907545 Mon Sep 17 00:00:00 2001 From: Jimmy Aguilar Mena Date: Sun, 13 Mar 2022 19:44:11 +0100 Subject: [PATCH] Rename completion-header-string to completion-header-format And use a propertized default value. --- doc/emacs/mini.texi | 16 ++++++++-------- etc/NEWS | 2 +- lisp/minibuffer.el | 14 ++++++++------ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index b7a30b72bfb..718ac3ec7a7 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -667,14 +667,14 @@ control of the Completion window display properties you can use Alists,,Action Alists for Buffer Display, elisp, The Emacs Lisp Reference Manual}). -@vindex completion-header-string -The variable @code{completion-header-string} is a string to control -the message shown before completions. It may contain a ``%s'' to show -the total number of completions. If nil no completions are shown. -Text properties may be added to change the appearance, some useful -ones are @code{face} or @code{cursor-intangible} (@pxref{Special -Properties,,Properties with Special Meanings, elisp, The Emacs Lisp -Reference Manual}). +@vindex completion-header-format +The variable @code{completion-header-format} is a formatted string to +control the message shown before completions. It may contain a ``%s'' +to show the total number of completions. If nil no completion header +is shown. Text properties may be added to change the appearance, some +useful ones are @code{face} or @code{cursor-intangible} +(@pxref{Special Properties,,Properties with Special Meanings, elisp, +The Emacs Lisp Reference Manual}). @vindex completions-highlight-mode When the mode @code{completions-highlight-mode} is active the candidate diff --git a/etc/NEWS b/etc/NEWS index 22ba84f084b..76da1787a24 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -568,7 +568,7 @@ some completion is made. This option limits the height of the "*Completions*" buffer. +++ -*** New option 'completion-header-string' +*** New option 'completion-header-format' This is a string to control the message to show before completions. It may contain a %s to show the total number of completions. If nil no completions are shown. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c0281c63430..0cab09bd982 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1873,8 +1873,11 @@ completions." :type 'boolean :version "28.1") -(defcustom completion-header-string "Possible completions are (%s):\n" - "Propertized header text for completions list. +(defcustom completion-header-format + (propertize "%s possible completions:\n" + 'face 'shadow + :help "Please select a completion") + "Format of completions header. It may contain one %s to show the total count of completions. When nil no header is shown." :type '(choice (const :tag "No prefix" nil) @@ -2143,10 +2146,9 @@ candidates." (with-current-buffer standard-output (goto-char (point-max)) - (if (not completions) - (insert "There are no possible completions of what you have typed.") - (when completion-header-string - (insert (format completion-header-string (length completions)))) + (when completions + (when completion-header-format + (insert (format completion-header-format (length completions)))) (completion--insert-strings completions group-fun)))) (run-hooks 'completion-setup-hook) -- 2.39.2