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

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

Re: help-default-arg-highlight


From: Miles Bader
Subject: Re: help-default-arg-highlight
Date: Tue, 01 Jun 2004 13:22:16 +0900

Ok, this version actually seems to work correctly on both ttys and X:

   (defun face-differs-from-default-p (face &optional frame)
     "Non-nil if FACE displays differently from the default face.
   If the optional argument FRAME is given, report on face FACE in that frame.
   If FRAME is t, report on the defaults for face FACE (for new frames).
   If FRAME is omitted or nil, use the selected frame."
     (if (not (equal (face-font face frame) (face-font 'default frame)))
         ;; The font is different from the default face's font, so clearly it
         ;; differs.  This only really works on window-systems; on ttys, the
         ;; "font" is a constant, with attributes layered on top of it.
         t
       ;; General face attribute check.  On a window-system,
       ;; `display-supports-face-attributes-p' always (currently) returns t,
       ;; so there this just essentially checks to see if any attribute of the
       ;; merged face is not `unspecified'; as we already checked the font
       ;; above, we omit font-related attributes for that reason.  On a tty,
       ;; display-supports-face-attributes-p actually does do further checks,
       ;; so we check all attributes.
       (let ((attrs
              (if window-system
                  ;; Omit font-related attributes on a window-system
                  '(:foreground :foreground :background :underline :overline
                    :strike-through :box :inverse-video :stipple)
                ;; On a tty, check all attributes
                '(:family :width :height :weight :slant :foreground
                   :foreground :background :underline :overline
                   :strike-through :box :inverse-video :stipple)))
             (differs nil))
         (while (and attrs (not differs))
           (let* ((attr (pop attrs))
                  (attr-val (face-attribute face attr frame t)))
             (when (and
                    (not (eq attr-val 'unspecified))
                    (display-supports-face-attributes-p (list attr attr-val)
                                                        frame))
               (setq differs attr))))
         differs)))

Does this seems like it could cause any problems?

-Miles
-- 
My spirit felt washed.  With blood.  [Eli Shin, on "The Passion of the Christ"]




reply via email to

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