bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15909: 24.3.50; please fix `read-face-name' brain-dead PROMPT handli


From: Drew Adams
Subject: bug#15909: 24.3.50; please fix `read-face-name' brain-dead PROMPT handling
Date: Fri, 15 Nov 2013 14:49:10 -0800 (PST)

> Please add some code similar to the following to `read-face-name',
> so it DTRT.
>  (when (save-match-data (string-match ": $" prompt))
>    (setq prompt  (substring prompt 0 -2)))

To be clearer about that part.  Below is code I use to counteract
the current `read-face-name' behavior.  Incorporating a reasonable
fix into `read-face-name' would do something akin to the opposite.

(defun my-read-face-name (prompt)
  "Read a face name using completion.  Return its face symbol.
Accommodate vanilla Emacs PROMPT arg across Emacs versions."
  (save-match-data
    (when (and (> emacs-major-version 21)
               (string-match "\\(:\\s *$\\|:?\\s +$\\)" prompt))
      (setq prompt
            (substring prompt 0
                       (- (length (match-string 0 prompt)))))))
  (read-face-name prompt))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]