aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2004-06-04 06:00:59 +0000
committerMiles Bader2004-06-04 06:00:59 +0000
commit9717e36cff1ceda0bbebb2209c9fbbbd420af6d0 (patch)
tree4bcc228ea273eed5cf6e2f4134cb41d63635fca8 /lisp
parent5129f10c94db38789a92f396f568f993d726e7bd (diff)
downloademacs-9717e36cff1ceda0bbebb2209c9fbbbd420af6d0.tar.gz
emacs-9717e36cff1ceda0bbebb2209c9fbbbd420af6d0.zip
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code Previously only the tty-related portion of display-supports-face-attributes-p was done in C. This just moves the graphical-display related bits into C too, which allows us to implement them properly (the previous attempt to do a halfway-proper job in lisp didn't work because of funny conditions during emacs startup).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/faces.el41
2 files changed, 8 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8d4381a6961..43d4ce727d1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -7,6 +7,14 @@
7 7
82004-06-04 Miles Bader <miles@gnu.org> 82004-06-04 Miles Bader <miles@gnu.org>
9 9
10 * faces.el (display-supports-face-attributes-p): Function moved to
11 C code. Previously only the tty-related portion of this function
12 was done in C; however the previous attempt to do a halfway-proper
13 job for non-tty displays in lisp didn't work properly because of
14 funny conditions during emacs startup.
15
162004-06-04 Miles Bader <miles@gnu.org>
17
10 * faces.el (face-differs-from-default-p): Use a different 18 * faces.el (face-differs-from-default-p): Use a different
11 implementation, so we can really check whether FACE displays 19 implementation, so we can really check whether FACE displays
12 differently or not. 20 differently or not.
diff --git a/lisp/faces.el b/lisp/faces.el
index cdc56075711..419ff42c894 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1505,47 +1505,6 @@ If omitted or nil, that stands for the selected frame's display."
1505 (t 1505 (t
1506 (> (tty-color-gray-shades display) 2))))) 1506 (> (tty-color-gray-shades display) 2)))))
1507 1507
1508(defun display-supports-face-attributes-p (attributes &optional display)
1509 "Return non-nil if all the face attributes in ATTRIBUTES are supported.
1510The optional argument DISPLAY can be a display name, a frame, or
1511nil (meaning the selected frame's display)
1512
1513The definition of `supported' is somewhat heuristic, but basically means
1514that a face containing all the attributes in ATTRIBUTES, when merged
1515with the default face for display, can be represented in a way that's
1516
1517 (1) different in appearance than the default face, and
1518 (2) `close in spirit' to what the attributes specify, if not exact.
1519
1520Point (2) implies that a `:weight black' attribute will be satisfied by
1521any display that can display bold, and a `:foreground \"yellow\"' as long
1522as it can display a yellowish color, but `:slant italic' will _not_ be
1523satisfied by the tty display code's automatic substitution of a `dim'
1524face for italic."
1525 (let ((frame
1526 (if (framep display)
1527 display
1528 (car (frames-on-display-list display)))))
1529 (if (not (memq (framep frame) '(x w32 mac)))
1530 ;; On ttys, `tty-supports-face-attributes-p' does all the work we need.
1531 (tty-supports-face-attributes-p attributes frame)
1532 ;; For now, we assume that non-tty displays can support everything,
1533 ;; and so we just check to see if any of the specified attributes is
1534 ;; different from the default -- though this probably isn't always
1535 ;; accurate for font-related attributes. Later, we should add the
1536 ;; ability to query about specific fonts, colors, etc.
1537 (while (and attributes
1538 (let* ((attr (car attributes))
1539 (val (cadr attributes))
1540 (default-val (face-attribute 'default attr frame)))
1541 (if (and (stringp val) (stringp default-val))
1542 ;; compare string attributes case-insensitively
1543 (eq (compare-strings val nil nil default-val nil nil t)
1544 t)
1545 (equal val default-val))))
1546 (setq attributes (cddr attributes)))
1547 (not (null attributes)))))
1548
1549 1508
1550;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1509;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1551;;; Background mode. 1510;;; Background mode.