;;; Code:
-(eval-when-compile
- (require 'cl))
+(defcustom term-file-prefix (purecopy "term/")
+ "If non-nil, Emacs startup performs terminal-specific initialization.
+It does this by: (load (concat term-file-prefix (getenv \"TERM\")))
+
+You may set this variable to nil in your init file if you do not wish
+the terminal-initialization file to be loaded."
+ :type '(choice (const :tag "No terminal-specific initialization" nil)
+ (string :tag "Name of directory with term files"))
+ :group 'terminals)
(declare-function xw-defined-colors "term/common-win" (&optional frame))
"Return a list of all defined faces."
(mapcar #'car face-new-frame-defaults))
-
-;;; ### If not frame-local initialize by what X resources?
-
(defun make-face (face &optional no-init-from-resources)
"Define a new face with name FACE, a symbol.
-NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local
-variants of FACE from X resources. (X resources recognized are found
-in the global variable `face-x-resources'.) If FACE is already known
-as a face, leave it unmodified. Value is FACE."
+Do not call this directly from Lisp code; use `defface' instead.
+
+If NO-INIT-FROM-RESOURCES is non-nil, don't initialize face
+attributes from X resources. If FACE is already known as a face,
+leave it unmodified. Return FACE."
(interactive (list (read-from-minibuffer
"Make face: " nil nil t 'face-name-history)))
(unless (facep face)
(make-face-x-resource-internal face)))
face)
-
(defun make-empty-face (face)
"Define a new, empty face with name FACE.
-If the face already exists, it is left unmodified. Value is FACE."
+Do not call this directly from Lisp code; use `defface' instead."
(interactive (list (read-from-minibuffer
"Make empty face: " nil nil t 'face-name-history)))
(make-face face 'no-init-from-resources))
-
(defun copy-face (old-face new-face &optional frame new-frame)
- "Define a face just like OLD-FACE, with name NEW-FACE.
-
-If NEW-FACE already exists as a face, it is modified to be like
-OLD-FACE. If it doesn't already exist, it is created.
-
-If the optional argument FRAME is given as a frame, NEW-FACE is
-changed on FRAME only.
-If FRAME is t, the frame-independent default specification for OLD-FACE
-is copied to NEW-FACE.
-If FRAME is nil, copying is done for the frame-independent defaults
-and for each existing frame.
-
-If the optional fourth argument NEW-FRAME is given,
-copy the information from face OLD-FACE on frame FRAME
-to NEW-FACE on frame NEW-FRAME. In this case, FRAME may not be nil."
+ "Define a face named NEW-FACE, which is a copy of OLD-FACE.
+This function does not copy face customization data, so NEW-FACE
+will not be made customizable. Most Lisp code should not call
+this function; use `defface' with :inherit instead.
+
+If NEW-FACE already exists as a face, modify it to be like
+OLD-FACE. If NEW-FACE doesn't already exist, create it.
+
+If the optional argument FRAME is a frame, change NEW-FACE on
+FRAME only. If FRAME is t, copy the frame-independent default
+specification for OLD-FACE to NEW-FACE. If FRAME is nil, copy
+the defaults as well as the faces on each existing frame.
+
+If the optional fourth argument NEW-FRAME is given, copy the
+information from face OLD-FACE on frame FRAME to NEW-FACE on
+frame NEW-FRAME. In this case, FRAME must not be nil."
(let ((inhibit-quit t))
(if (null frame)
(progn
(defun set-face-attribute (face frame &rest args)
"Set attributes of FACE on FRAME from ARGS.
+This function overrides the face attributes specified by FACE's
+face spec. It is mostly intended for internal use only.
-If FRAME is nil this function sets the attributes for all
-existing frames, and the default for new frames. If FRAME is t,
-change the default for new frames (this is done automatically
-each time an attribute is changed on all frames).
+If FRAME is nil, set the attributes for all existing frames, as
+well as the default for new frames. If FRAME is t, change the
+default for new frames only.
-ARGS must come in pairs ATTRIBUTE VALUE. ATTRIBUTE must be a valid
-face attribute name. All attributes can be set to `unspecified';
-this fact is not further mentioned below.
+ARGS must come in pairs ATTRIBUTE VALUE. ATTRIBUTE must be a
+valid face attribute name. All attributes can be set to
+`unspecified'; this fact is not further mentioned below.
The following attributes are recognized:
`:family'
-VALUE must be a string specifying the font family, e.g. ``monospace'',
-or a fontset alias name. If a font family is specified, wild-cards `*'
-and `?' are allowed.
+VALUE must be a string specifying the font family
+\(e.g. \"Monospace\") or a fontset.
`:foundry'
`:height'
-VALUE specifies the height of the font, in either absolute or relative
-terms. An absolute height is an integer, and specifies font height in
-units of 1/10 pt. A relative height is either a floating point number,
+VALUE specifies the relative or absolute height of the font. An
+absolute height is an integer, and specifies font height in units
+of 1/10 pt. A relative height is either a floating point number,
which specifies a scaling factor for the underlying face height;
-or a function that takes a single argument (the underlying face height)
-and returns the new height. Note that for the `default' face,
-you can only specify an absolute height (since there is nothing
+or a function that takes a single argument (the underlying face
+height) and returns the new height. Note that for the `default'
+face, you must specify an absolute height (since there is nothing
for it to be relative to).
`:weight'
`:underline'
-VALUE specifies whether characters in FACE should be underlined. If
-VALUE is t, underline with foreground color of the face. If VALUE is
-a string, underline with that color. If VALUE is nil, explicitly
-don't underline.
+VALUE specifies whether characters in FACE should be underlined.
+If VALUE is t, underline with foreground color of the face.
+If VALUE is a string, underline with that color.
+If VALUE is nil, explicitly don't underline.
+
+Otherwise, VALUE must be a property list of the form:
+
+`(:color COLOR :style STYLE)'.
+
+COLOR can be a either a color name string or `foreground-color'.
+STYLE can be either `line' or `wave'.
+If a keyword/value pair is missing from the property list, a
+default value will be used for the value.
+The default value of COLOR is the foreground color of the face.
+The default value of STYLE is `line'.
`:overline'
`:font'
-Set font-related face attributes from VALUE. VALUE must be a valid
-XLFD font name. If it is a font name pattern, the first matching font
-will be used.
-
-For compatibility with Emacs 20, keywords `:bold' and `:italic' can
-be used to specify that a bold or italic font should be used. VALUE
-must be t or nil in that case. A value of `unspecified' is not allowed.
+Set font-related face attributes from VALUE. VALUE must be a
+valid font name or font object. Setting this attribute will also
+set the `:family', `:foundry', `:width', `:height', `:weight',
+and `:slant' attributes.
`:inherit'
-VALUE is the name of a face from which to inherit attributes, or a list
-of face names. Attributes from inherited faces are merged into the face
-like an underlying face would be, with higher priority than underlying faces."
+VALUE is the name of a face from which to inherit attributes, or
+a list of face names. Attributes from inherited faces are merged
+into the face like an underlying face would be, with higher
+priority than underlying faces.
+
+For backward compatibility, the keywords `:bold' and `:italic'
+can be used to specify weight and slant respectively. This usage
+is considered obsolete. For these two keywords, the VALUE must
+be either t or nil. A value of t for `:bold' is equivalent to
+setting `:weight' to `bold', and a value of t for `:italic' is
+equivalent to setting `:slant' to `italic'. But if `:weight' is
+specified in the face spec, `:bold' is ignored, and if `:slant'
+is specified, `:italic' is ignored."
(setq args (purecopy args))
(let ((where (if (null frame) 0 frame))
(spec args)
of a set of discrete values. Value is `integerp' if ATTRIBUTE expects
an integer value."
(let ((valid
- (case attribute
- (:family
+ (pcase attribute
+ (`:family
(if (window-system frame)
(mapcar (lambda (x) (cons x x))
(font-family-list))
;; Only one font on TTYs.
(list (cons "default" "default"))))
- (:foundry
+ (`:foundry
(list nil))
- (:width
+ (`:width
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-width-table))
- (:weight
+ (`:weight
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-weight-table))
- (:slant
+ (`:slant
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-slant-table))
- (:inverse-video
+ (`:inverse-video
(mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute)))
- ((:underline :overline :strike-through :box)
+ ((or `:underline `:overline `:strike-through `:box)
(if (window-system frame)
(nconc (mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute))
(defined-colors frame)))
(mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute))))
- ((:foreground :background)
+ ((or `:foreground `:background)
(mapcar #'(lambda (c) (cons c c))
(defined-colors frame)))
- ((:height)
+ (`:height
'integerp)
- (:stipple
+ (`:stipple
(and (memq (window-system frame) '(x ns)) ; No stipple on w32
(mapcar #'list
(apply #'nconc
(file-directory-p dir)
(directory-files dir)))
x-bitmap-file-path)))))
- (:inherit
+ (`:inherit
(cons '("none" . nil)
(mapcar #'(lambda (c) (cons (symbol-name c) c))
(face-list))))
- (t
+ (_
(error "Internal error")))))
(if (and (listp valid) (not (memq attribute '(:inherit))))
(nconc (list (cons "unspecified" 'unspecified)) valid)
:foreground (or foreground 'unspecified)
:background (or background 'unspecified)
:stipple stipple
- :bold bold-p
- :italic italic-p
+ :weight (if bold-p 'bold 'normal)
+ :slant (if italic-p 'italic 'normal)
:underline underline
:inverse-video inverse-p)
(setq face (read-face-name "Modify face"))
(defconst list-faces-sample-text
"abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "*Text string to display as the sample text for `list-faces-display'.")
+ "Text string to display as the sample text for `list-faces-display'.")
;; The name list-faces would be more consistent, but let's avoid a
face-attribute-name-alist)))))
(defun face-spec-set (face spec &optional for-defface)
- "Set FACE's face spec, which controls its appearance, to SPEC.
-If FOR-DEFFACE is t, set the base spec, the one that `defface'
- and Custom set. (In that case, the caller must put it in the
- appropriate property, because that depends on the caller.)
-If FOR-DEFFACE is nil, set the overriding spec (and store it
- in the `face-override-spec' property of FACE).
-
-The appearance of FACE is controlled by the base spec,
-by any custom theme specs on top of that, and by the
-overriding spec on top of all the rest.
-
-FOR-DEFFACE can also be a frame, in which case we set the
-frame-specific attributes of FACE for that frame based on SPEC.
-That usage is deprecated.
-
-See `defface' for information about the format and meaning of SPEC."
- (if (framep for-defface)
- ;; Handle the deprecated case where third arg is a frame.
- (face-spec-set-2 face for-defface spec)
- (if for-defface
- ;; When we reset the face based on its custom spec, then it is
- ;; unmodified as far as Custom is concerned.
- (put (or (get face 'face-alias) face) 'face-modified nil)
- ;; When we change a face based on a spec from outside custom,
- ;; record it for future frames.
- (put (or (get face 'face-alias) face) 'face-override-spec spec))
- ;; Reset each frame according to the rules implied by all its specs.
- (dolist (frame (frame-list))
- (face-spec-recalc face frame))))
+ "Set and apply the face spec for FACE.
+If the optional argument FOR-DEFFACE is omitted or nil, set the
+overriding spec to SPEC, recording it in the `face-override-spec'
+property of FACE. See `defface' for the format of SPEC.
+
+If FOR-DEFFACE is non-nil, set the base spec (the one set by
+`defface' and Custom). In this case, SPEC is ignored; the caller
+is responsible for putting the face spec in the `saved-face',
+`customized-face', or `face-defface-spec', as appropriate.
+
+The appearance of FACE is controlled by the base spec, by any
+custom theme specs on top of that, and by the overriding spec on
+top of all the rest."
+ (if for-defface
+ ;; When we reset the face based on its custom spec, then it is
+ ;; unmodified as far as Custom is concerned.
+ (put (or (get face 'face-alias) face) 'face-modified nil)
+ ;; When we change a face based on a spec from outside custom,
+ ;; record it for future frames.
+ (put (or (get face 'face-alias) face) 'face-override-spec spec))
+ ;; Reset each frame according to the rules implied by all its specs.
+ (dolist (frame (frame-list))
+ (face-spec-recalc face frame)))
(defun face-spec-recalc (face frame)
"Reset the face attributes of FACE on FRAME according to its specs.
:group 'basic-faces)
(defface error
- '((((class color) (min-colors 88) (background light)) (:foreground "Red1" :weight bold))
- (((class color) (min-colors 88) (background dark)) (:foreground "Pink" :weight bold))
- (((class color) (min-colors 16) (background light)) (:foreground "Red1" :weight bold))
- (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :weight bold))
- (((class color) (min-colors 8)) (:foreground "red"))
- (t (:inverse-video t :weight bold)))
+ '((default :weight bold)
+ (((class color) (min-colors 88) (background light)) :foreground "Red1")
+ (((class color) (min-colors 88) (background dark)) :foreground "Pink")
+ (((class color) (min-colors 16) (background light)) :foreground "Red1")
+ (((class color) (min-colors 16) (background dark)) :foreground "Pink")
+ (((class color) (min-colors 8)) :foreground "red")
+ (t :inverse-video t))
"Basic face used to highlight errors and to denote failure."
:version "24.1"
:group 'basic-faces)
(defface warning
- '((((class color) (min-colors 16)) (:foreground "DarkOrange" :weight bold))
- (((class color)) (:foreground "yellow" :weight bold))
- (t (:weight bold)))
+ '((default :weight bold)
+ (((class color) (min-colors 16)) :foreground "DarkOrange")
+ (((class color)) :foreground "yellow"))
"Basic face used to highlight warnings."
:version "24.1"
:group 'basic-faces)
(defface success
- '((((class color) (min-colors 16) (background light))
- (:foreground "ForestGreen" :weight bold))
- (((class color) (min-colors 88) (background dark))
- (:foreground "Green1" :weight bold))
- (((class color) (min-colors 16) (background dark))
- (:foreground "Green" :weight bold))
- (((class color)) (:foreground "green" :weight bold))
- (t (:weight bold)))
+ '((default :weight bold)
+ (((class color) (min-colors 16) (background light)) :foreground "ForestGreen")
+ (((class color) (min-colors 88) (background dark)) :foreground "Green1")
+ (((class color) (min-colors 16) (background dark)) :foreground "Green")
+ (((class color)) :foreground "green"))
"Basic face used to indicate successful operation."
:version "24.1"
:group 'basic-faces)