]> code.delx.au - gnu-emacs/blobdiff - lisp/faces.el
(next-line-add-newlines): Change default to nil.
[gnu-emacs] / lisp / faces.el
index 60e8e1a49c2b1fc09c1d0021dba8e533f1a477f9..e899959400692982cb276dc67aaebf85fe12eb6e 100644 (file)
@@ -58,7 +58,8 @@ a font height that isn't optimal."
           (set-default symbol value)
           (internal-set-font-selection-order value)))
 
-;; This is defined originally in {w32,x}faces.c.
+
+;; This is defined originally in xfaces.c.
 (defcustom face-font-family-alternatives
   '(("courier" "fixed")
     ("helv" "helvetica" "arial" "fixed"))
@@ -74,6 +75,22 @@ ALTERNATIVE2 etc."
           (internal-set-alternative-font-family-alist value)))
 
 
+;; This is defined originally in xfaces.c.
+(defcustom face-font-registry-alternatives
+  '(("muletibetan-2" "muletibetan-0"))
+  "*Alist of alternative font registry names.
+Each element has the the form (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...).
+If fonts of registry REGISTRY can't be loaded, try ALTERNATIVE1, then
+ALTERNATIVE2 etc."
+  :tag "Alternative font registries to try."
+  :type '(repeat (repeat string))
+  :version "21.1"
+  :group 'font-selection
+  :set #'(lambda (symbol value)
+          (set-default symbol value)
+          (internal-set-alternative-font-registry-alist value)))
+
+
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Creation, copying.
@@ -340,7 +357,10 @@ If FRAME is omitted or nil, use the selected frame."
 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."
-  (internal-get-lisp-face-attribute face :foreground frame))
+  (let ((value (internal-get-lisp-face-attribute face :foreground frame)))
+    (if (eq value 'unspecified)
+       nil 
+      value)))
 
 
 (defun face-background (face &optional frame)
@@ -348,7 +368,10 @@ If FRAME is omitted or nil, use the selected frame."
 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."
-  (internal-get-lisp-face-attribute face :background frame))
+  (let ((value (internal-get-lisp-face-attribute face :background frame)))
+    (if (eq value 'unspecified)
+       nil
+      value)))
 
 
 (defun face-stipple (face &optional frame)
@@ -356,7 +379,10 @@ If FRAME is omitted or nil, use the selected frame."
 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."
-  (internal-get-lisp-face-attribute face :stipple frame))
+  (let ((value (internal-get-lisp-face-attribute face :stipple frame)))
+    (if (eq value 'unspecified)
+       nil
+      value)))
 
 
 (defalias 'face-background-pixmap 'face-stipple)
@@ -1129,9 +1155,14 @@ If FRAME is nil, the current FRAME is used."
            options (cdr conjunct)
            match (cond ((eq req 'type)
                         (or (memq window-system options)
-                            (if (display-graphic-p frame)
-                                (memq 'graphic options)
-                              (memq 'tty options))
+                            ;; FIXME: This should be revisited to use
+                            ;; display-graphic-p, provided that the
+                            ;; color selection depends on the number
+                            ;; of supported colors, and all defface's
+                            ;; are changed to look at number of colors
+                            ;; instead of (type graphic) etc.
+                            (and (null window-system)
+                                 (memq 'tty options))
                             (and (memq 'motif options)
                                  (featurep 'motif))
                             (and (memq 'lucid options)
@@ -1453,7 +1484,9 @@ Initialize colors of certain faces from frame parameters."
   (dolist (face (face-list))
     (face-spec-set face (face-user-default-spec face) frame)
     (internal-merge-in-global-face face frame)
-    (when (memq window-system '(x w32 mac))
+    (when (and (memq window-system '(x w32 mac))
+              (or (not (boundp 'inhibit-default-face-x-resources))
+                  (not (eq face 'default))))
       (make-face-x-resource-internal face frame)))
 
   ;; Initialize attributes from frame parameters.
@@ -1464,14 +1497,35 @@ Initialize colors of certain faces from frame parameters."
                  (scroll-bar-foreground scroll-bar :foreground)
                  (scroll-bar-background scroll-bar :background)
                  (mouse-color mouse :background))))
-    (while params
-      (let ((param-name (nth 0 (car params)))
-           (face (nth 1 (car params)))
-           (attr (nth 2 (car params)))
-           value)
-       (when (setq value (frame-parameter frame param-name))
-         (set-face-attribute face frame attr value)))
-      (setq params (cdr params)))))
+    (dolist (param params)
+      (let ((frame-param (frame-parameter frame (nth 0 param)))
+           (face (nth 1 param))
+           (attr (nth 2 param)))
+       (when (and frame-param
+                  ;; Don't override face attributes explicitly
+                  ;; specified for new frames.
+                  (eq (face-attribute face attr t) 'unspecified))
+         (set-face-attribute face frame attr frame-param))))))
+
+
+(defun tty-handle-reverse-video (frame parameters)
+  "Handle the reverse-video frame parameter for terminal frames."
+  (when (cdr (or (assq 'reverse parameters)
+                (assq 'reverse default-frame-alist)))
+    (if (null window-system)
+       (setq inverse-video t))
+    (let* ((params (frame-parameters frame))
+          (bg (cdr (assq 'foreground-color params)))
+          (fg (cdr (assq 'background-color params))))
+      (modify-frame-parameters frame
+                              (list (cons 'foreground-color fg)
+                                    (cons 'background-color bg)))
+      (if (equal bg (cdr (assq 'mouse-color params)))
+         (modify-frame-parameters frame
+                                  (list (cons 'mouse-color fg))))
+      (if (equal bg (cdr (assq 'cursor-color params)))
+         (modify-frame-parameters frame
+                                  (list (cons 'cursor-color fg)))))))
 
 
 (defun tty-create-frame-with-faces (&optional parameters)
@@ -1484,6 +1538,7 @@ created."
        success)
     (unwind-protect
        (progn
+         (tty-handle-reverse-video frame (frame-parameters frame))
          (frame-set-background-mode frame)
          (face-set-after-frame-default frame)
          (setq success t))
@@ -1559,29 +1614,29 @@ created."
      ;; highlighting; this may be too confusing in general, although it
      ;; happens to look good with the only current use of header-lines,
      ;; the info browser. XXX
-     (:underline t))
+     :underline t)
     (((class color grayscale) (background light))
-     (:inherit mode-line
-      :background "grey90" :foreground "grey20"
-      :box (:line-width 1 :style released-button)))
+     :inherit mode-line
+     :background "grey90" :foreground "grey20"
+     :box nil)
     (((class color grayscale) (background dark))
-     (:inherit mode-line
-      :background "grey20" :foreground "grey90"
-      :box (:line-width 1 :style released-button)))
+     :inherit mode-line
+     :background "grey20" :foreground "grey90"
+     :box nil)
     (((class mono) (background light))
-     (:inherit mode-line
-      :background "white" :foreground "black"
-      :inverse-video nil
-      :box nil
-      :underline t))
+     :inherit mode-line
+     :background "white" :foreground "black"
+     :inverse-video nil
+     :box nil
+     :underline t)
     (((class mono) (background dark))
-     (:inherit mode-line
-      :background "black" :foreground "white"
-      :inverse-video nil
-      :box nil
-      :underline t))
+     :inherit mode-line
+     :background "black" :foreground "white"
+     :inverse-video nil
+     :box nil
+     :underline t)
     (t
-     (:inverse-video t)))
+     :inverse-video t))
   "Basic header-line face."
   :version "21.1"
   :group 'basic-faces)
@@ -1637,8 +1692,12 @@ created."
 
 
 (defface menu
-  '((((type x-toolkit)) ())
-    (t (:inverse-video t)))
+  '((((type tty))
+     :inverse-video t)
+    (((type x-toolkit))
+     )
+    (t
+     :inverse-video t))
   "Basic menu face."
   :version "21.1"
   :group 'menu