[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-customs 7a6c6f1668 1/3: Add completion-header-string
From: |
Jimmy Aguilar Mena |
Subject: |
feature/completions-customs 7a6c6f1668 1/3: Add completion-header-string. |
Date: |
Sun, 13 Mar 2022 14:34:16 -0400 (EDT) |
branch: feature/completions-customs
commit 7a6c6f16689158fd8faadabc239378653d39ae7e
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>
Add completion-header-string.
* doc/emacs/mini.texi (completion-header-string): Remove
completion-header-text-property-list and completion-lazy-count.
(completion-header-string): Substitutes the removed variable.
---
doc/emacs/mini.texi | 19 ++++++++-----------
etc/NEWS | 11 ++++-------
lisp/minibuffer.el | 35 +++++++++++------------------------
3 files changed, 23 insertions(+), 42 deletions(-)
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 769acbcdd5..b7a30b72bf 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -667,17 +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-lazy-count
-@vindex completion-header-text-property-list
- When the boolean variable @code{completion-lazy-count} is
-non-@code{nil} the completions header line shows the total number of
-completion candidates. With the text property list
-@code{completion-header-text-property-list} (@pxref{Property
-Lists,,Property Lists, elisp, The Emacs Lisp Reference Manual}) the
-user can specify some text properties to the completions header line.
-Some useful values may be @code{face}, @code{cursor-intangible} or
-@code{invisible} (@pxref{Special Properties,,Properties with Special
-Meanings, 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 completions-highlight-mode
When the mode @code{completions-highlight-mode} is active the candidate
diff --git a/etc/NEWS b/etc/NEWS
index 041d3c9d19..c374a5b999 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -568,13 +568,10 @@ some completion is made.
This option limits the height of the "*Completions*" buffer.
+++
-*** New option 'completion-header-text-property-list'
-List of text properties to add to the header line of completions.
-
-+++
-*** New option 'completion-lazy-count'
-When non-nil the completions header line shows the total number of
-completion candidates.
+*** New option 'completion-header-string'
+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.
+++
*** New mode 'completions-highlight-mode'.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 1768673bcb..c8af72667c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1873,18 +1873,12 @@ completions."
:type 'boolean
:version "28.1")
-(defcustom completion-header-text-property-list nil
- "List of text properties to add to the header line of completions.
-For example you can change the header color to red setting this
-to: `(face (:foreground ``red'')). Some useful properties may be
-`cursor-intangible' or `invisible'. See Info node `(elisp) Special
-Properties'."
- :type 'plist
- :version "29.1")
-
-(defcustom completion-lazy-count nil
- "When non-nil, display the total number of candidates in the completions
header."
- :type 'boolean
+(defcustom completion-header-string "Possible completions are (%s):\n"
+ "Propertized header text for completions list.
+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)
+ (string :tag "Prefix format string"))
:version "29.1")
(defun completion--insert-strings (strings &optional group-fun)
@@ -2149,18 +2143,11 @@ candidates."
(with-current-buffer standard-output
(goto-char (point-max))
- (if completions
- (let ((start (point))
- (text (concat
- "Possible completions are"
- (if completion-lazy-count
- (format " (%s)" (length completions)))
- ":\n")))
- (insert text)
- (when completion-header-text-property-list
- (add-text-properties start (point)
completion-header-text-property-list))
- (completion--insert-strings completions group-fun))
- (insert "There are no possible completions of what you have typed."))))
+ (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))))
+ (completion--insert-strings completions group-fun))))
(run-hooks 'completion-setup-hook)
nil)