Function: hi-lock-read-face-name

hi-lock-read-face-name is a byte-compiled function defined in hi-lock.el.gz.

Signature

(hi-lock-read-face-name)

Documentation

Return face for interactive highlighting.

When hi-lock-auto-select-face is non-nil, just return the next face. Otherwise, or with a prefix argument, read a face from the minibuffer with completion and history.

Source Code

;; Defined in /usr/src/emacs/lisp/hi-lock.el.gz
(defun hi-lock-read-face-name ()
  "Return face for interactive highlighting.
When `hi-lock-auto-select-face' is non-nil, just return the next face.
Otherwise, or with a prefix argument, read a face from the minibuffer
with completion and history."
  (unless hi-lock-interactive-patterns
    (setq hi-lock--unused-faces hi-lock-face-defaults))
  (let* ((last-used-face
	  (when hi-lock-interactive-patterns
	    (face-name (hi-lock-keyword->face
                        (car hi-lock-interactive-patterns)))))
	 (defaults (append hi-lock--unused-faces
			   (cdr (member last-used-face hi-lock-face-defaults))
			   hi-lock-face-defaults))
	 face)
          (if (and hi-lock-auto-select-face (not current-prefix-arg))
	(setq face (or (pop hi-lock--unused-faces) (car defaults)))
      (setq face (completing-read
		  (format-prompt "Highlight using face" (car defaults))
		  obarray 'facep t nil 'face-name-history defaults))
      ;; Update list of un-used faces.
      (setq hi-lock--unused-faces (remove face hi-lock--unused-faces))
      ;; Grow the list of defaults.
      (add-to-list 'hi-lock-face-defaults face t))
    (intern face)))