file that the buffer is visiting or the name and status of the
buffer's process.
+@cindex previous input highlighting, in completions
+@vindex completions-highlight-previous-inputs
+In the @file{*Completions*} buffer, Emacs highlights completion
+candidates that appear in the minibuffer history (meaning you have
+used them before, @pxref{Minibuffer History}) with face
+@code{completions-previous-input}. To disable previous input
+highlighting in the @file{*Completions*} buffer, customize
+@code{completions-highlight-previous-inputs} to @code{nil}.
+
@node Minibuffer History
@section Minibuffer History
@cindex minibuffer history
and you can now customize the face 'completions-heading' to control
its appearance.
++++
+*** Highlight previous minibuffer inputs in the completions list
+Emacs now highlights completion candidates that appear in the
+minibuffer history with face 'completions-previous-input' in the
+"*Completions*" buffer. You can disable this highlighting by
+customizing 'completions-highlight-previous-inputs' to nil.
+
** Pcomplete
---
(defface completions-heading '((t :inherit shadow))
"Face for the completions headling line.")
+(defface completions-previous-input '((t :underline "violet"))
+ "Face for highlighting previous inputs in the *Completions* buffer.")
+
+(defcustom completions-highlight-previous-inputs t
+ "Whether to highlight previously used inputs in the *Completions* buffer."
+ :version "30.1"
+ :type 'boolean)
+
(defun display-completion-list (completions &optional common-substring group-fun)
"Display the list of completions, COMPLETIONS, using `standard-output'.
Each element may be just a symbol or string
;; nil-terminated list.
(when last (setcdr last nil))
+ ;; Highilight previously used completions.
+ (when-let
+ ((hist (and completions-highlight-previous-inputs
+ (not (eq minibuffer-history-variable t))
+ (symbol-value minibuffer-history-variable))))
+ (setq completions
+ (mapcar
+ (lambda (comp)
+ (if (member (concat minibuffer-completion-base comp) hist)
+ ;; Avoid modifying the original string.
+ (let ((copy (copy-sequence comp)))
+ (font-lock-append-text-property
+ 0 (length copy)
+ 'face 'completions-previous-input copy)
+ copy)
+ comp))
+ completions)))
+
;; Sort first using the `display-sort-function'.
;; FIXME: This function is for the output of
;; all-completions, not