[Top][All Lists]

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

Re: Emphasize the character to be typed next in *Completions*

From: Juri Linkov
Subject: Re: Emphasize the character to be typed next in *Completions*
Date: Tue, 23 Mar 2004 20:38:19 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

"Robert J. Chassell" <address@hidden> writes:
> Please do not think in terms of any single characteristic such as
> `bold'.  Not everyone uses the same monitor you do.
> I never use bold because it looks bad on the monitor I mostly use.

I fully agree that developers can't make assumptions about user's
display characteristics.  For example, bold faces are hardly readable
with small font sizes.

To be able to remove bold properties from all used faces and to make
other transformations that fit faces into used displays, I propose
to add a new hook `custom-define-face-hook'.  Note that existing hook
`custom-define-hook' can't be used because it's called too often
(from defcustom and defgroup).

Example of usage:

(defun my-fonts-set (&optional frame)
  (mapc (lambda (face)
          ;; My font makes bold texts unreadable,
          ;; so remove bold property from every face
          (when (face-bold-p face frame)
            (set-face-bold-p face nil frame)
            (set-face-underline-p face t frame))
          ;; Fonts with different height decrease the amount of lines
          ;; visible on screen, so remove the height properties
          (when (numberp (face-attribute face :height frame))
            (set-face-attribute face frame :height 'unspecified))
          ;; Fonts with different width decrease the amount of characters
          ;; on the line, so remove the width properties
          (when (numberp (face-attribute face :width frame))
            (set-face-attribute face frame :width 'unspecified)))

(add-to-list 'custom-define-face-hook 'my-fonts-set)

Any objections to this patch?

Index: emacs/lisp/cus-face.el
RCS file: /cvsroot/emacs/emacs/lisp/cus-face.el,v
retrieving revision 1.33
diff -c -r1.33 cus-face.el
*** emacs/lisp/cus-face.el      1 Sep 2003 15:45:09 -0000       1.33
--- emacs/lisp/cus-face.el      23 Mar 2004 18:10:16 -0000
*** 32,37 ****
--- 32,40 ----
  ;;; Declaring a face.
+ (defvar custom-define-face-hook nil
+   "Hook called after defining face.")
  (defun custom-declare-face (face spec doc &rest args)
    "Like `defface', but FACE is evaluated as a normal argument."
*** 57,63 ****
      (when (and doc (null (face-documentation face)))
        (set-face-documentation face (purecopy doc)))
      (custom-handle-all-keywords face args 'custom-face)
!     (run-hooks 'custom-define-hook))
  ;;; Face attributes.
--- 60,67 ----
      (when (and doc (null (face-documentation face)))
        (set-face-documentation face (purecopy doc)))
      (custom-handle-all-keywords face args 'custom-face)
!     (run-hooks 'custom-define-hook)
!     (run-hooks 'custom-define-face-hook))
  ;;; Face attributes.

Juri Linkov

reply via email to

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