1999-07-21 21:43:52 +00:00
|
|
|
|
;;; faces.el --- Lisp faces
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2005-08-06 22:13:43 +00:00
|
|
|
|
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
2008-01-07 02:45:14 +00:00
|
|
|
|
;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2001-08-06 10:12:17 +00:00
|
|
|
|
;; Maintainer: FSF
|
2002-05-02 05:41:46 +00:00
|
|
|
|
;; Keywords: internal
|
2001-08-06 10:12:17 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2007-07-25 04:50:21 +00:00
|
|
|
|
;; the Free Software Foundation; either version 3, or (at your option)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
;; any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
2005-07-04 23:32:44 +00:00
|
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
1994-12-04 16:51:38 +00:00
|
|
|
|
(eval-when-compile
|
2008-03-14 17:42:18 +00:00
|
|
|
|
(require 'cl))
|
|
|
|
|
|
|
|
|
|
(declare-function xw-defined-colors "term/x-win" (&optional frame))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2005-08-31 13:48:58 +00:00
|
|
|
|
(defvar help-xref-stack-item)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Font selection.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defgroup font-selection nil
|
|
|
|
|
"Influencing face font selection."
|
|
|
|
|
:group 'faces)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom face-font-selection-order
|
|
|
|
|
'(:width :height :weight :slant)
|
|
|
|
|
"*A list specifying how face font selection chooses fonts.
|
|
|
|
|
Each of the four symbols `:width', `:height', `:weight', and `:slant'
|
|
|
|
|
must appear once in the list, and the list must not contain any other
|
2007-10-10 20:18:20 +00:00
|
|
|
|
elements. Font selection first tries to find a best matching font
|
2007-10-09 11:48:08 +00:00
|
|
|
|
for those face attributes that appear before in the list. For
|
1999-07-21 21:43:52 +00:00
|
|
|
|
example, if `:slant' appears before `:height', font selection first
|
|
|
|
|
tries to find a font with a suitable slant, even if this results in
|
|
|
|
|
a font height that isn't optimal."
|
2002-12-07 20:57:53 +00:00
|
|
|
|
:tag "Font selection order"
|
2000-07-18 19:07:15 +00:00
|
|
|
|
:type '(list symbol symbol symbol symbol)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'font-selection
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(internal-set-font-selection-order value)))
|
|
|
|
|
|
2000-11-10 14:34:23 +00:00
|
|
|
|
|
|
|
|
|
;; This is defined originally in xfaces.c.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defcustom face-font-family-alternatives
|
|
|
|
|
'(("courier" "fixed")
|
2000-02-27 21:13:00 +00:00
|
|
|
|
("helv" "helvetica" "arial" "fixed"))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"*Alist of alternative font family names.
|
2002-01-13 09:56:13 +00:00
|
|
|
|
Each element has the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...).
|
1999-07-21 21:43:52 +00:00
|
|
|
|
If fonts of family FAMILY can't be loaded, try ALTERNATIVE1, then
|
|
|
|
|
ALTERNATIVE2 etc."
|
2002-12-07 20:57:53 +00:00
|
|
|
|
:tag "Alternative font families to try"
|
2000-07-18 19:07:15 +00:00
|
|
|
|
:type '(repeat (repeat string))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'font-selection
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(internal-set-alternative-font-family-alist value)))
|
|
|
|
|
|
|
|
|
|
|
2000-11-10 14:34:23 +00:00
|
|
|
|
;; This is defined originally in xfaces.c.
|
|
|
|
|
(defcustom face-font-registry-alternatives
|
2001-10-04 17:14:53 +00:00
|
|
|
|
(if (eq system-type 'windows-nt)
|
2002-01-26 00:03:28 +00:00
|
|
|
|
'(("iso8859-1" "ms-oemlatin")
|
2006-11-27 04:36:00 +00:00
|
|
|
|
("gb2312.1980" "gb2312" "gbk" "gb18030")
|
2001-10-04 17:14:53 +00:00
|
|
|
|
("jisx0208.1990" "jisx0208.1983" "jisx0208.1978")
|
|
|
|
|
("ksc5601.1989" "ksx1001.1992" "ksc5601.1987")
|
|
|
|
|
("muletibetan-2" "muletibetan-0"))
|
2006-11-27 04:36:00 +00:00
|
|
|
|
'(("gb2312.1980" "gb2312.80&gb8565.88" "gbk" "gb18030")
|
2001-10-04 17:14:53 +00:00
|
|
|
|
("jisx0208.1990" "jisx0208.1983" "jisx0208.1978")
|
|
|
|
|
("ksc5601.1989" "ksx1001.1992" "ksc5601.1987")
|
|
|
|
|
("muletibetan-2" "muletibetan-0")))
|
2000-11-10 14:34:23 +00:00
|
|
|
|
"*Alist of alternative font registry names.
|
2002-01-13 09:56:13 +00:00
|
|
|
|
Each element has the form (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...).
|
2000-12-04 06:27:16 +00:00
|
|
|
|
If fonts of registry REGISTRY can be loaded, font selection
|
|
|
|
|
tries to find a best matching font among all fonts of registry
|
|
|
|
|
REGISTRY, ALTERNATIVE1, ALTERNATIVE2, and etc."
|
2002-12-07 20:57:53 +00:00
|
|
|
|
:tag "Alternative font registries to try"
|
2000-11-10 14:34:23 +00:00
|
|
|
|
:type '(repeat (repeat string))
|
2000-11-12 00:38:44 +00:00
|
|
|
|
:version "21.1"
|
2000-11-10 14:34:23 +00:00
|
|
|
|
:group 'font-selection
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(internal-set-alternative-font-registry-alist value)))
|
|
|
|
|
|
|
|
|
|
|
2006-06-06 03:53:59 +00:00
|
|
|
|
(defcustom font-weight-table
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(if (eq system-type 'windows-nt)
|
|
|
|
|
'((thin . 100)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(ultralight . 199) (ultra-light . 200) (extra-light . 201)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(light . 300)
|
2008-02-22 23:37:23 +00:00
|
|
|
|
(semilight . 330) (semi-light . 331)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(book . 350)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(normal . 400) (regular . 401)
|
2008-02-22 23:37:23 +00:00
|
|
|
|
(medium . 500)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(semibold . 599) (semi-bold . 600) (demibold . 601) (demi . 602)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(bold . 700)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(extrabold . 799) (extra-bold . 800)
|
|
|
|
|
(ultrabold . 801) (ultra-bold . 802)
|
|
|
|
|
(black . 900) (heavy . 901))
|
2007-06-01 09:43:24 +00:00
|
|
|
|
'((thin . 0)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(ultralight . 39) (ultra-light . 40) (extra-light . 41)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(light . 50)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(semilight . 65) (semi-light . 66)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(book . 75)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(medium . 99) (regular . 100) (normal . 101)
|
|
|
|
|
(semibold . 179) (semi-bold . 180) (demibold . 181) (demi . 182)
|
2007-06-01 09:43:24 +00:00
|
|
|
|
(bold . 200)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(extrabold . 204) (extra-bold . 205)
|
|
|
|
|
(ultrabold . 206) (ultra-bold . 207)
|
|
|
|
|
(black . 210) (heavy . 211)))
|
2006-06-06 03:53:59 +00:00
|
|
|
|
"*Alist of font weight symbols vs the corresponding numeric values."
|
|
|
|
|
:tag "Font weight table"
|
|
|
|
|
:version "23.1"
|
|
|
|
|
:group 'font-selection
|
|
|
|
|
:type '(repeat (cons symbol integer))
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(if (fboundp 'internal-set-font-style-table)
|
|
|
|
|
(internal-set-font-style-table :weight value))))
|
|
|
|
|
|
|
|
|
|
(defcustom font-slant-table
|
|
|
|
|
'((ro . 0)
|
|
|
|
|
(ri . 10)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(r . 99) (roman . 100) (normal . 101)
|
|
|
|
|
(i . 199) (italic . 200) (ot . 201)
|
|
|
|
|
(o . 210) (oblique . 211))
|
2006-06-06 03:53:59 +00:00
|
|
|
|
"*Alist of font slant symbols vs the corresponding numeric values."
|
|
|
|
|
:tag "Font slant table"
|
|
|
|
|
:version "23.1"
|
|
|
|
|
:group 'font-selection
|
|
|
|
|
:type '(repeat (cons symbol integer))
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(if (fboundp 'internal-set-font-style-table)
|
|
|
|
|
(internal-set-font-style-table :slant value))))
|
|
|
|
|
|
|
|
|
|
(defcustom font-swidth-table
|
2008-02-22 19:03:06 +00:00
|
|
|
|
'((ultracondensed . 50) (ultra-condensed . 51)
|
|
|
|
|
(extracondensed . 63) (extra-condensed . 64)
|
|
|
|
|
(narrow . 74) (compressed . 75) (condensed . 76)
|
|
|
|
|
(semi-condensed . 87) (semicondensed . 88)
|
|
|
|
|
(medium . 99) (normal . 100) (regular . 101)
|
|
|
|
|
(semiexpanded . 112) (semi-expanded . 113) (demiexpanded . 114)
|
2006-06-06 03:53:59 +00:00
|
|
|
|
(expanded . 125)
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(extraexpanded . 150) (extra-expanded . 151)
|
|
|
|
|
(ultraexpanded . 199) (ultra-expanded . 200) (wide . 201))
|
2006-06-06 03:53:59 +00:00
|
|
|
|
"*Alist of font swidth symbols vs the corresponding numeric values."
|
|
|
|
|
:tag "Font swidth table"
|
|
|
|
|
:version "23.1"
|
|
|
|
|
:group 'font-selection
|
|
|
|
|
:type '(repeat (cons symbol integer))
|
|
|
|
|
:set #'(lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
(if (fboundp 'internal-set-font-style-table)
|
|
|
|
|
(internal-set-font-style-table :width value))))
|
1993-05-11 19:14:34 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Creation, copying.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-list ()
|
|
|
|
|
"Return a list of all defined face names."
|
|
|
|
|
(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."
|
|
|
|
|
(interactive "SMake face: ")
|
|
|
|
|
(unless (facep face)
|
|
|
|
|
;; Make frame-local faces (this also makes the global one).
|
|
|
|
|
(dolist (frame (frame-list))
|
|
|
|
|
(internal-make-lisp-face face frame))
|
|
|
|
|
;; Add the face to the face menu.
|
|
|
|
|
(when (fboundp 'facemenu-add-new-face)
|
|
|
|
|
(facemenu-add-new-face face))
|
|
|
|
|
;; Define frame-local faces for all frames from X resources.
|
|
|
|
|
(unless no-init-from-resources
|
|
|
|
|
(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."
|
|
|
|
|
(interactive "SMake empty face: ")
|
|
|
|
|
(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.
|
|
|
|
|
|
2002-09-06 07:14:29 +00:00
|
|
|
|
If the optional argument FRAME is given as a frame, NEW-FACE is
|
1999-07-21 21:43:52 +00:00
|
|
|
|
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
|
2007-12-23 18:09:10 +00:00
|
|
|
|
to NEW-FACE on frame NEW-FRAME. In this case, FRAME may not be nil."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let ((inhibit-quit t))
|
|
|
|
|
(if (null frame)
|
|
|
|
|
(progn
|
2007-12-23 18:09:10 +00:00
|
|
|
|
(when new-frame
|
|
|
|
|
(error "Copying face %s from all frames to one frame"
|
|
|
|
|
old-face))
|
|
|
|
|
(make-empty-face new-face)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(dolist (frame (frame-list))
|
|
|
|
|
(copy-face old-face new-face frame))
|
|
|
|
|
(copy-face old-face new-face t))
|
2007-12-23 18:09:10 +00:00
|
|
|
|
(make-empty-face new-face)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(internal-copy-lisp-face old-face new-face frame new-frame))
|
|
|
|
|
new-face))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Obsolete functions
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;; The functions in this section are defined because Lisp packages use
|
|
|
|
|
;; them, despite the prefix `internal-' suggesting that they are
|
2000-05-09 15:45:57 +00:00
|
|
|
|
;; private to the face implementation.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun internal-find-face (name &optional frame)
|
|
|
|
|
"Retrieve the face named NAME.
|
|
|
|
|
Return nil if there is no such face.
|
2007-02-01 00:39:02 +00:00
|
|
|
|
If NAME is already a face, it is simply returned.
|
|
|
|
|
The optional argument FRAME is ignored."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(facep name))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'internal-find-face 'facep "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun internal-get-face (name &optional frame)
|
|
|
|
|
"Retrieve the face named NAME; error if there is none.
|
2007-02-01 00:39:02 +00:00
|
|
|
|
If NAME is already a face, it is simply returned.
|
|
|
|
|
The optional argument FRAME is ignored."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(or (facep name)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(check-face name)))
|
2002-06-27 16:09:19 +00:00
|
|
|
|
(make-obsolete 'internal-get-face "see `facep' and `check-face'." "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Predicates, type checks.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defun facep (face)
|
2007-12-29 19:10:34 +00:00
|
|
|
|
"Return non-nil if FACE is a face name; nil otherwise.
|
|
|
|
|
A face name can be a string or a symbol."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(internal-lisp-face-p face))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun check-face (face)
|
|
|
|
|
"Signal an error if FACE doesn't name a face.
|
|
|
|
|
Value is FACE."
|
|
|
|
|
(unless (facep face)
|
|
|
|
|
(error "Not a face: %s" face))
|
|
|
|
|
face)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; The ID returned is not to be confused with the internally used IDs
|
|
|
|
|
;; of realized faces. The ID assigned to Lisp faces is used to
|
|
|
|
|
;; support faces in display table entries.
|
|
|
|
|
|
|
|
|
|
(defun face-id (face &optional frame)
|
2002-07-09 07:35:10 +00:00
|
|
|
|
"Return the internal ID of face with name FACE.
|
2007-06-05 10:13:03 +00:00
|
|
|
|
If FACE is a face-alias, return the ID of the target face.
|
2005-03-08 02:55:39 +00:00
|
|
|
|
The optional argument FRAME is ignored, since the internal face ID
|
|
|
|
|
of a face name is the same for all frames."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(check-face face)
|
2007-06-05 10:13:03 +00:00
|
|
|
|
(or (get face 'face)
|
|
|
|
|
(face-id (get face 'face-alias))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun face-equal (face1 face2 &optional frame)
|
|
|
|
|
"Non-nil if faces FACE1 and FACE2 are equal.
|
|
|
|
|
Faces are considered equal if all their attributes are equal.
|
2005-06-03 10:38:05 +00:00
|
|
|
|
If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame.
|
|
|
|
|
If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames).
|
1999-07-21 21:43:52 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame."
|
|
|
|
|
(internal-lisp-face-equal-p face1 face2 frame))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-differs-from-default-p (face &optional frame)
|
2004-06-04 02:50:50 +00:00
|
|
|
|
"Return non-nil if FACE displays differently from the default face.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
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).
|
2004-06-04 02:50:50 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame."
|
2004-06-04 10:12:53 +00:00
|
|
|
|
(let ((attrs
|
2007-12-30 16:26:54 +00:00
|
|
|
|
(delq :inherit (mapcar 'car face-attribute-name-alist)))
|
2004-06-04 10:12:53 +00:00
|
|
|
|
(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))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-nontrivial-p (face &optional frame)
|
|
|
|
|
"True if face FACE has some non-nil attribute.
|
|
|
|
|
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."
|
|
|
|
|
(not (internal-lisp-face-empty-p face frame)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Setting face attributes from X resources.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defcustom face-x-resources
|
|
|
|
|
'((:family (".attributeFamily" . "Face.AttributeFamily"))
|
|
|
|
|
(:width (".attributeWidth" . "Face.AttributeWidth"))
|
|
|
|
|
(:height (".attributeHeight" . "Face.AttributeHeight"))
|
|
|
|
|
(:weight (".attributeWeight" . "Face.AttributeWeight"))
|
|
|
|
|
(:slant (".attributeSlant" . "Face.AttributeSlant"))
|
|
|
|
|
(:foreground (".attributeForeground" . "Face.AttributeForeground"))
|
|
|
|
|
(:background (".attributeBackground" . "Face.AttributeBackground"))
|
|
|
|
|
(:overline (".attributeOverline" . "Face.AttributeOverline"))
|
|
|
|
|
(:strike-through (".attributeStrikeThrough" . "Face.AttributeStrikeThrough"))
|
|
|
|
|
(:box (".attributeBox" . "Face.AttributeBox"))
|
|
|
|
|
(:underline (".attributeUnderline" . "Face.AttributeUnderline"))
|
|
|
|
|
(:inverse-video (".attributeInverse" . "Face.AttributeInverse"))
|
|
|
|
|
(:stipple
|
|
|
|
|
(".attributeStipple" . "Face.AttributeStipple")
|
|
|
|
|
(".attributeBackgroundPixmap" . "Face.AttributeBackgroundPixmap"))
|
|
|
|
|
(:bold (".attributeBold" . "Face.AttributeBold"))
|
|
|
|
|
(:italic (".attributeItalic" . "Face.AttributeItalic"))
|
2000-08-26 11:50:06 +00:00
|
|
|
|
(:font (".attributeFont" . "Face.AttributeFont"))
|
|
|
|
|
(:inherit (".attributeInherit" . "Face.AttributeInherit")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"*List of X resources and classes for face attributes.
|
|
|
|
|
Each element has the form (ATTRIBUTE ENTRY1 ENTRY2...) where ATTRIBUTE is
|
|
|
|
|
the name of a face attribute, and each ENTRY is a cons of the form
|
2001-10-12 16:38:32 +00:00
|
|
|
|
\(RESOURCE . CLASS) with RESOURCE being the resource and CLASS being the
|
1999-07-21 21:43:52 +00:00
|
|
|
|
X resource class for the attribute."
|
2000-09-10 21:55:22 +00:00
|
|
|
|
:type '(repeat (cons symbol (repeat (cons string string))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'faces)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-attribute-from-resource (face attribute resource class frame)
|
|
|
|
|
"Set FACE's ATTRIBUTE from X resource RESOURCE, class CLASS on FRAME.
|
|
|
|
|
Value is the attribute value specified by the resource, or nil
|
|
|
|
|
if not present. This function displays a message if the resource
|
|
|
|
|
specifies an invalid attribute."
|
|
|
|
|
(let* ((face-name (face-name face))
|
|
|
|
|
(value (internal-face-x-get-resource (concat face-name resource)
|
|
|
|
|
class frame)))
|
|
|
|
|
(when value
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(internal-set-lisp-face-attribute-from-resource
|
|
|
|
|
face attribute (downcase value) frame)
|
|
|
|
|
(error
|
|
|
|
|
(message "Face %s, frame %s: invalid attribute %s %s from X resource"
|
|
|
|
|
face-name frame attribute value))))
|
|
|
|
|
value))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-attributes-from-resources (face frame)
|
|
|
|
|
"Set attributes of FACE from X resources for FRAME."
|
Initial check-in: changes for building Emacs under Mac OS.
2000-10-23 Andrew Choi <akochoi@i-cable.com>
* dispextern.h [macintosh]: Include macgui.h instead of macterm.h.
* dispnew.c [macintosh]: Include macterm.h.
(init_display) [macintosh]: initialization for window system.
* emacs.c (main) [macintosh]: Call syms_of_textprop,
syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm,
syms_of_search, x_term_init, and init_keyboard before calling
init_window_once. Also, call syms_of_xmenu.
* fontset.c (syms_of_fontset) [macintosh]: Set ASCII font of
default fontset to Monaco.
* frame.c [macintosh]: Include macterm.h. Remove declarations of
NewMacWindow and DisposeMacWindow.
(make_terminal_frame) [macintosh]: Call make_mac_terminal_frame
instead of calling NewMacWindow and setting fields of
f->output_data.mac directly. Call init_frame_faces.
(Fdelete_frame) [macintosh]: Remove unused code.
(Fmodify_frame_parameters) [macintosh]: Call
x_set_frame_parameters instead of mac_set_frame_parameters.
* frame.h [macintosh]: Define menu_bar_lines field in struct
frame. Define FRAME_EXTERNAL_MENU_BAR macro.
* keyboard.c [macintosh]: Include macterm.h.
(kbd_buffer_get_event) [macintosh]: Generate delete_window_event
and menu_bar_activate_event type events as for X and NT.
(make_lispy_event) [macintosh]: Construct lisp events of type
MENU_BAR_EVENT as for X and NT.
* sysdep.c [macintosh]: Remove declaration for sys_signal.
Include stdlib.h. Remove definition of Vx_bitmap_file_path.
(sys_subshell) [macintosh]: Remove definition entirely.
(init_sys_modes) [macintosh]: Do not initialize Vwindow_system and
Vwindow_system_version here. Remove initialization of
Vx_bitmap_file_path.
(read_input_waiting): Correct the number of parameters passed to
read_socket_hook.
Move all Macintosh functions to mac/mac.c.
* term.c [macintosh]: Include macterm.h.
* window.c [macintosh]: Include macterm.h.
* xdisp.c [macintosh]: Include macterm.h. Declare
set_frame_menubar and pending_menu_activation.
(echo_area_display) [macintosh]: Do not return if terminal frame
is the selected frame.
(update_menu_bar) [macintosh]: Check FRAME_EXTERNAL_MENU_BAR (f).
Allow only the selected frame to set menu bar.
(redisplay_window) [macintosh]: Obtain menu bar to redisplay by
calling FRAME_EXTERNAL_MENU_BAR (f).
(display_menu_bar) [macintosh]: Check FRAME_MAC_P (f).
* xfaces.c [macintosh]: Include macterm.h. Define x_display_info
and check_x. Declare XCreateGC. Define x_create_gc and
x_free_gc. Initialize font_sort_order.
(x_face_list_fonts) [macintosh]: Use the same code as WINDOWSNT,
but call x_list_fonts instead of w32_list_fonts.
(Finternal_face_x_get_resource) [macintosh]: Do not call
display_x_get_resource.
(prepare_face_for_display) [macintosh]: Set xgcv.font.
(realize_x_face) [macintosh]: Load the font if it is specified in
ATTRS.
(syms_of_xfaces) [macintosh]: Initialize Vscalable_fonts_allowed
to Qt.
* cus-edit.el (custom-button-face): Use 3D look for mac.
(custom-button-pressed-face): Likewise.
* faces.el (set-face-attributes-from-resources): Handle mac frames
in the same way as x and w32 frames.
(face-valid-attribute-values): Likewise.
(read-face-attribute): Likewise.
(defined-colors): Likewise.
(color-defined-p): Likewise.
(color-values): Likewise.
(display-grayscale-p): Likewise.
(face-set-after-frame-default): Likewise.
(mode-line): Same default face as for x and w32.
(tool-bar): Likewise.
* frame.el: Remove call to frame-notice-user-settings at end of
the file.
* info.el (Info-fontify-node): make underlines invisible for mac
as for x, pc, and w32 frame types.
* term/mac-win.el: New file.
2000-10-22 16:50:16 +00:00
|
|
|
|
(when (memq (framep frame) '(x w32 mac))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(dolist (definition face-x-resources)
|
|
|
|
|
(let ((attribute (car definition)))
|
|
|
|
|
(dolist (entry (cdr definition))
|
|
|
|
|
(set-face-attribute-from-resource face attribute (car entry)
|
|
|
|
|
(cdr entry) frame))))))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defun make-face-x-resource-internal (face &optional frame)
|
|
|
|
|
"Fill frame-local FACE on FRAME from X resources.
|
|
|
|
|
FRAME nil or not specified means do it for all frames."
|
|
|
|
|
(if (null frame)
|
|
|
|
|
(dolist (frame (frame-list))
|
|
|
|
|
(set-face-attributes-from-resources face frame))
|
|
|
|
|
(set-face-attributes-from-resources face frame)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Retrieving face attributes.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
1994-12-04 14:18:45 +00:00
|
|
|
|
(defun face-name (face)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
"Return the name of face FACE."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(symbol-name (check-face face)))
|
|
|
|
|
|
|
|
|
|
|
2007-12-30 16:26:54 +00:00
|
|
|
|
(defun face-all-attributes (face &optional frame)
|
|
|
|
|
"Return an alist stating the attributes of FACE.
|
|
|
|
|
Each element of the result has the form (ATTR-NAME . ATTR-VALUE).
|
|
|
|
|
Normally the value describes the default attributes,
|
|
|
|
|
but if you specify FRAME, the value describes the attributes
|
|
|
|
|
of FACE on FRAME."
|
2007-12-31 15:02:34 +00:00
|
|
|
|
(mapcar (lambda (pair)
|
|
|
|
|
(let ((attr (car pair)))
|
|
|
|
|
(cons attr (face-attribute face attr (or frame t)))))
|
2007-12-30 16:26:54 +00:00
|
|
|
|
face-attribute-name-alist))
|
|
|
|
|
|
2001-10-28 10:19:33 +00:00
|
|
|
|
(defun face-attribute (face attribute &optional frame inherit)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Return the value of FACE's ATTRIBUTE on 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).
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If INHERIT is nil, only attributes directly defined by FACE are considered,
|
|
|
|
|
so the return value may be `unspecified', or a relative value.
|
|
|
|
|
If INHERIT is non-nil, FACE's definition of ATTRIBUTE is merged with the
|
|
|
|
|
faces specified by its `:inherit' attribute; however the return value
|
|
|
|
|
may still be `unspecified' or relative.
|
|
|
|
|
If INHERIT is a face or a list of faces, then the result is further merged
|
|
|
|
|
with that face (or faces), until it becomes specified and absolute.
|
|
|
|
|
|
|
|
|
|
To ensure that the return value is always specified and absolute, use a
|
|
|
|
|
value of `default' for INHERIT; this will resolve any unspecified or
|
|
|
|
|
relative values by merging with the `default' face (which is always
|
|
|
|
|
completely specified)."
|
|
|
|
|
(let ((value (internal-get-lisp-face-attribute face attribute frame)))
|
|
|
|
|
(when (and inherit (face-attribute-relative-p attribute value))
|
|
|
|
|
;; VALUE is relative, so merge with inherited faces
|
|
|
|
|
(let ((inh-from (face-attribute face :inherit frame)))
|
|
|
|
|
(unless (or (null inh-from) (eq inh-from 'unspecified))
|
2005-11-01 07:19:07 +00:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(setq value
|
|
|
|
|
(face-attribute-merged-with attribute value inh-from frame))
|
|
|
|
|
;; The `inherit' attribute may point to non existent faces.
|
|
|
|
|
(error nil)))))
|
2001-10-28 10:19:33 +00:00
|
|
|
|
(when (and inherit
|
|
|
|
|
(not (eq inherit t))
|
|
|
|
|
(face-attribute-relative-p attribute value))
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
;; We should merge with INHERIT as well
|
2001-10-28 10:19:33 +00:00
|
|
|
|
(setq value (face-attribute-merged-with attribute value inherit frame)))
|
|
|
|
|
value))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2001-10-28 10:19:33 +00:00
|
|
|
|
(defun face-attribute-merged-with (attribute value faces &optional frame)
|
|
|
|
|
"Merges ATTRIBUTE, initially VALUE, with faces from FACES until absolute.
|
|
|
|
|
FACES may be either a single face or a list of faces.
|
2005-07-20 15:38:50 +00:00
|
|
|
|
\[This is an internal function.]"
|
2001-10-28 10:19:33 +00:00
|
|
|
|
(cond ((not (face-attribute-relative-p attribute value))
|
|
|
|
|
value)
|
|
|
|
|
((null faces)
|
|
|
|
|
value)
|
|
|
|
|
((consp faces)
|
|
|
|
|
(face-attribute-merged-with
|
|
|
|
|
attribute
|
|
|
|
|
(face-attribute-merged-with attribute value (car faces) frame)
|
|
|
|
|
(cdr faces)
|
|
|
|
|
frame))
|
|
|
|
|
(t
|
|
|
|
|
(merge-face-attribute attribute
|
|
|
|
|
value
|
|
|
|
|
(face-attribute faces attribute frame t)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defmacro face-attribute-specified-or (value &rest body)
|
|
|
|
|
"Return VALUE, unless it's `unspecified', in which case evaluate BODY and return the result."
|
|
|
|
|
(let ((temp (make-symbol "value")))
|
|
|
|
|
`(let ((,temp ,value))
|
|
|
|
|
(if (not (eq ,temp 'unspecified))
|
|
|
|
|
,temp
|
|
|
|
|
,@body))))
|
|
|
|
|
|
|
|
|
|
(defun face-foreground (face &optional frame inherit)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Return the foreground color name of FACE, or nil if unspecified.
|
|
|
|
|
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).
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If INHERIT is nil, only a foreground color directly defined by FACE is
|
|
|
|
|
considered, so the return value may be nil.
|
|
|
|
|
If INHERIT is t, and FACE doesn't define a foreground color, then any
|
|
|
|
|
foreground color that FACE inherits through its `:inherit' attribute
|
|
|
|
|
is considered as well; however the return value may still be nil.
|
|
|
|
|
If INHERIT is a face or a list of faces, then it is used to try to
|
|
|
|
|
resolve an unspecified foreground color.
|
|
|
|
|
|
|
|
|
|
To ensure that a valid color is always returned, use a value of
|
|
|
|
|
`default' for INHERIT; this will resolve any unspecified values by
|
|
|
|
|
merging with the `default' face (which is always completely specified)."
|
|
|
|
|
(face-attribute-specified-or (face-attribute face :foreground frame inherit)
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defun face-background (face &optional frame inherit)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Return the background color name of FACE, or nil if unspecified.
|
|
|
|
|
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).
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If INHERIT is nil, only a background color directly defined by FACE is
|
|
|
|
|
considered, so the return value may be nil.
|
|
|
|
|
If INHERIT is t, and FACE doesn't define a background color, then any
|
|
|
|
|
background color that FACE inherits through its `:inherit' attribute
|
|
|
|
|
is considered as well; however the return value may still be nil.
|
|
|
|
|
If INHERIT is a face or a list of faces, then it is used to try to
|
|
|
|
|
resolve an unspecified background color.
|
|
|
|
|
|
|
|
|
|
To ensure that a valid color is always returned, use a value of
|
|
|
|
|
`default' for INHERIT; this will resolve any unspecified values by
|
|
|
|
|
merging with the `default' face (which is always completely specified)."
|
|
|
|
|
(face-attribute-specified-or (face-attribute face :background frame inherit)
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defun face-stipple (face &optional frame inherit)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Return the stipple pixmap name of FACE, or nil if unspecified.
|
|
|
|
|
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).
|
2001-10-28 10:19:33 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
|
|
|
|
|
|
|
|
|
If INHERIT is nil, only a stipple directly defined by FACE is
|
|
|
|
|
considered, so the return value may be nil.
|
|
|
|
|
If INHERIT is t, and FACE doesn't define a stipple, then any stipple
|
|
|
|
|
that FACE inherits through its `:inherit' attribute is considered as
|
|
|
|
|
well; however the return value may still be nil.
|
|
|
|
|
If INHERIT is a face or a list of faces, then it is used to try to
|
|
|
|
|
resolve an unspecified stipple.
|
|
|
|
|
|
|
|
|
|
To ensure that a valid stipple or nil is always returned, use a value of
|
|
|
|
|
`default' for INHERIT; this will resolve any unspecified values by merging
|
|
|
|
|
with the `default' face (which is always completely specified)."
|
|
|
|
|
(face-attribute-specified-or (face-attribute face :stipple frame inherit)
|
|
|
|
|
nil))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defalias 'face-background-pixmap 'face-stipple)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-underline-p (face &optional frame)
|
|
|
|
|
"Return non-nil if FACE is underlined.
|
|
|
|
|
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."
|
|
|
|
|
(eq (face-attribute face :underline frame) t))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-inverse-video-p (face &optional frame)
|
|
|
|
|
"Return non-nil if FACE is in inverse video on 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."
|
|
|
|
|
(eq (face-attribute face :inverse-video frame) t))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-bold-p (face &optional frame)
|
|
|
|
|
"Return non-nil if the font of FACE is bold on 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.
|
|
|
|
|
Use `face-attribute' for finer control."
|
|
|
|
|
(let ((bold (face-attribute face :weight frame)))
|
1999-09-06 15:57:48 +00:00
|
|
|
|
(memq bold '(semi-bold bold extra-bold ultra-bold))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-italic-p (face &optional frame)
|
|
|
|
|
"Return non-nil if the font of FACE is italic on 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.
|
|
|
|
|
Use `face-attribute' for finer control."
|
|
|
|
|
(let ((italic (face-attribute face :slant frame)))
|
1999-09-09 14:54:23 +00:00
|
|
|
|
(memq italic '(italic oblique))))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Face documentation.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defun face-documentation (face)
|
2005-06-22 14:20:18 +00:00
|
|
|
|
"Get the documentation string for FACE.
|
|
|
|
|
If FACE is a face-alias, get the documentation for the target face."
|
|
|
|
|
(let ((alias (get face 'face-alias))
|
|
|
|
|
doc)
|
|
|
|
|
(if alias
|
|
|
|
|
(progn
|
|
|
|
|
(setq doc (get alias 'face-documentation))
|
|
|
|
|
(format "%s is an alias for the face `%s'.%s" face alias
|
|
|
|
|
(if doc (format "\n%s" doc)
|
|
|
|
|
"")))
|
|
|
|
|
(get face 'face-documentation))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-documentation (face string)
|
|
|
|
|
"Set the documentation string for FACE to STRING."
|
1999-12-16 19:41:04 +00:00
|
|
|
|
;; Perhaps the text should go in DOC.
|
1999-11-30 13:55:34 +00:00
|
|
|
|
(put face 'face-documentation (purecopy string)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defalias 'face-doc-string 'face-documentation)
|
|
|
|
|
(defalias 'set-face-doc-string 'set-face-documentation)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; Setting face attributes.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
2005-10-24 00:10:02 +00:00
|
|
|
|
(defvar inhibit-face-set-after-frame-default nil
|
|
|
|
|
"If non-nil, that tells `face-set-after-frame-default' to do nothing.")
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defun set-face-attribute (face frame &rest args)
|
|
|
|
|
"Set attributes of FACE on FRAME from ARGS.
|
|
|
|
|
|
|
|
|
|
FRAME nil means change attributes on all frames. FRAME t means change
|
|
|
|
|
the default for new frames (this is done automatically each time an
|
|
|
|
|
attribute is changed on all frames).
|
|
|
|
|
|
|
|
|
|
ARGS must come in pairs ATTRIBUTE VALUE. ATTRIBUTE must be a valid
|
2005-11-20 15:24:27 +00:00
|
|
|
|
face attribute name. All attributes can be set to `unspecified';
|
1999-07-21 21:43:52 +00:00
|
|
|
|
this fact is not further mentioned below.
|
|
|
|
|
|
|
|
|
|
The following attributes are recognized:
|
|
|
|
|
|
|
|
|
|
`:family'
|
|
|
|
|
|
|
|
|
|
VALUE must be a string specifying the font family, e.g. ``courier'',
|
|
|
|
|
or a fontset alias name. If a font family is specified, wild-cards `*'
|
|
|
|
|
and `?' are allowed.
|
|
|
|
|
|
|
|
|
|
`:width'
|
|
|
|
|
|
|
|
|
|
VALUE specifies the relative proportionate width of the font to use.
|
|
|
|
|
It must be one of the symbols `ultra-condensed', `extra-condensed',
|
|
|
|
|
`condensed', `semi-condensed', `normal', `semi-expanded', `expanded',
|
|
|
|
|
`extra-expanded', or `ultra-expanded'.
|
|
|
|
|
|
|
|
|
|
`:height'
|
|
|
|
|
|
2000-08-26 10:59:51 +00:00
|
|
|
|
VALUE must be either an integer specifying the height of the font to use
|
|
|
|
|
in 1/10 pt, a floating point number specifying the amount by which to
|
|
|
|
|
scale any underlying face, or a function, which is called with the old
|
|
|
|
|
height (from the underlying face), and should return the new height.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
`:weight'
|
|
|
|
|
|
|
|
|
|
VALUE specifies the weight of the font to use. It must be one of the
|
|
|
|
|
symbols `ultra-bold', `extra-bold', `bold', `semi-bold', `normal',
|
|
|
|
|
`semi-light', `light', `extra-light', `ultra-light'.
|
|
|
|
|
|
|
|
|
|
`:slant'
|
|
|
|
|
|
|
|
|
|
VALUE specifies the slant of the font to use. It must be one of the
|
|
|
|
|
symbols `italic', `oblique', `normal', `reverse-italic', or
|
|
|
|
|
`reverse-oblique'.
|
|
|
|
|
|
|
|
|
|
`:foreground', `:background'
|
|
|
|
|
|
|
|
|
|
VALUE must be a color name, a string.
|
|
|
|
|
|
|
|
|
|
`: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.
|
|
|
|
|
|
|
|
|
|
`:overline'
|
|
|
|
|
|
|
|
|
|
VALUE specifies whether characters in FACE should be overlined. If
|
|
|
|
|
VALUE is t, overline with foreground color of the face. If VALUE is a
|
|
|
|
|
string, overline with that color. If VALUE is nil, explicitly don't
|
|
|
|
|
overline.
|
|
|
|
|
|
|
|
|
|
`:strike-through'
|
|
|
|
|
|
|
|
|
|
VALUE specifies whether characters in FACE should be drawn with a line
|
|
|
|
|
striking through them. If VALUE is t, use the foreground color of the
|
|
|
|
|
face. If VALUE is a string, strike-through with that color. If VALUE
|
|
|
|
|
is nil, explicitly don't strike through.
|
|
|
|
|
|
|
|
|
|
`:box'
|
|
|
|
|
|
|
|
|
|
VALUE specifies whether characters in FACE should have a box drawn
|
|
|
|
|
around them. If VALUE is nil, explicitly don't draw boxes. If
|
|
|
|
|
VALUE is t, draw a box with lines of width 1 in the foreground color
|
|
|
|
|
of the face. If VALUE is a string, the string must be a color name,
|
|
|
|
|
and the box is drawn in that color with a line width of 1. Otherwise,
|
|
|
|
|
VALUE must be a property list of the form `(:line-width WIDTH
|
|
|
|
|
:color COLOR :style STYLE)'. If a keyword/value pair is missing from
|
|
|
|
|
the property list, a default value will be used for the value, as
|
|
|
|
|
specified below. WIDTH specifies the width of the lines to draw; it
|
2001-02-09 12:35:36 +00:00
|
|
|
|
defaults to 1. If WIDTH is negative, the absolute value is the width
|
|
|
|
|
of the lines, and draw top/bottom lines inside the characters area,
|
|
|
|
|
not around it. COLOR is the name of the color to draw in, default is
|
1999-07-21 21:43:52 +00:00
|
|
|
|
the foreground color of the face for simple boxes, and the background
|
|
|
|
|
color of the face for 3D boxes. STYLE specifies whether a 3D box
|
|
|
|
|
should be draw. If STYLE is `released-button', draw a box looking
|
|
|
|
|
like a released 3D button. If STYLE is `pressed-button' draw a box
|
|
|
|
|
that appears like a pressed button. If STYLE is nil, the default if
|
|
|
|
|
the property list doesn't contain a style specification, draw a 2D
|
|
|
|
|
box.
|
|
|
|
|
|
|
|
|
|
`:inverse-video'
|
|
|
|
|
|
|
|
|
|
VALUE specifies whether characters in FACE should be displayed in
|
2000-05-09 15:45:57 +00:00
|
|
|
|
inverse video. VALUE must be one of t or nil.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
`:stipple'
|
|
|
|
|
|
|
|
|
|
If VALUE is a string, it must be the name of a file of pixmap data.
|
|
|
|
|
The directories listed in the `x-bitmap-file-path' variable are
|
|
|
|
|
searched. Alternatively, VALUE may be a list of the form (WIDTH
|
|
|
|
|
HEIGHT DATA) where WIDTH and HEIGHT are the size in pixels, and DATA
|
|
|
|
|
is a string containing the raw bits of the bitmap. VALUE nil means
|
|
|
|
|
explicitly don't use a stipple pattern.
|
|
|
|
|
|
|
|
|
|
For convenience, attributes `:family', `:width', `:height', `:weight',
|
|
|
|
|
and `:slant' may also be set in one step from an X font name:
|
|
|
|
|
|
|
|
|
|
`: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
|
2000-08-26 10:59:51 +00:00
|
|
|
|
must be t or nil in that case. A value of `unspecified' is not allowed.
|
|
|
|
|
|
|
|
|
|
`: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."
|
2000-09-07 09:50:30 +00:00
|
|
|
|
(let ((where (if (null frame) 0 frame)))
|
|
|
|
|
(setq args (purecopy args))
|
2003-05-28 11:17:33 +00:00
|
|
|
|
;; If we set the new-frame defaults, this face is modified outside Custom.
|
|
|
|
|
(if (memq where '(0 t))
|
2005-06-22 14:20:18 +00:00
|
|
|
|
(put (or (get face 'face-alias) face) 'face-modified t))
|
2000-09-07 09:50:30 +00:00
|
|
|
|
(while args
|
2005-10-24 00:10:02 +00:00
|
|
|
|
;; Don't recursively set the attributes from the frame's font param
|
|
|
|
|
;; when we update the frame's font param fro the attributes.
|
|
|
|
|
(let ((inhibit-face-set-after-frame-default t))
|
|
|
|
|
(internal-set-lisp-face-attribute face (car args)
|
|
|
|
|
(purecopy (cadr args))
|
|
|
|
|
where))
|
2000-09-07 09:50:30 +00:00
|
|
|
|
(setq args (cdr (cdr args))))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
1999-11-03 17:17:28 +00:00
|
|
|
|
(defun make-face-bold (face &optional frame noerror)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Make the font of FACE be bold, if possible.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
1999-11-03 17:17:28 +00:00
|
|
|
|
Argument NOERROR is ignored and retained for compatibility.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Use `set-face-attribute' for finer control of the font weight."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Make which face bold")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :weight 'bold))
|
|
|
|
|
|
|
|
|
|
|
1999-11-03 17:17:28 +00:00
|
|
|
|
(defun make-face-unbold (face &optional frame noerror)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Make the font of FACE be non-bold, if possible.
|
1999-11-03 17:17:28 +00:00
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Argument NOERROR is ignored and retained for compatibility."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Make which face non-bold")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :weight 'normal))
|
|
|
|
|
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
1999-11-03 17:17:28 +00:00
|
|
|
|
(defun make-face-italic (face &optional frame noerror)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Make the font of FACE be italic, if possible.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
1999-11-03 17:17:28 +00:00
|
|
|
|
Argument NOERROR is ignored and retained for compatibility.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Use `set-face-attribute' for finer control of the font slant."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Make which face italic")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :slant 'italic))
|
|
|
|
|
|
|
|
|
|
|
1999-11-03 17:17:28 +00:00
|
|
|
|
(defun make-face-unitalic (face &optional frame noerror)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Make the font of FACE be non-italic, if possible.
|
2000-05-09 15:45:57 +00:00
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Argument NOERROR is ignored and retained for compatibility."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Make which face non-italic")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :slant 'normal))
|
|
|
|
|
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
1999-11-03 17:17:28 +00:00
|
|
|
|
(defun make-face-bold-italic (face &optional frame noerror)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Make the font of FACE be bold and italic, if possible.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
1999-11-03 17:17:28 +00:00
|
|
|
|
Argument NOERROR is ignored and retained for compatibility.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Use `set-face-attribute' for finer control of font weight and slant."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Make which face bold-italic")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :weight 'bold :slant 'italic))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-font (face font &optional frame)
|
|
|
|
|
"Change font-related attributes of FACE to those of FONT (a string).
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
This sets the attributes `:family', `:width', `:height', `:weight',
|
|
|
|
|
and `:slant'. When called interactively, prompt for the face and font."
|
|
|
|
|
(interactive (read-face-and-attribute :font))
|
|
|
|
|
(set-face-attribute face frame :font font))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Implementation note: Emulating gray background colors with a
|
|
|
|
|
;; stipple pattern is now part of the face realization process, and is
|
|
|
|
|
;; done in C depending on the frame on which the face is realized.
|
|
|
|
|
|
|
|
|
|
(defun set-face-background (face color &optional frame)
|
|
|
|
|
"Change the background color of face FACE to COLOR (a string).
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
2005-01-01 14:21:37 +00:00
|
|
|
|
COLOR can be a system-defined color name (see `list-colors-display')
|
|
|
|
|
or a hex spec of the form #RRGGBB.
|
|
|
|
|
When called interactively, prompts for the face and color."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(interactive (read-face-and-attribute :background))
|
2001-02-13 02:03:58 +00:00
|
|
|
|
(set-face-attribute face frame :background (or color 'unspecified)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-foreground (face color &optional frame)
|
|
|
|
|
"Change the foreground color of face FACE to COLOR (a string).
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
2005-01-01 14:21:37 +00:00
|
|
|
|
COLOR can be a system-defined color name (see `list-colors-display')
|
|
|
|
|
or a hex spec of the form #RRGGBB.
|
|
|
|
|
When called interactively, prompts for the face and color."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(interactive (read-face-and-attribute :foreground))
|
2001-02-13 02:03:58 +00:00
|
|
|
|
(set-face-attribute face frame :foreground (or color 'unspecified)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-stipple (face stipple &optional frame)
|
|
|
|
|
"Change the stipple pixmap of face FACE to STIPPLE.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
2000-05-09 15:45:57 +00:00
|
|
|
|
STIPPLE should be a string, the name of a file of pixmap data.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
The directories listed in the `x-bitmap-file-path' variable are searched.
|
|
|
|
|
|
|
|
|
|
Alternatively, STIPPLE may be a list of the form (WIDTH HEIGHT DATA)
|
|
|
|
|
where WIDTH and HEIGHT are the size in pixels,
|
|
|
|
|
and DATA is a string, containing the raw bits of the bitmap."
|
|
|
|
|
(interactive (read-face-and-attribute :stipple))
|
2001-02-13 02:03:58 +00:00
|
|
|
|
(set-face-attribute face frame :stipple (or stipple 'unspecified)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
2007-02-01 16:30:13 +00:00
|
|
|
|
(defun set-face-underline-p (face underline &optional frame)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Specify whether face FACE is underlined.
|
|
|
|
|
UNDERLINE nil means FACE explicitly doesn't underline.
|
|
|
|
|
UNDERLINE non-nil means FACE explicitly does underlining
|
|
|
|
|
with the same of the foreground color.
|
|
|
|
|
If UNDERLINE is a string, underline with the color named UNDERLINE.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Use `set-face-attribute' to ``unspecify'' underlining."
|
|
|
|
|
(interactive
|
|
|
|
|
(let ((list (read-face-and-attribute :underline)))
|
|
|
|
|
(list (car list) (eq (car (cdr list)) t))))
|
2007-02-01 16:30:13 +00:00
|
|
|
|
(set-face-attribute face frame :underline underline))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2005-08-22 19:53:05 +00:00
|
|
|
|
(define-obsolete-function-alias 'set-face-underline
|
|
|
|
|
'set-face-underline-p "22.1")
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun set-face-inverse-video-p (face inverse-video-p &optional frame)
|
|
|
|
|
"Specify whether face FACE is in inverse video.
|
|
|
|
|
INVERSE-VIDEO-P non-nil means FACE displays explicitly in inverse video.
|
|
|
|
|
INVERSE-VIDEO-P nil means FACE explicitly is not in inverse video.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Use `set-face-attribute' to ``unspecify'' the inverse video attribute."
|
|
|
|
|
(interactive
|
|
|
|
|
(let ((list (read-face-and-attribute :inverse-video)))
|
|
|
|
|
(list (car list) (eq (car (cdr list)) t))))
|
|
|
|
|
(set-face-attribute face frame :inverse-video inverse-video-p))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-bold-p (face bold-p &optional frame)
|
|
|
|
|
"Specify whether face FACE is bold.
|
|
|
|
|
BOLD-P non-nil means FACE should explicitly display bold.
|
|
|
|
|
BOLD-P nil means FACE should explicitly display non-bold.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Use `set-face-attribute' or `modify-face' for finer control."
|
|
|
|
|
(if (null bold-p)
|
|
|
|
|
(make-face-unbold face frame)
|
|
|
|
|
(make-face-bold face frame)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun set-face-italic-p (face italic-p &optional frame)
|
|
|
|
|
"Specify whether face FACE is italic.
|
|
|
|
|
ITALIC-P non-nil means FACE should explicitly display italic.
|
|
|
|
|
ITALIC-P nil means FACE should explicitly display non-italic.
|
|
|
|
|
FRAME nil or not specified means change face on all frames.
|
|
|
|
|
Use `set-face-attribute' or `modify-face' for finer control."
|
|
|
|
|
(if (null italic-p)
|
|
|
|
|
(make-face-unitalic face frame)
|
|
|
|
|
(make-face-italic face frame)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defalias 'set-face-background-pixmap 'set-face-stipple)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun invert-face (face &optional frame)
|
|
|
|
|
"Swap the foreground and background colors of FACE.
|
2001-10-29 18:06:50 +00:00
|
|
|
|
If FRAME is omitted or nil, it means change face on all frames.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
If FACE specifies neither foreground nor background color,
|
|
|
|
|
set its foreground and background to the background and foreground
|
|
|
|
|
of the default face. Value is FACE."
|
2001-10-29 18:40:23 +00:00
|
|
|
|
(interactive (list (read-face-name "Invert face")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let ((fg (face-attribute face :foreground frame))
|
|
|
|
|
(bg (face-attribute face :background frame)))
|
2001-10-29 18:06:50 +00:00
|
|
|
|
(if (not (and (eq fg 'unspecified) (eq bg 'unspecified)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(set-face-attribute face frame :foreground bg :background fg)
|
|
|
|
|
(set-face-attribute face frame
|
|
|
|
|
:foreground
|
|
|
|
|
(face-attribute 'default :background frame)
|
|
|
|
|
:background
|
|
|
|
|
(face-attribute 'default :foreground frame))))
|
|
|
|
|
face)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Interactively modifying faces.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(defun read-face-name (prompt &optional string-describing-default multiple)
|
|
|
|
|
"Read a face, defaulting to the face or faces on the char after point.
|
2006-06-28 23:29:26 +00:00
|
|
|
|
If it has the property `read-face-name', that overrides the `face' property.
|
2006-07-03 15:53:33 +00:00
|
|
|
|
PROMPT should be a string that describes what the caller will do with the face;
|
|
|
|
|
it should not end in a space.
|
|
|
|
|
STRING-DESCRIBING-DEFAULT should describe what default the caller will use if
|
|
|
|
|
the user just types RET; you can omit it.
|
2002-04-26 22:31:16 +00:00
|
|
|
|
If MULTIPLE is non-nil, return a list of faces (possibly only one).
|
|
|
|
|
Otherwise, return a single face."
|
|
|
|
|
(let ((faceprop (or (get-char-property (point) 'read-face-name)
|
|
|
|
|
(get-char-property (point) 'face)))
|
2005-06-13 20:47:08 +00:00
|
|
|
|
(aliasfaces nil)
|
|
|
|
|
(nonaliasfaces nil)
|
2002-04-26 22:31:16 +00:00
|
|
|
|
faces)
|
2005-07-04 01:03:23 +00:00
|
|
|
|
;; Try to get a face name from the buffer.
|
|
|
|
|
(if (memq (intern-soft (thing-at-point 'symbol)) (face-list))
|
|
|
|
|
(setq faces (list (intern-soft (thing-at-point 'symbol)))))
|
|
|
|
|
;; Add the named faces that the `face' property uses.
|
2004-12-31 15:21:47 +00:00
|
|
|
|
(if (and (listp faceprop)
|
|
|
|
|
;; Don't treat an attribute spec as a list of faces.
|
|
|
|
|
(not (keywordp (car faceprop)))
|
|
|
|
|
(not (memq (car faceprop) '(foreground-color background-color))))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(dolist (f faceprop)
|
|
|
|
|
(if (symbolp f)
|
|
|
|
|
(push f faces)))
|
|
|
|
|
(if (symbolp faceprop)
|
2004-12-31 15:21:47 +00:00
|
|
|
|
(push faceprop faces)))
|
2005-08-04 01:06:44 +00:00
|
|
|
|
(delete-dups faces)
|
2002-04-26 22:31:16 +00:00
|
|
|
|
|
2005-06-13 20:47:08 +00:00
|
|
|
|
;; Build up the completion tables.
|
|
|
|
|
(mapatoms (lambda (s)
|
|
|
|
|
(if (custom-facep s)
|
|
|
|
|
(if (get s 'face-alias)
|
|
|
|
|
(push (symbol-name s) aliasfaces)
|
|
|
|
|
(push (symbol-name s) nonaliasfaces)))))
|
|
|
|
|
|
2002-04-26 22:31:16 +00:00
|
|
|
|
;; If we only want one, and the default is more than one,
|
|
|
|
|
;; discard the unwanted ones now.
|
|
|
|
|
(unless multiple
|
|
|
|
|
(if faces
|
|
|
|
|
(setq faces (list (car faces)))))
|
2005-07-04 01:03:23 +00:00
|
|
|
|
(require 'crm)
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(let* ((input
|
|
|
|
|
;; Read the input.
|
2005-07-04 01:03:23 +00:00
|
|
|
|
(completing-read-multiple
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(if (or faces string-describing-default)
|
|
|
|
|
(format "%s (default %s): " prompt
|
2005-07-04 01:03:23 +00:00
|
|
|
|
(if faces (mapconcat 'symbol-name faces ",")
|
2002-04-26 22:31:16 +00:00
|
|
|
|
string-describing-default))
|
2002-04-27 04:57:44 +00:00
|
|
|
|
(format "%s: " prompt))
|
2005-07-04 01:03:23 +00:00
|
|
|
|
(complete-in-turn nonaliasfaces aliasfaces)
|
|
|
|
|
nil t nil nil
|
|
|
|
|
(if faces (mapconcat 'symbol-name faces ","))))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
;; Canonicalize the output.
|
|
|
|
|
(output
|
2005-07-04 01:03:23 +00:00
|
|
|
|
(cond ((or (equal input "") (equal input '("")))
|
|
|
|
|
faces)
|
|
|
|
|
((stringp input)
|
|
|
|
|
(mapcar 'intern (split-string input ", *" t)))
|
|
|
|
|
((listp input)
|
|
|
|
|
(mapcar 'intern input))
|
|
|
|
|
(input))))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
;; Return either a list of faces or just one face.
|
|
|
|
|
(if multiple
|
|
|
|
|
output
|
|
|
|
|
(car output)))))
|
|
|
|
|
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defun face-valid-attribute-values (attribute &optional frame)
|
|
|
|
|
"Return valid values for face attribute ATTRIBUTE.
|
|
|
|
|
The optional argument FRAME is used to determine available fonts
|
|
|
|
|
and colors. If it is nil or not specified, the selected frame is
|
|
|
|
|
used. Value is an alist of (NAME . VALUE) if ATTRIBUTE expects a value
|
|
|
|
|
out of a set of discrete values. Value is `integerp' if ATTRIBUTE expects
|
|
|
|
|
an integer value."
|
2001-05-29 16:12:03 +00:00
|
|
|
|
(let ((valid
|
|
|
|
|
(case attribute
|
|
|
|
|
(:family
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(if (window-system frame)
|
2001-05-29 16:12:03 +00:00
|
|
|
|
(mapcar #'(lambda (x) (cons (car x) (car x)))
|
|
|
|
|
(x-font-family-list))
|
|
|
|
|
;; Only one font on TTYs.
|
|
|
|
|
(list (cons "default" "default"))))
|
|
|
|
|
((:width :weight :slant :inverse-video)
|
|
|
|
|
(mapcar #'(lambda (x) (cons (symbol-name x) x))
|
|
|
|
|
(internal-lisp-face-attribute-values attribute)))
|
|
|
|
|
((:underline :overline :strike-through :box)
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(if (window-system frame)
|
2001-05-29 16:12:03 +00:00
|
|
|
|
(nconc (mapcar #'(lambda (x) (cons (symbol-name x) x))
|
|
|
|
|
(internal-lisp-face-attribute-values attribute))
|
|
|
|
|
(mapcar #'(lambda (c) (cons c c))
|
2007-02-07 14:08:58 +00:00
|
|
|
|
(defined-colors frame)))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
(mapcar #'(lambda (x) (cons (symbol-name x) x))
|
|
|
|
|
(internal-lisp-face-attribute-values attribute))))
|
|
|
|
|
((:foreground :background)
|
|
|
|
|
(mapcar #'(lambda (c) (cons c c))
|
|
|
|
|
(defined-colors frame)))
|
|
|
|
|
((:height)
|
|
|
|
|
'integerp)
|
|
|
|
|
(:stipple
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(and (memq (window-system frame) '(x w32 mac))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
(mapcar #'list
|
|
|
|
|
(apply #'nconc
|
|
|
|
|
(mapcar (lambda (dir)
|
|
|
|
|
(and (file-readable-p dir)
|
|
|
|
|
(file-directory-p dir)
|
|
|
|
|
(directory-files dir)))
|
|
|
|
|
x-bitmap-file-path)))))
|
|
|
|
|
(:inherit
|
|
|
|
|
(cons '("none" . nil)
|
|
|
|
|
(mapcar #'(lambda (c) (cons (symbol-name c) c))
|
|
|
|
|
(face-list))))
|
|
|
|
|
(t
|
|
|
|
|
(error "Internal error")))))
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(if (and (listp valid) (not (memq attribute '(:inherit))))
|
1999-08-12 14:35:33 +00:00
|
|
|
|
(nconc (list (cons "unspecified" 'unspecified)) valid)
|
|
|
|
|
valid)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar face-attribute-name-alist
|
|
|
|
|
'((:family . "font family")
|
|
|
|
|
(:width . "character set width")
|
|
|
|
|
(:height . "height in 1/10 pt")
|
|
|
|
|
(:weight . "weight")
|
|
|
|
|
(:slant . "slant")
|
|
|
|
|
(:underline . "underline")
|
|
|
|
|
(:overline . "overline")
|
|
|
|
|
(:strike-through . "strike-through")
|
|
|
|
|
(:box . "box")
|
|
|
|
|
(:inverse-video . "inverse-video display")
|
|
|
|
|
(:foreground . "foreground color")
|
|
|
|
|
(:background . "background color")
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(:stipple . "background stipple")
|
|
|
|
|
(:inherit . "inheritance"))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"An alist of descriptive names for face attributes.
|
|
|
|
|
Each element has the form (ATTRIBUTE-NAME . DESCRIPTION) where
|
|
|
|
|
ATTRIBUTE-NAME is a face attribute name (a keyword symbol), and
|
|
|
|
|
DESCRIPTION is a descriptive name for ATTRIBUTE-NAME.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-descriptive-attribute-name (attribute)
|
|
|
|
|
"Return a descriptive name for ATTRIBUTE."
|
|
|
|
|
(cdr (assq attribute face-attribute-name-alist)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-read-string (face default name &optional completion-alist)
|
|
|
|
|
"Interactively read a face attribute string value.
|
2000-08-26 10:59:51 +00:00
|
|
|
|
FACE is the face whose attribute is read. If non-nil, DEFAULT is the
|
|
|
|
|
default string to return if no new value is entered. NAME is a
|
|
|
|
|
descriptive name of the attribute for prompting. COMPLETION-ALIST is an
|
|
|
|
|
alist of valid values, if non-nil.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2000-08-26 10:59:51 +00:00
|
|
|
|
Entering nothing accepts the default string DEFAULT.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Value is the new attribute value."
|
2000-08-26 10:59:51 +00:00
|
|
|
|
;; Capitalize NAME (we don't use `capitalize' because that capitalizes
|
|
|
|
|
;; each word in a string separately).
|
|
|
|
|
(setq name (concat (upcase (substring name 0 1)) (substring name 1)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let* ((completion-ignore-case t)
|
|
|
|
|
(value (completing-read
|
|
|
|
|
(if default
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(format "%s for face `%s' (default %s): "
|
|
|
|
|
name face default)
|
|
|
|
|
(format "%s for face `%s': " name face))
|
2005-11-17 07:20:51 +00:00
|
|
|
|
completion-alist nil nil nil nil default)))
|
1999-08-12 14:35:33 +00:00
|
|
|
|
(if (equal value "") default value)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-read-integer (face default name)
|
|
|
|
|
"Interactively read an integer face attribute value.
|
|
|
|
|
FACE is the face whose attribute is read. DEFAULT is the default
|
|
|
|
|
value to return if no new value is entered. NAME is a descriptive
|
|
|
|
|
name of the attribute for prompting. Value is the new attribute value."
|
1999-08-12 14:35:33 +00:00
|
|
|
|
(let ((new-value
|
|
|
|
|
(face-read-string face
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(format "%s" default)
|
1999-08-12 14:35:33 +00:00
|
|
|
|
name
|
|
|
|
|
(list (cons "unspecified" 'unspecified)))))
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(cond ((equal new-value "unspecified")
|
|
|
|
|
'unspecified)
|
|
|
|
|
((member new-value '("unspecified-fg" "unspecified-bg"))
|
|
|
|
|
new-value)
|
|
|
|
|
(t
|
2005-05-16 11:34:49 +00:00
|
|
|
|
(string-to-number new-value)))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun read-face-attribute (face attribute &optional frame)
|
|
|
|
|
"Interactively read a new value for FACE's ATTRIBUTE.
|
|
|
|
|
Optional argument FRAME nil or unspecified means read an attribute value
|
|
|
|
|
of a global face. Value is the new attribute value."
|
|
|
|
|
(let* ((old-value (face-attribute face attribute frame))
|
|
|
|
|
(attribute-name (face-descriptive-attribute-name attribute))
|
|
|
|
|
(valid (face-valid-attribute-values attribute frame))
|
|
|
|
|
new-value)
|
|
|
|
|
;; Represent complex attribute values as strings by printing them
|
|
|
|
|
;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be
|
|
|
|
|
;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow
|
|
|
|
|
;; SHADOW)'.
|
|
|
|
|
(when (and (or (eq attribute :stipple)
|
|
|
|
|
(eq attribute :box))
|
|
|
|
|
(or (consp old-value)
|
|
|
|
|
(vectorp old-value)))
|
|
|
|
|
(setq old-value (prin1-to-string old-value)))
|
|
|
|
|
(cond ((listp valid)
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(let ((default
|
|
|
|
|
(or (car (rassoc old-value valid))
|
|
|
|
|
(format "%s" old-value))))
|
|
|
|
|
(setq new-value
|
|
|
|
|
(face-read-string face default attribute-name valid))
|
|
|
|
|
(if (equal new-value default)
|
|
|
|
|
;; Nothing changed, so don't bother with all the stuff
|
|
|
|
|
;; below. In particular, this avoids a non-tty color
|
|
|
|
|
;; from being canonicalized for a tty when the user
|
|
|
|
|
;; just uses the default.
|
|
|
|
|
(setq new-value old-value)
|
|
|
|
|
;; Terminal frames can support colors that don't appear
|
|
|
|
|
;; explicitly in VALID, using color approximation code
|
|
|
|
|
;; in tty-colors.el.
|
2000-12-15 03:12:09 +00:00
|
|
|
|
(when (and (memq attribute '(:foreground :background))
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(not (memq (window-system frame) '(x w32 mac)))
|
2000-12-15 03:12:09 +00:00
|
|
|
|
(not (member new-value
|
|
|
|
|
'("unspecified"
|
|
|
|
|
"unspecified-fg" "unspecified-bg"))))
|
2000-12-15 03:18:26 +00:00
|
|
|
|
(setq new-value (car (tty-color-desc new-value frame))))
|
2000-12-15 03:12:09 +00:00
|
|
|
|
(when (assoc new-value valid)
|
|
|
|
|
(setq new-value (cdr (assoc new-value valid)))))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
((eq valid 'integerp)
|
|
|
|
|
(setq new-value (face-read-integer face old-value attribute-name)))
|
|
|
|
|
(t (error "Internal error")))
|
|
|
|
|
;; Convert stipple and box value text we read back to a list or
|
|
|
|
|
;; vector if it looks like one. This makes the assumption that a
|
|
|
|
|
;; pixmap file name won't start with an open-paren.
|
|
|
|
|
(when (and (or (eq attribute :stipple)
|
|
|
|
|
(eq attribute :box))
|
|
|
|
|
(stringp new-value)
|
|
|
|
|
(string-match "^[[(]" new-value))
|
|
|
|
|
(setq new-value (read new-value)))
|
|
|
|
|
new-value))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun read-face-font (face &optional frame)
|
|
|
|
|
"Read the name of a font for FACE on FRAME.
|
2005-07-20 15:38:50 +00:00
|
|
|
|
If optional argument FRAME is nil or omitted, use the selected frame."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let ((completion-ignore-case t))
|
2000-08-27 02:04:26 +00:00
|
|
|
|
(completing-read (format "Set font attributes of face `%s' from font: " face)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(append (fontset-list) (x-list-fonts "*" nil frame)))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun read-all-face-attributes (face &optional frame)
|
|
|
|
|
"Interactively read all attributes for FACE.
|
2005-07-20 15:38:50 +00:00
|
|
|
|
If optional argument FRAME is nil or omitted, use the selected frame.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Value is a property list of attribute names and new values."
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (attribute face-attribute-name-alist result)
|
|
|
|
|
(setq result (cons (car attribute)
|
|
|
|
|
(cons (read-face-attribute face (car attribute) frame)
|
|
|
|
|
result))))))
|
|
|
|
|
|
2001-04-25 15:22:53 +00:00
|
|
|
|
(defun modify-face (&optional face foreground background stipple
|
2007-02-01 16:30:13 +00:00
|
|
|
|
bold-p italic-p underline inverse-p frame)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Modify attributes of faces interactively.
|
|
|
|
|
If optional argument FRAME is nil or omitted, modify the face used
|
2001-04-25 15:22:53 +00:00
|
|
|
|
for newly created frame, i.e. the global face.
|
|
|
|
|
For non-interactive use, `set-face-attribute' is preferred.
|
2005-07-20 15:38:50 +00:00
|
|
|
|
When called from Lisp, if FACE is nil, all arguments but FRAME are ignored
|
2001-04-25 15:22:53 +00:00
|
|
|
|
and the face and its settings are obtained by querying the user."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(interactive)
|
2001-04-25 15:22:53 +00:00
|
|
|
|
(if face
|
|
|
|
|
(set-face-attribute face frame
|
|
|
|
|
:foreground (or foreground 'unspecified)
|
|
|
|
|
:background (or background 'unspecified)
|
|
|
|
|
:stipple stipple
|
|
|
|
|
:bold bold-p
|
|
|
|
|
:italic italic-p
|
2007-02-01 16:30:13 +00:00
|
|
|
|
:underline underline
|
2001-04-25 15:22:53 +00:00
|
|
|
|
:inverse-video inverse-p)
|
|
|
|
|
(setq face (read-face-name "Modify face"))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(apply #'set-face-attribute face frame
|
|
|
|
|
(read-all-face-attributes face frame))))
|
|
|
|
|
|
|
|
|
|
(defun read-face-and-attribute (attribute &optional frame)
|
|
|
|
|
"Read face name and face attribute value.
|
|
|
|
|
ATTRIBUTE is the attribute whose new value is read.
|
|
|
|
|
FRAME nil or unspecified means read attribute value of global face.
|
|
|
|
|
Value is a list (FACE NEW-VALUE) where FACE is the face read
|
2001-04-25 15:22:53 +00:00
|
|
|
|
\(a symbol), and NEW-VALUE is value read."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(cond ((eq attribute :font)
|
2000-08-27 02:04:26 +00:00
|
|
|
|
(let* ((prompt "Set font-related attributes of face")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(face (read-face-name prompt))
|
|
|
|
|
(font (read-face-font face frame)))
|
|
|
|
|
(list face font)))
|
|
|
|
|
(t
|
|
|
|
|
(let* ((attribute-name (face-descriptive-attribute-name attribute))
|
2000-08-26 10:59:51 +00:00
|
|
|
|
(prompt (format "Set %s of face" attribute-name))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(face (read-face-name prompt))
|
|
|
|
|
(new-value (read-face-attribute face attribute frame)))
|
|
|
|
|
(list face new-value)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Listing faces.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defvar list-faces-sample-text
|
|
|
|
|
"abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
|
"*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
|
|
|
|
|
;; conflict with Lucid, which uses that name differently.
|
|
|
|
|
|
2002-12-21 20:18:03 +00:00
|
|
|
|
(defvar help-xref-stack)
|
2005-02-03 06:47:16 +00:00
|
|
|
|
(defun list-faces-display (&optional regexp)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"List all faces, using the same sample text in each.
|
|
|
|
|
The sample text is a string that comes from the variable
|
2005-02-03 06:47:16 +00:00
|
|
|
|
`list-faces-sample-text'.
|
|
|
|
|
|
|
|
|
|
If REGEXP is non-nil, list only those faces with names matching
|
|
|
|
|
this regular expression. When called interactively with a prefix
|
|
|
|
|
arg, prompt for a regular expression."
|
|
|
|
|
(interactive (list (and current-prefix-arg
|
|
|
|
|
(read-string "List faces matching regexp: "))))
|
2005-06-01 10:43:54 +00:00
|
|
|
|
(let ((all-faces (zerop (length regexp)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(frame (selected-frame))
|
2005-06-01 10:43:54 +00:00
|
|
|
|
(max-length 0)
|
|
|
|
|
faces line-format
|
2000-02-16 22:58:42 +00:00
|
|
|
|
disp-frame window face-name)
|
2005-06-01 10:43:54 +00:00
|
|
|
|
;; We filter and take the max length in one pass
|
|
|
|
|
(setq faces
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar (lambda (f)
|
|
|
|
|
(let ((s (symbol-name f)))
|
|
|
|
|
(when (or all-faces (string-match regexp s))
|
|
|
|
|
(setq max-length (max (length s) max-length))
|
|
|
|
|
f)))
|
|
|
|
|
(sort (face-list) #'string-lessp))))
|
|
|
|
|
(unless faces
|
|
|
|
|
(error "No faces matching \"%s\"" regexp))
|
|
|
|
|
(setq max-length (1+ max-length)
|
|
|
|
|
line-format (format "%%-%ds" max-length))
|
2007-11-10 09:57:18 +00:00
|
|
|
|
(with-help-window "*Faces*"
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer standard-output)
|
|
|
|
|
(setq truncate-lines t)
|
2000-02-16 22:58:42 +00:00
|
|
|
|
(insert
|
|
|
|
|
(substitute-command-keys
|
|
|
|
|
(concat
|
|
|
|
|
"Use "
|
2000-02-17 14:01:20 +00:00
|
|
|
|
(if (display-mouse-p) "\\[help-follow-mouse] or ")
|
2000-02-23 20:39:38 +00:00
|
|
|
|
"\\[help-follow] on a face name to customize it\n"
|
2002-02-26 12:13:35 +00:00
|
|
|
|
"or on its sample text for a description of the face.\n\n")))
|
2000-02-16 22:58:42 +00:00
|
|
|
|
(setq help-xref-stack nil)
|
2005-02-03 06:47:16 +00:00
|
|
|
|
(dolist (face faces)
|
2000-02-16 22:58:42 +00:00
|
|
|
|
(setq face-name (symbol-name face))
|
2005-06-01 10:43:54 +00:00
|
|
|
|
(insert (format line-format face-name))
|
2000-02-16 22:58:42 +00:00
|
|
|
|
;; Hyperlink to a customization buffer for the face. Using
|
|
|
|
|
;; the help xref mechanism may not be the best way.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-match-data
|
|
|
|
|
(search-backward face-name)
|
2005-05-19 20:57:04 +00:00
|
|
|
|
(setq help-xref-stack-item `(list-faces-display ,regexp))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(help-xref-button 0 'help-customize-face face)))
|
|
|
|
|
(let ((beg (point))
|
|
|
|
|
(line-beg (line-beginning-position)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(insert list-faces-sample-text)
|
2000-02-16 22:58:42 +00:00
|
|
|
|
;; Hyperlink to a help buffer for the face.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-match-data
|
|
|
|
|
(search-backward list-faces-sample-text)
|
2001-10-12 01:53:58 +00:00
|
|
|
|
(help-xref-button 0 'help-face face)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(insert "\n")
|
|
|
|
|
(put-text-property beg (1- (point)) 'face face)
|
2002-04-26 22:31:16 +00:00
|
|
|
|
;; Make all face commands default to the proper face
|
|
|
|
|
;; anywhere in the line.
|
|
|
|
|
(put-text-property line-beg (1- (point)) 'read-face-name face)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;; If the sample text has multiple lines, line up all of them.
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(while (not (eobp))
|
2005-06-01 10:43:54 +00:00
|
|
|
|
(insert-char ?\s max-length)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(forward-line 1))))
|
2007-11-10 09:57:18 +00:00
|
|
|
|
(goto-char (point-min))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;; If the *Faces* buffer appears in a different frame,
|
|
|
|
|
;; copy all the face definitions from FRAME,
|
|
|
|
|
;; so that the display will reflect the frame that was selected.
|
|
|
|
|
(setq window (get-buffer-window (get-buffer "*Faces*") t))
|
|
|
|
|
(setq disp-frame (if window (window-frame window)
|
|
|
|
|
(car (frame-list))))
|
|
|
|
|
(or (eq frame disp-frame)
|
|
|
|
|
(let ((faces (face-list)))
|
|
|
|
|
(while faces
|
|
|
|
|
(copy-face (car faces) (car faces) frame disp-frame)
|
|
|
|
|
(setq faces (cdr faces)))))))
|
|
|
|
|
|
2005-02-03 06:47:16 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defun describe-face (face &optional frame)
|
|
|
|
|
"Display the properties of face FACE on FRAME.
|
2002-05-16 07:49:59 +00:00
|
|
|
|
Interactively, FACE defaults to the faces of the character after point
|
2002-04-26 22:31:16 +00:00
|
|
|
|
and FRAME defaults to the selected frame.
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
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."
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(interactive (list (read-face-name "Describe face" "= `default' face" t)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let* ((attrs '((:family . "Family")
|
|
|
|
|
(:width . "Width")
|
|
|
|
|
(:height . "Height")
|
|
|
|
|
(:weight . "Weight")
|
|
|
|
|
(:slant . "Slant")
|
|
|
|
|
(:foreground . "Foreground")
|
|
|
|
|
(:background . "Background")
|
|
|
|
|
(:underline . "Underline")
|
|
|
|
|
(:overline . "Overline")
|
|
|
|
|
(:strike-through . "Strike-through")
|
|
|
|
|
(:box . "Box")
|
|
|
|
|
(:inverse-video . "Inverse")
|
2000-03-21 00:31:38 +00:00
|
|
|
|
(:stipple . "Stipple")
|
2002-09-27 04:54:47 +00:00
|
|
|
|
(:font . "Font")
|
|
|
|
|
(:fontset . "Fontset")
|
2000-08-26 05:51:52 +00:00
|
|
|
|
(:inherit . "Inherit")))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
|
|
|
|
|
attrs))))
|
2001-10-12 16:38:32 +00:00
|
|
|
|
(help-setup-xref (list #'describe-face face) (interactive-p))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(unless face
|
|
|
|
|
(setq face 'default))
|
|
|
|
|
(if (not (listp face))
|
|
|
|
|
(setq face (list face)))
|
2007-11-10 09:57:18 +00:00
|
|
|
|
(with-help-window (help-buffer)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer standard-output)
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(dolist (f face)
|
2007-10-14 20:40:31 +00:00
|
|
|
|
(if (stringp f) (setq f (intern f)))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(insert "Face: " (symbol-name f))
|
|
|
|
|
(if (not (facep f))
|
|
|
|
|
(insert " undefined face.\n")
|
2005-05-16 03:31:11 +00:00
|
|
|
|
(let ((customize-label "customize this face")
|
|
|
|
|
file-name)
|
2006-11-04 11:02:27 +00:00
|
|
|
|
(insert (concat " (" (propertize "sample" 'font-lock-face f) ")"))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(princ (concat " (" customize-label ")\n"))
|
|
|
|
|
(insert "Documentation: "
|
|
|
|
|
(or (face-documentation f)
|
2002-06-27 07:14:52 +00:00
|
|
|
|
"Not documented as a face.")
|
2005-05-16 03:31:11 +00:00
|
|
|
|
"\n")
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
|
(save-excursion
|
|
|
|
|
(re-search-backward
|
|
|
|
|
(concat "\\(" customize-label "\\)") nil t)
|
|
|
|
|
(help-xref-button 1 'help-customize-face f)))
|
2005-05-16 03:31:11 +00:00
|
|
|
|
;; The next 4 sexps are copied from describe-function-1
|
|
|
|
|
;; and simplified.
|
|
|
|
|
(setq file-name (symbol-file f 'defface))
|
2005-10-23 19:12:50 +00:00
|
|
|
|
(setq file-name (describe-simplify-lib-file-name file-name))
|
2005-05-16 03:31:11 +00:00
|
|
|
|
(when file-name
|
|
|
|
|
(princ "Defined in `")
|
|
|
|
|
(princ file-name)
|
|
|
|
|
(princ "'")
|
|
|
|
|
;; Make a hyperlink to the library.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
|
(help-xref-button 1 'help-face-def f file-name))
|
|
|
|
|
(princ ".")
|
|
|
|
|
(terpri)
|
|
|
|
|
(terpri))
|
2002-04-26 22:31:16 +00:00
|
|
|
|
(dolist (a attrs)
|
|
|
|
|
(let ((attr (face-attribute f (car a) frame)))
|
2005-07-20 15:38:50 +00:00
|
|
|
|
(insert (make-string (- max-width (length (cdr a))) ?\s)
|
2005-08-22 19:53:05 +00:00
|
|
|
|
(cdr a) ": " (format "%s" attr))
|
|
|
|
|
(if (and (eq (car a) :inherit)
|
|
|
|
|
(not (eq attr 'unspecified)))
|
|
|
|
|
;; Make a hyperlink to the parent face.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(re-search-backward ": \\([^:]+\\)" nil t)
|
|
|
|
|
(help-xref-button 1 'help-face attr)))
|
|
|
|
|
(insert "\n")))))
|
2007-11-10 09:57:18 +00:00
|
|
|
|
(terpri))))))
|
2001-10-12 01:53:58 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Face specifications (defface).
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;; Parameter FRAME Is kept for call compatibility to with previous
|
|
|
|
|
;; face implementation.
|
|
|
|
|
|
|
|
|
|
(defun face-attr-construct (face &optional frame)
|
2005-07-20 15:38:50 +00:00
|
|
|
|
"Return a `defface'-style attribute list for FACE on FRAME.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Value is a property list of pairs ATTRIBUTE VALUE for all specified
|
|
|
|
|
face attributes of FACE where ATTRIBUTE is the attribute name and
|
|
|
|
|
VALUE is the specified value of that attribute."
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (entry face-attribute-name-alist result)
|
|
|
|
|
(let* ((attribute (car entry))
|
|
|
|
|
(value (face-attribute face attribute)))
|
|
|
|
|
(unless (eq value 'unspecified)
|
|
|
|
|
(setq result (nconc (list attribute value) result)))))))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun face-spec-set-match-display (display frame)
|
|
|
|
|
"Non-nil if DISPLAY matches FRAME.
|
|
|
|
|
DISPLAY is part of a spec such as can be used in `defface'.
|
|
|
|
|
If FRAME is nil, the current FRAME is used."
|
|
|
|
|
(let* ((conjuncts display)
|
|
|
|
|
conjunct req options
|
|
|
|
|
;; t means we have succeeded against all the conjuncts in
|
|
|
|
|
;; DISPLAY that have been tested so far.
|
|
|
|
|
(match t))
|
|
|
|
|
(if (eq conjuncts t)
|
|
|
|
|
(setq conjuncts nil))
|
|
|
|
|
(while (and conjuncts match)
|
|
|
|
|
(setq conjunct (car conjuncts)
|
|
|
|
|
conjuncts (cdr conjuncts)
|
|
|
|
|
req (car conjunct)
|
|
|
|
|
options (cdr conjunct)
|
|
|
|
|
match (cond ((eq req 'type)
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(or (memq (window-system frame) options)
|
2000-11-13 15:03:35 +00:00
|
|
|
|
;; 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.
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(and (null (window-system frame))
|
2000-11-13 15:03:35 +00:00
|
|
|
|
(memq 'tty options))
|
1999-10-06 23:32:26 +00:00
|
|
|
|
(and (memq 'motif options)
|
|
|
|
|
(featurep 'motif))
|
2004-05-12 09:23:02 +00:00
|
|
|
|
(and (memq 'gtk options)
|
|
|
|
|
(featurep 'gtk))
|
1999-10-06 23:32:26 +00:00
|
|
|
|
(and (memq 'lucid options)
|
|
|
|
|
(featurep 'x-toolkit)
|
2004-05-12 09:23:02 +00:00
|
|
|
|
(not (featurep 'motif))
|
|
|
|
|
(not (featurep 'gtk)))
|
1999-10-06 23:32:26 +00:00
|
|
|
|
(and (memq 'x-toolkit options)
|
|
|
|
|
(featurep 'x-toolkit))))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
((eq req 'min-colors)
|
|
|
|
|
(>= (display-color-cells frame) (car options)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
((eq req 'class)
|
|
|
|
|
(memq (frame-parameter frame 'display-type) options))
|
|
|
|
|
((eq req 'background)
|
|
|
|
|
(memq (frame-parameter frame 'background-mode)
|
|
|
|
|
options))
|
2002-06-10 02:15:24 +00:00
|
|
|
|
((eq req 'supports)
|
|
|
|
|
(display-supports-face-attributes-p options frame))
|
2000-05-09 15:45:57 +00:00
|
|
|
|
(t (error "Unknown req `%S' with options `%S'"
|
1999-07-21 21:43:52 +00:00
|
|
|
|
req options)))))
|
|
|
|
|
match))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-spec-choose (spec &optional frame)
|
2000-10-23 05:32:59 +00:00
|
|
|
|
"Choose the proper attributes for FRAME, out of SPEC.
|
|
|
|
|
If SPEC is nil, return nil."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(unless frame
|
|
|
|
|
(setq frame (selected-frame)))
|
|
|
|
|
(let ((tail spec)
|
2004-12-13 19:29:33 +00:00
|
|
|
|
result defaults)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(while tail
|
2000-10-27 01:46:13 +00:00
|
|
|
|
(let* ((entry (pop tail))
|
|
|
|
|
(display (car entry))
|
2004-12-13 19:29:33 +00:00
|
|
|
|
(attrs (cdr entry))
|
|
|
|
|
thisval)
|
|
|
|
|
;; Get the attributes as actually specified by this alternative.
|
|
|
|
|
(setq thisval
|
|
|
|
|
(if (null (cdr attrs)) ;; was (listp (car attrs))
|
|
|
|
|
;; Old-style entry, the attribute list is the
|
|
|
|
|
;; first element.
|
|
|
|
|
(car attrs)
|
|
|
|
|
attrs))
|
|
|
|
|
|
|
|
|
|
;; If the condition is `default', that sets the default
|
|
|
|
|
;; for following conditions.
|
|
|
|
|
(if (eq display 'default)
|
|
|
|
|
(setq defaults thisval)
|
|
|
|
|
;; Otherwise, if it matches, use it.
|
|
|
|
|
(when (face-spec-set-match-display display frame)
|
|
|
|
|
(setq result thisval)
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
(setq tail nil)))))
|
2004-12-13 19:29:33 +00:00
|
|
|
|
(if defaults (append result defaults) result)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun face-spec-reset-face (face &optional frame)
|
|
|
|
|
"Reset all attributes of FACE on FRAME to unspecified."
|
2000-09-05 15:54:58 +00:00
|
|
|
|
(let ((attrs face-attribute-name-alist))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(while attrs
|
|
|
|
|
(let ((attr-and-name (car attrs)))
|
2000-09-05 15:54:58 +00:00
|
|
|
|
(set-face-attribute face frame (car attr-and-name) 'unspecified))
|
|
|
|
|
(setq attrs (cdr attrs)))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
2007-12-30 03:32:34 +00:00
|
|
|
|
(defun face-spec-set (face spec &optional for-defface)
|
2008-03-03 11:43:21 +00:00
|
|
|
|
"Set FACE's face spec, which controls its appearance, to SPEC.
|
2007-12-30 03:32:34 +00:00
|
|
|
|
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
|
2008-03-03 11:43:21 +00:00
|
|
|
|
overriding spec on top of all the rest.
|
2007-12-30 03:32:34 +00:00
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
;;; RMS 29 dec 2007: Perhaps this code should be reinstated.
|
|
|
|
|
;;; That depends on whether the overriding spec
|
|
|
|
|
;;; or the default face attributes
|
|
|
|
|
;;; should take priority.
|
|
|
|
|
;;; ;; Clear all the new-frame default attributes for this face.
|
2007-10-29 13:54:00 +00:00
|
|
|
|
;;; ;; face-spec-reset-face won't do it right.
|
|
|
|
|
;;; (let ((facevec (cdr (assq face face-new-frame-defaults))))
|
|
|
|
|
;;; (dotimes (i (length facevec))
|
|
|
|
|
;;; (unless (= i 0)
|
|
|
|
|
;;; (aset facevec i 'unspecified))))
|
2007-12-30 03:32:34 +00:00
|
|
|
|
;; Reset each frame according to the rules implied by all its specs.
|
2007-09-17 02:13:51 +00:00
|
|
|
|
(dolist (frame (frame-list))
|
2007-12-30 03:32:34 +00:00
|
|
|
|
(face-spec-recalc face frame))))
|
|
|
|
|
|
|
|
|
|
(defun face-spec-recalc (face frame)
|
|
|
|
|
"Reset the face attributes of FACE on FRAME according to its specs.
|
|
|
|
|
This applies the defface/custom spec first, then the custom theme specs,
|
|
|
|
|
then the override spec."
|
|
|
|
|
(face-spec-reset-face face frame)
|
|
|
|
|
(let ((face-sym (or (get face 'face-alias) face)))
|
|
|
|
|
(face-spec-set-2 face frame
|
|
|
|
|
(face-user-default-spec face))
|
|
|
|
|
(let ((theme-faces (reverse (get face-sym 'theme-face))))
|
|
|
|
|
(dolist (spec theme-faces)
|
|
|
|
|
(face-spec-set-2 face frame (cadr spec))))
|
|
|
|
|
(face-spec-set-2 face frame (get face-sym 'face-override-spec))))
|
|
|
|
|
|
|
|
|
|
(defun face-spec-set-2 (face frame spec)
|
|
|
|
|
"Set the face attributes of FACE on FRAME according to SPEC."
|
|
|
|
|
(let* ((attrs (face-spec-choose spec frame)))
|
|
|
|
|
(while attrs
|
|
|
|
|
(let ((attribute (car attrs))
|
|
|
|
|
(value (car (cdr attrs))))
|
|
|
|
|
;; Support some old-style attribute names and values.
|
|
|
|
|
(case attribute
|
|
|
|
|
(:bold (setq attribute :weight value (if value 'bold 'normal)))
|
|
|
|
|
(:italic (setq attribute :slant value (if value 'italic 'normal)))
|
|
|
|
|
((:foreground :background)
|
|
|
|
|
;; Compatibility with 20.x. Some bogus face specs seem to
|
|
|
|
|
;; exist containing things like `:foreground nil'.
|
|
|
|
|
(if (null value) (setq value 'unspecified)))
|
|
|
|
|
(t (unless (assq attribute face-x-resources)
|
|
|
|
|
(setq attribute nil))))
|
|
|
|
|
(when attribute
|
|
|
|
|
(set-face-attribute face frame attribute value)))
|
|
|
|
|
(setq attrs (cdr (cdr attrs))))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun face-attr-match-p (face attrs &optional frame)
|
2000-08-20 12:02:24 +00:00
|
|
|
|
"Return t if attributes of FACE match values in plist ATTRS.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
Optional parameter FRAME is the frame whose definition of FACE
|
|
|
|
|
is used. If nil or omitted, use the selected frame."
|
|
|
|
|
(unless frame
|
|
|
|
|
(setq frame (selected-frame)))
|
|
|
|
|
(let ((list face-attribute-name-alist)
|
|
|
|
|
(match t))
|
|
|
|
|
(while (and match (not (null list)))
|
|
|
|
|
(let* ((attr (car (car list)))
|
2000-08-20 12:02:24 +00:00
|
|
|
|
(specified-value
|
|
|
|
|
(if (plist-member attrs attr)
|
|
|
|
|
(plist-get attrs attr)
|
|
|
|
|
'unspecified))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(value-now (face-attribute face attr frame)))
|
2000-08-20 12:02:24 +00:00
|
|
|
|
(setq match (equal specified-value value-now))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(setq list (cdr list))))
|
|
|
|
|
match))
|
|
|
|
|
|
|
|
|
|
(defun face-spec-match-p (face spec &optional frame)
|
|
|
|
|
"Return t if FACE, on FRAME, matches what SPEC says it should look like."
|
|
|
|
|
(face-attr-match-p face (face-spec-choose spec frame) frame))
|
|
|
|
|
|
2000-10-24 01:17:23 +00:00
|
|
|
|
(defsubst face-default-spec (face)
|
2000-10-23 05:32:59 +00:00
|
|
|
|
"Return the default face-spec for FACE, ignoring any user customization.
|
|
|
|
|
If there is no default for FACE, return nil."
|
|
|
|
|
(get face 'face-defface-spec))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2000-10-24 01:17:23 +00:00
|
|
|
|
(defsubst face-user-default-spec (face)
|
|
|
|
|
"Return the user's customized face-spec for FACE, or the default if none.
|
2001-04-25 15:22:53 +00:00
|
|
|
|
If there is neither a user setting nor a default for FACE, return nil."
|
2005-06-21 15:59:12 +00:00
|
|
|
|
(or (get face 'customized-face)
|
|
|
|
|
(get face 'saved-face)
|
2000-10-24 01:17:23 +00:00
|
|
|
|
(face-default-spec face)))
|
|
|
|
|
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Frame-type independent color support.
|
|
|
|
|
;;; We keep the old x-* names as aliases for back-compatibility.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defun defined-colors (&optional frame)
|
|
|
|
|
"Return a list of colors supported for a particular frame.
|
|
|
|
|
The argument FRAME specifies which frame to try.
|
|
|
|
|
The value may be different for frames on different display types.
|
2006-06-05 17:21:37 +00:00
|
|
|
|
If FRAME doesn't support colors, the value is nil.
|
|
|
|
|
If FRAME is nil, that stands for the selected frame."
|
Initial check-in: changes for building Emacs under Mac OS.
2000-10-23 Andrew Choi <akochoi@i-cable.com>
* dispextern.h [macintosh]: Include macgui.h instead of macterm.h.
* dispnew.c [macintosh]: Include macterm.h.
(init_display) [macintosh]: initialization for window system.
* emacs.c (main) [macintosh]: Call syms_of_textprop,
syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm,
syms_of_search, x_term_init, and init_keyboard before calling
init_window_once. Also, call syms_of_xmenu.
* fontset.c (syms_of_fontset) [macintosh]: Set ASCII font of
default fontset to Monaco.
* frame.c [macintosh]: Include macterm.h. Remove declarations of
NewMacWindow and DisposeMacWindow.
(make_terminal_frame) [macintosh]: Call make_mac_terminal_frame
instead of calling NewMacWindow and setting fields of
f->output_data.mac directly. Call init_frame_faces.
(Fdelete_frame) [macintosh]: Remove unused code.
(Fmodify_frame_parameters) [macintosh]: Call
x_set_frame_parameters instead of mac_set_frame_parameters.
* frame.h [macintosh]: Define menu_bar_lines field in struct
frame. Define FRAME_EXTERNAL_MENU_BAR macro.
* keyboard.c [macintosh]: Include macterm.h.
(kbd_buffer_get_event) [macintosh]: Generate delete_window_event
and menu_bar_activate_event type events as for X and NT.
(make_lispy_event) [macintosh]: Construct lisp events of type
MENU_BAR_EVENT as for X and NT.
* sysdep.c [macintosh]: Remove declaration for sys_signal.
Include stdlib.h. Remove definition of Vx_bitmap_file_path.
(sys_subshell) [macintosh]: Remove definition entirely.
(init_sys_modes) [macintosh]: Do not initialize Vwindow_system and
Vwindow_system_version here. Remove initialization of
Vx_bitmap_file_path.
(read_input_waiting): Correct the number of parameters passed to
read_socket_hook.
Move all Macintosh functions to mac/mac.c.
* term.c [macintosh]: Include macterm.h.
* window.c [macintosh]: Include macterm.h.
* xdisp.c [macintosh]: Include macterm.h. Declare
set_frame_menubar and pending_menu_activation.
(echo_area_display) [macintosh]: Do not return if terminal frame
is the selected frame.
(update_menu_bar) [macintosh]: Check FRAME_EXTERNAL_MENU_BAR (f).
Allow only the selected frame to set menu bar.
(redisplay_window) [macintosh]: Obtain menu bar to redisplay by
calling FRAME_EXTERNAL_MENU_BAR (f).
(display_menu_bar) [macintosh]: Check FRAME_MAC_P (f).
* xfaces.c [macintosh]: Include macterm.h. Define x_display_info
and check_x. Declare XCreateGC. Define x_create_gc and
x_free_gc. Initialize font_sort_order.
(x_face_list_fonts) [macintosh]: Use the same code as WINDOWSNT,
but call x_list_fonts instead of w32_list_fonts.
(Finternal_face_x_get_resource) [macintosh]: Do not call
display_x_get_resource.
(prepare_face_for_display) [macintosh]: Set xgcv.font.
(realize_x_face) [macintosh]: Load the font if it is specified in
ATTRS.
(syms_of_xfaces) [macintosh]: Initialize Vscalable_fonts_allowed
to Qt.
* cus-edit.el (custom-button-face): Use 3D look for mac.
(custom-button-pressed-face): Likewise.
* faces.el (set-face-attributes-from-resources): Handle mac frames
in the same way as x and w32 frames.
(face-valid-attribute-values): Likewise.
(read-face-attribute): Likewise.
(defined-colors): Likewise.
(color-defined-p): Likewise.
(color-values): Likewise.
(display-grayscale-p): Likewise.
(face-set-after-frame-default): Likewise.
(mode-line): Same default face as for x and w32.
(tool-bar): Likewise.
* frame.el: Remove call to frame-notice-user-settings at end of
the file.
* info.el (Info-fontify-node): make underlines invisible for mac
as for x, pc, and w32 frame types.
* term/mac-win.el: New file.
2000-10-22 16:50:16 +00:00
|
|
|
|
(if (memq (framep (or frame (selected-frame))) '(x w32 mac))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(xw-defined-colors frame)
|
2000-01-02 14:12:09 +00:00
|
|
|
|
(mapcar 'car (tty-color-alist frame))))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(defalias 'x-defined-colors 'defined-colors)
|
|
|
|
|
|
|
|
|
|
(defun color-defined-p (color &optional frame)
|
|
|
|
|
"Return non-nil if color COLOR is supported on frame FRAME.
|
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
2000-01-03 16:58:20 +00:00
|
|
|
|
If COLOR is the symbol `unspecified' or one of the strings
|
|
|
|
|
\"unspecified-fg\" or \"unspecified-bg\", the value is nil."
|
2000-10-21 22:29:38 +00:00
|
|
|
|
(if (member color '(unspecified "unspecified-bg" "unspecified-fg"))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
nil
|
Initial check-in: changes for building Emacs under Mac OS.
2000-10-23 Andrew Choi <akochoi@i-cable.com>
* dispextern.h [macintosh]: Include macgui.h instead of macterm.h.
* dispnew.c [macintosh]: Include macterm.h.
(init_display) [macintosh]: initialization for window system.
* emacs.c (main) [macintosh]: Call syms_of_textprop,
syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm,
syms_of_search, x_term_init, and init_keyboard before calling
init_window_once. Also, call syms_of_xmenu.
* fontset.c (syms_of_fontset) [macintosh]: Set ASCII font of
default fontset to Monaco.
* frame.c [macintosh]: Include macterm.h. Remove declarations of
NewMacWindow and DisposeMacWindow.
(make_terminal_frame) [macintosh]: Call make_mac_terminal_frame
instead of calling NewMacWindow and setting fields of
f->output_data.mac directly. Call init_frame_faces.
(Fdelete_frame) [macintosh]: Remove unused code.
(Fmodify_frame_parameters) [macintosh]: Call
x_set_frame_parameters instead of mac_set_frame_parameters.
* frame.h [macintosh]: Define menu_bar_lines field in struct
frame. Define FRAME_EXTERNAL_MENU_BAR macro.
* keyboard.c [macintosh]: Include macterm.h.
(kbd_buffer_get_event) [macintosh]: Generate delete_window_event
and menu_bar_activate_event type events as for X and NT.
(make_lispy_event) [macintosh]: Construct lisp events of type
MENU_BAR_EVENT as for X and NT.
* sysdep.c [macintosh]: Remove declaration for sys_signal.
Include stdlib.h. Remove definition of Vx_bitmap_file_path.
(sys_subshell) [macintosh]: Remove definition entirely.
(init_sys_modes) [macintosh]: Do not initialize Vwindow_system and
Vwindow_system_version here. Remove initialization of
Vx_bitmap_file_path.
(read_input_waiting): Correct the number of parameters passed to
read_socket_hook.
Move all Macintosh functions to mac/mac.c.
* term.c [macintosh]: Include macterm.h.
* window.c [macintosh]: Include macterm.h.
* xdisp.c [macintosh]: Include macterm.h. Declare
set_frame_menubar and pending_menu_activation.
(echo_area_display) [macintosh]: Do not return if terminal frame
is the selected frame.
(update_menu_bar) [macintosh]: Check FRAME_EXTERNAL_MENU_BAR (f).
Allow only the selected frame to set menu bar.
(redisplay_window) [macintosh]: Obtain menu bar to redisplay by
calling FRAME_EXTERNAL_MENU_BAR (f).
(display_menu_bar) [macintosh]: Check FRAME_MAC_P (f).
* xfaces.c [macintosh]: Include macterm.h. Define x_display_info
and check_x. Declare XCreateGC. Define x_create_gc and
x_free_gc. Initialize font_sort_order.
(x_face_list_fonts) [macintosh]: Use the same code as WINDOWSNT,
but call x_list_fonts instead of w32_list_fonts.
(Finternal_face_x_get_resource) [macintosh]: Do not call
display_x_get_resource.
(prepare_face_for_display) [macintosh]: Set xgcv.font.
(realize_x_face) [macintosh]: Load the font if it is specified in
ATTRS.
(syms_of_xfaces) [macintosh]: Initialize Vscalable_fonts_allowed
to Qt.
* cus-edit.el (custom-button-face): Use 3D look for mac.
(custom-button-pressed-face): Likewise.
* faces.el (set-face-attributes-from-resources): Handle mac frames
in the same way as x and w32 frames.
(face-valid-attribute-values): Likewise.
(read-face-attribute): Likewise.
(defined-colors): Likewise.
(color-defined-p): Likewise.
(color-values): Likewise.
(display-grayscale-p): Likewise.
(face-set-after-frame-default): Likewise.
(mode-line): Same default face as for x and w32.
(tool-bar): Likewise.
* frame.el: Remove call to frame-notice-user-settings at end of
the file.
* info.el (Info-fontify-node): make underlines invisible for mac
as for x, pc, and w32 frame types.
* term/mac-win.el: New file.
2000-10-22 16:50:16 +00:00
|
|
|
|
(if (member (framep (or frame (selected-frame))) '(x w32 mac))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(xw-color-defined-p color frame)
|
2000-01-02 14:12:09 +00:00
|
|
|
|
(numberp (tty-color-translate color frame)))))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(defalias 'x-color-defined-p 'color-defined-p)
|
|
|
|
|
|
|
|
|
|
(defun color-values (color &optional frame)
|
|
|
|
|
"Return a description of the color named COLOR on frame FRAME.
|
2007-02-14 15:31:09 +00:00
|
|
|
|
The value is a list of integer RGB values--(RED GREEN BLUE).
|
|
|
|
|
These values appear to range from 0 to 65280 or 65535, depending
|
|
|
|
|
on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\).
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
If FRAME is omitted or nil, use the selected frame.
|
|
|
|
|
If FRAME cannot display COLOR, the value is nil.
|
2000-01-03 16:58:20 +00:00
|
|
|
|
If COLOR is the symbol `unspecified' or one of the strings
|
|
|
|
|
\"unspecified-fg\" or \"unspecified-bg\", the value is nil."
|
2000-10-21 22:29:38 +00:00
|
|
|
|
(if (member color '(unspecified "unspecified-fg" "unspecified-bg"))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
nil
|
Initial check-in: changes for building Emacs under Mac OS.
2000-10-23 Andrew Choi <akochoi@i-cable.com>
* dispextern.h [macintosh]: Include macgui.h instead of macterm.h.
* dispnew.c [macintosh]: Include macterm.h.
(init_display) [macintosh]: initialization for window system.
* emacs.c (main) [macintosh]: Call syms_of_textprop,
syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm,
syms_of_search, x_term_init, and init_keyboard before calling
init_window_once. Also, call syms_of_xmenu.
* fontset.c (syms_of_fontset) [macintosh]: Set ASCII font of
default fontset to Monaco.
* frame.c [macintosh]: Include macterm.h. Remove declarations of
NewMacWindow and DisposeMacWindow.
(make_terminal_frame) [macintosh]: Call make_mac_terminal_frame
instead of calling NewMacWindow and setting fields of
f->output_data.mac directly. Call init_frame_faces.
(Fdelete_frame) [macintosh]: Remove unused code.
(Fmodify_frame_parameters) [macintosh]: Call
x_set_frame_parameters instead of mac_set_frame_parameters.
* frame.h [macintosh]: Define menu_bar_lines field in struct
frame. Define FRAME_EXTERNAL_MENU_BAR macro.
* keyboard.c [macintosh]: Include macterm.h.
(kbd_buffer_get_event) [macintosh]: Generate delete_window_event
and menu_bar_activate_event type events as for X and NT.
(make_lispy_event) [macintosh]: Construct lisp events of type
MENU_BAR_EVENT as for X and NT.
* sysdep.c [macintosh]: Remove declaration for sys_signal.
Include stdlib.h. Remove definition of Vx_bitmap_file_path.
(sys_subshell) [macintosh]: Remove definition entirely.
(init_sys_modes) [macintosh]: Do not initialize Vwindow_system and
Vwindow_system_version here. Remove initialization of
Vx_bitmap_file_path.
(read_input_waiting): Correct the number of parameters passed to
read_socket_hook.
Move all Macintosh functions to mac/mac.c.
* term.c [macintosh]: Include macterm.h.
* window.c [macintosh]: Include macterm.h.
* xdisp.c [macintosh]: Include macterm.h. Declare
set_frame_menubar and pending_menu_activation.
(echo_area_display) [macintosh]: Do not return if terminal frame
is the selected frame.
(update_menu_bar) [macintosh]: Check FRAME_EXTERNAL_MENU_BAR (f).
Allow only the selected frame to set menu bar.
(redisplay_window) [macintosh]: Obtain menu bar to redisplay by
calling FRAME_EXTERNAL_MENU_BAR (f).
(display_menu_bar) [macintosh]: Check FRAME_MAC_P (f).
* xfaces.c [macintosh]: Include macterm.h. Define x_display_info
and check_x. Declare XCreateGC. Define x_create_gc and
x_free_gc. Initialize font_sort_order.
(x_face_list_fonts) [macintosh]: Use the same code as WINDOWSNT,
but call x_list_fonts instead of w32_list_fonts.
(Finternal_face_x_get_resource) [macintosh]: Do not call
display_x_get_resource.
(prepare_face_for_display) [macintosh]: Set xgcv.font.
(realize_x_face) [macintosh]: Load the font if it is specified in
ATTRS.
(syms_of_xfaces) [macintosh]: Initialize Vscalable_fonts_allowed
to Qt.
* cus-edit.el (custom-button-face): Use 3D look for mac.
(custom-button-pressed-face): Likewise.
* faces.el (set-face-attributes-from-resources): Handle mac frames
in the same way as x and w32 frames.
(face-valid-attribute-values): Likewise.
(read-face-attribute): Likewise.
(defined-colors): Likewise.
(color-defined-p): Likewise.
(color-values): Likewise.
(display-grayscale-p): Likewise.
(face-set-after-frame-default): Likewise.
(mode-line): Same default face as for x and w32.
(tool-bar): Likewise.
* frame.el: Remove call to frame-notice-user-settings at end of
the file.
* info.el (Info-fontify-node): make underlines invisible for mac
as for x, pc, and w32 frame types.
* term/mac-win.el: New file.
2000-10-22 16:50:16 +00:00
|
|
|
|
(if (memq (framep (or frame (selected-frame))) '(x w32 mac))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(xw-color-values color frame)
|
|
|
|
|
(tty-color-values color frame))))
|
|
|
|
|
(defalias 'x-color-values 'color-values)
|
|
|
|
|
|
|
|
|
|
(defun display-color-p (&optional display)
|
|
|
|
|
"Return t if DISPLAY supports color.
|
|
|
|
|
The optional argument DISPLAY specifies which display to ask about.
|
|
|
|
|
DISPLAY should be either a frame or a display name (a string).
|
|
|
|
|
If omitted or nil, that stands for the selected frame's display."
|
Initial check-in: changes for building Emacs under Mac OS.
2000-10-23 Andrew Choi <akochoi@i-cable.com>
* dispextern.h [macintosh]: Include macgui.h instead of macterm.h.
* dispnew.c [macintosh]: Include macterm.h.
(init_display) [macintosh]: initialization for window system.
* emacs.c (main) [macintosh]: Call syms_of_textprop,
syms_of_macfns, syms_of_ccl, syms_of_fontset, syms_of_xterm,
syms_of_search, x_term_init, and init_keyboard before calling
init_window_once. Also, call syms_of_xmenu.
* fontset.c (syms_of_fontset) [macintosh]: Set ASCII font of
default fontset to Monaco.
* frame.c [macintosh]: Include macterm.h. Remove declarations of
NewMacWindow and DisposeMacWindow.
(make_terminal_frame) [macintosh]: Call make_mac_terminal_frame
instead of calling NewMacWindow and setting fields of
f->output_data.mac directly. Call init_frame_faces.
(Fdelete_frame) [macintosh]: Remove unused code.
(Fmodify_frame_parameters) [macintosh]: Call
x_set_frame_parameters instead of mac_set_frame_parameters.
* frame.h [macintosh]: Define menu_bar_lines field in struct
frame. Define FRAME_EXTERNAL_MENU_BAR macro.
* keyboard.c [macintosh]: Include macterm.h.
(kbd_buffer_get_event) [macintosh]: Generate delete_window_event
and menu_bar_activate_event type events as for X and NT.
(make_lispy_event) [macintosh]: Construct lisp events of type
MENU_BAR_EVENT as for X and NT.
* sysdep.c [macintosh]: Remove declaration for sys_signal.
Include stdlib.h. Remove definition of Vx_bitmap_file_path.
(sys_subshell) [macintosh]: Remove definition entirely.
(init_sys_modes) [macintosh]: Do not initialize Vwindow_system and
Vwindow_system_version here. Remove initialization of
Vx_bitmap_file_path.
(read_input_waiting): Correct the number of parameters passed to
read_socket_hook.
Move all Macintosh functions to mac/mac.c.
* term.c [macintosh]: Include macterm.h.
* window.c [macintosh]: Include macterm.h.
* xdisp.c [macintosh]: Include macterm.h. Declare
set_frame_menubar and pending_menu_activation.
(echo_area_display) [macintosh]: Do not return if terminal frame
is the selected frame.
(update_menu_bar) [macintosh]: Check FRAME_EXTERNAL_MENU_BAR (f).
Allow only the selected frame to set menu bar.
(redisplay_window) [macintosh]: Obtain menu bar to redisplay by
calling FRAME_EXTERNAL_MENU_BAR (f).
(display_menu_bar) [macintosh]: Check FRAME_MAC_P (f).
* xfaces.c [macintosh]: Include macterm.h. Define x_display_info
and check_x. Declare XCreateGC. Define x_create_gc and
x_free_gc. Initialize font_sort_order.
(x_face_list_fonts) [macintosh]: Use the same code as WINDOWSNT,
but call x_list_fonts instead of w32_list_fonts.
(Finternal_face_x_get_resource) [macintosh]: Do not call
display_x_get_resource.
(prepare_face_for_display) [macintosh]: Set xgcv.font.
(realize_x_face) [macintosh]: Load the font if it is specified in
ATTRS.
(syms_of_xfaces) [macintosh]: Initialize Vscalable_fonts_allowed
to Qt.
* cus-edit.el (custom-button-face): Use 3D look for mac.
(custom-button-pressed-face): Likewise.
* faces.el (set-face-attributes-from-resources): Handle mac frames
in the same way as x and w32 frames.
(face-valid-attribute-values): Likewise.
(read-face-attribute): Likewise.
(defined-colors): Likewise.
(color-defined-p): Likewise.
(color-values): Likewise.
(display-grayscale-p): Likewise.
(face-set-after-frame-default): Likewise.
(mode-line): Same default face as for x and w32.
(tool-bar): Likewise.
* frame.el: Remove call to frame-notice-user-settings at end of
the file.
* info.el (Info-fontify-node): make underlines invisible for mac
as for x, pc, and w32 frame types.
* term/mac-win.el: New file.
2000-10-22 16:50:16 +00:00
|
|
|
|
(if (memq (framep-on-display display) '(x w32 mac))
|
2000-02-02 11:38:16 +00:00
|
|
|
|
(xw-display-color-p display)
|
|
|
|
|
(tty-display-color-p display)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
(defalias 'x-display-color-p 'display-color-p)
|
|
|
|
|
|
2000-02-02 11:38:16 +00:00
|
|
|
|
(defun display-grayscale-p (&optional display)
|
|
|
|
|
"Return non-nil if frames on DISPLAY can display shades of gray."
|
|
|
|
|
(let ((frame-type (framep-on-display display)))
|
|
|
|
|
(cond
|
|
|
|
|
((memq frame-type '(x w32 mac))
|
|
|
|
|
(x-display-grayscale-p display))
|
|
|
|
|
(t
|
|
|
|
|
(> (tty-color-gray-shades display) 2)))))
|
|
|
|
|
|
2007-10-29 13:54:00 +00:00
|
|
|
|
(defun read-color (&optional prompt convert-to-RGB-p allow-empty-name-p msg-p)
|
|
|
|
|
"Read a color name or RGB hex value: #RRRRGGGGBBBB.
|
|
|
|
|
Completion is available for color names, but not for RGB hex strings.
|
|
|
|
|
If the user inputs an RGB hex string, it must have the form
|
|
|
|
|
#XXXXXXXXXXXX or XXXXXXXXXXXX, where each X is a hex digit. The
|
|
|
|
|
number of Xs must be a multiple of 3, with the same number of Xs for
|
|
|
|
|
each of red, green, and blue. The order is red, green, blue.
|
|
|
|
|
|
|
|
|
|
In addition to standard color names and RGB hex values, the following
|
|
|
|
|
are available as color candidates. In each case, the corresponding
|
|
|
|
|
color is used.
|
|
|
|
|
|
|
|
|
|
* `foreground at point' - foreground under the cursor
|
|
|
|
|
* `background at point' - background under the cursor
|
|
|
|
|
|
|
|
|
|
Checks input to be sure it represents a valid color. If not, raises
|
|
|
|
|
an error (but see exception for empty input with non-nil
|
|
|
|
|
ALLOW-EMPTY-NAME-P).
|
|
|
|
|
|
|
|
|
|
Optional arg PROMPT is the prompt; if nil, uses a default prompt.
|
|
|
|
|
|
|
|
|
|
Interactively, or with optional arg CONVERT-TO-RGB-P non-nil, converts
|
|
|
|
|
an input color name to an RGB hex string. Returns the RGB hex string.
|
|
|
|
|
|
|
|
|
|
Optional arg ALLOW-EMPTY-NAME-P controls what happens if the user
|
|
|
|
|
enters an empty color name (that is, just hits `RET'). If non-nil,
|
|
|
|
|
then returns an empty color name, \"\". If nil, then raises an error.
|
|
|
|
|
Programs must test for \"\" if ALLOW-EMPTY-NAME-P is non-nil. They
|
|
|
|
|
can then perform an appropriate action in case of empty input.
|
|
|
|
|
|
|
|
|
|
Interactively, or with optional arg MSG-P non-nil, echoes the color in
|
|
|
|
|
a message."
|
|
|
|
|
(interactive "i\np\ni\np") ; Always convert to RGB interactively.
|
|
|
|
|
(let* ((completion-ignore-case t)
|
|
|
|
|
(colors (append '("foreground at point" "background at point")
|
|
|
|
|
(defined-colors)))
|
|
|
|
|
(color (completing-read (or prompt "Color (name or #R+G+B+): ")
|
|
|
|
|
colors))
|
|
|
|
|
hex-string)
|
|
|
|
|
(cond ((string= "foreground at point" color)
|
|
|
|
|
(setq color (foreground-color-at-point)))
|
|
|
|
|
((string= "background at point" color)
|
|
|
|
|
(setq color (background-color-at-point))))
|
|
|
|
|
(unless color
|
|
|
|
|
(setq color ""))
|
|
|
|
|
(setq hex-string
|
|
|
|
|
(string-match "^#?\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" color))
|
|
|
|
|
(if (and allow-empty-name-p (string= "" color))
|
|
|
|
|
""
|
|
|
|
|
(when (and hex-string (not (eq (aref color 0) ?#)))
|
|
|
|
|
(setq color (concat "#" color))) ; No #; add it.
|
|
|
|
|
(unless hex-string
|
|
|
|
|
(when (or (string= "" color) (not (test-completion color colors)))
|
|
|
|
|
(error "No such color: %S" color))
|
|
|
|
|
(when convert-to-RGB-p
|
|
|
|
|
(let ((components (x-color-values color)))
|
|
|
|
|
(unless components (error "No such color: %S" color))
|
|
|
|
|
(unless (string-match "^#\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)+$" color)
|
|
|
|
|
(setq color (format "#%04X%04X%04X"
|
|
|
|
|
(logand 65535 (nth 0 components))
|
|
|
|
|
(logand 65535 (nth 1 components))
|
|
|
|
|
(logand 65535 (nth 2 components))))))))
|
|
|
|
|
(when msg-p (message "Color: `%s'" color))
|
|
|
|
|
color)))
|
|
|
|
|
|
|
|
|
|
;; Commented out because I decided it is better to include the
|
|
|
|
|
;; duplicates in read-color's completion list.
|
|
|
|
|
|
|
|
|
|
;; (defun defined-colors-without-duplicates ()
|
|
|
|
|
;; "Return the list of defined colors, without the no-space versions.
|
|
|
|
|
;; For each color name, we keep the variant that DOES have spaces."
|
|
|
|
|
;; (let ((result (copy-sequence (defined-colors)))
|
|
|
|
|
;; to-be-rejected)
|
|
|
|
|
;; (save-match-data
|
|
|
|
|
;; (dolist (this result)
|
|
|
|
|
;; (if (string-match " " this)
|
2008-02-22 23:37:23 +00:00
|
|
|
|
;; (push (replace-regexp-in-string " " ""
|
2007-10-29 13:54:00 +00:00
|
|
|
|
;; this)
|
|
|
|
|
;; to-be-rejected)))
|
|
|
|
|
;; (dolist (elt to-be-rejected)
|
|
|
|
|
;; (let ((as-found (car (member-ignore-case elt result))))
|
|
|
|
|
;; (setq result (delete as-found result)))))
|
|
|
|
|
;; result))
|
|
|
|
|
|
|
|
|
|
(defun face-at-point ()
|
|
|
|
|
"Return the face of the character after point.
|
|
|
|
|
If it has more than one face, return the first one.
|
|
|
|
|
Return nil if it has no specified face."
|
|
|
|
|
(let* ((faceprop (or (get-char-property (point) 'read-face-name)
|
|
|
|
|
(get-char-property (point) 'face)
|
|
|
|
|
'default))
|
|
|
|
|
(face (cond ((symbolp faceprop) faceprop)
|
|
|
|
|
;; List of faces (don't treat an attribute spec).
|
|
|
|
|
;; Just use the first face.
|
|
|
|
|
((and (consp faceprop) (not (keywordp (car faceprop)))
|
|
|
|
|
(not (memq (car faceprop)
|
|
|
|
|
'(foreground-color background-color))))
|
|
|
|
|
(car faceprop))
|
|
|
|
|
(t nil)))) ; Invalid face value.
|
|
|
|
|
(if (facep face) face nil)))
|
|
|
|
|
|
|
|
|
|
(defun foreground-color-at-point ()
|
|
|
|
|
"Return the foreground color of the character after point."
|
|
|
|
|
;; `face-at-point' alone is not sufficient. It only gets named faces.
|
|
|
|
|
;; Need also pick up any face properties that are not associated with named faces.
|
|
|
|
|
(let ((face (or (face-at-point)
|
|
|
|
|
(get-char-property (point) 'read-face-name)
|
|
|
|
|
(get-char-property (point) 'face))))
|
|
|
|
|
(cond ((and face (symbolp face))
|
|
|
|
|
(let ((value (face-foreground face nil 'default)))
|
|
|
|
|
(if (member value '("unspecified-fg" "unspecified-bg"))
|
|
|
|
|
nil
|
|
|
|
|
value)))
|
|
|
|
|
((consp face)
|
|
|
|
|
(cond ((memq 'foreground-color face) (cdr (memq 'foreground-color face)))
|
|
|
|
|
((memq ':foreground face) (cadr (memq ':foreground face)))))
|
|
|
|
|
(t nil)))) ; Invalid face value.
|
|
|
|
|
|
|
|
|
|
(defun background-color-at-point ()
|
|
|
|
|
"Return the background color of the character after point."
|
|
|
|
|
;; `face-at-point' alone is not sufficient. It only gets named faces.
|
|
|
|
|
;; Need also pick up any face properties that are not associated with named faces.
|
|
|
|
|
(let ((face (or (face-at-point)
|
|
|
|
|
(get-char-property (point) 'read-face-name)
|
|
|
|
|
(get-char-property (point) 'face))))
|
|
|
|
|
(cond ((and face (symbolp face))
|
|
|
|
|
(let ((value (face-background face nil 'default)))
|
|
|
|
|
(if (member value '("unspecified-fg" "unspecified-bg"))
|
|
|
|
|
nil
|
|
|
|
|
value)))
|
|
|
|
|
((consp face)
|
|
|
|
|
(cond ((memq 'background-color face) (cdr (memq 'background-color face)))
|
|
|
|
|
((memq ':background face) (cadr (memq ':background face)))))
|
|
|
|
|
(t nil)))) ; Invalid face value.
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Background mode.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defcustom frame-background-mode nil
|
|
|
|
|
"*The brightness of the background.
|
2005-06-21 15:59:12 +00:00
|
|
|
|
Set this to the symbol `dark' if your background color is dark,
|
2005-12-11 11:09:33 +00:00
|
|
|
|
`light' if your background is light, or nil (automatic by default)
|
|
|
|
|
if you want Emacs to examine the brightness for you. Don't set this
|
|
|
|
|
variable with `setq'; this won't have the expected effect."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'faces
|
|
|
|
|
:set #'(lambda (var value)
|
2000-06-20 11:33:24 +00:00
|
|
|
|
(set-default var value)
|
2000-09-10 21:55:22 +00:00
|
|
|
|
(mapc 'frame-set-background-mode (frame-list)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:initialize 'custom-initialize-changed
|
2005-12-11 11:09:33 +00:00
|
|
|
|
:type '(choice (const dark)
|
|
|
|
|
(const light)
|
|
|
|
|
(const :tag "automatic" nil)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun frame-set-background-mode (frame)
|
2000-10-19 08:37:11 +00:00
|
|
|
|
"Set up display-dependent faces on FRAME.
|
|
|
|
|
Display-dependent faces are those which have different definitions
|
|
|
|
|
according to the `background-mode' and `display-type' frame parameters."
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(let* ((bg-resource
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(and (window-system frame)
|
2003-03-05 10:38:24 +00:00
|
|
|
|
(x-get-resource "backgroundMode" "BackgroundMode")))
|
2000-10-19 06:56:50 +00:00
|
|
|
|
(bg-color (frame-parameter frame 'background-color))
|
2006-05-20 17:02:47 +00:00
|
|
|
|
(terminal-bg-mode (terminal-parameter frame 'background-mode))
|
|
|
|
|
(tty-type (tty-type frame))
|
2000-10-11 10:02:10 +00:00
|
|
|
|
(bg-mode
|
|
|
|
|
(cond (frame-background-mode)
|
|
|
|
|
(bg-resource
|
|
|
|
|
(intern (downcase bg-resource)))
|
2006-05-20 17:02:47 +00:00
|
|
|
|
(terminal-bg-mode)
|
2004-03-11 01:11:38 +00:00
|
|
|
|
((and (null (window-system frame))
|
|
|
|
|
;; Unspecified frame background color can only
|
|
|
|
|
;; happen on tty's.
|
|
|
|
|
(member bg-color '(nil unspecified "unspecified-bg")))
|
|
|
|
|
;; There is no way to determine the background mode
|
|
|
|
|
;; automatically, so we make a guess based on the
|
|
|
|
|
;; terminal type.
|
|
|
|
|
(if (and tty-type
|
|
|
|
|
(string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
|
|
|
|
|
tty-type))
|
|
|
|
|
'light
|
|
|
|
|
'dark))
|
2000-10-21 22:29:38 +00:00
|
|
|
|
((equal bg-color "unspecified-fg") ; inverted colors
|
2004-03-11 01:11:38 +00:00
|
|
|
|
(if (and tty-type
|
|
|
|
|
(string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
|
|
|
|
|
tty-type))
|
|
|
|
|
'dark
|
|
|
|
|
'light))
|
2007-02-07 14:36:35 +00:00
|
|
|
|
((>= (apply '+ (color-values bg-color frame))
|
2000-10-11 10:02:10 +00:00
|
|
|
|
;; Just looking at the screen, colors whose
|
|
|
|
|
;; values add up to .6 of the white total
|
|
|
|
|
;; still look dark to me.
|
2007-02-07 14:36:35 +00:00
|
|
|
|
(* (apply '+ (color-values "white" frame)) .6))
|
2000-10-19 06:56:50 +00:00
|
|
|
|
'light)
|
|
|
|
|
(t 'dark)))
|
2000-10-11 10:02:10 +00:00
|
|
|
|
(display-type
|
Converted display hooks to be display-local. Plus many bugfixes.
lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs.
(init_signal): Pass SIGINT and SIGQUIT to the emacs process.
lisp/faces.el (face-valid-attribute-values): Use the window-system
function, not the variable.
(read-face-attribute, face-spec-set-match-display, frame-set-background-mode)
(face-set-after-frame-default): Ditto.
lisp/frame.el (make-frame-on-tty): Added interactive declaration
(suggested by Robert J. Chassell). Use tty-create-frame-with-faces,
not make-terminal-frame.
src/termhooks.h (struct display_method): Renamed to display for brevity.
(struct display): Added all display hook variables as members of this structure.
Added next_display, reference_count, type and display_info components.
(FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST)
(FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display.
(FRAME_DISPLAY): New macro.
(create_display, delete_display): New prototypes.
src/frame.h (struct frame): Added `display' member, removed display_method.
(FRAME_LIVE_P): Look at f->display, not f->output_data.
src/termchar.h (struct tty_display_info): Removed display_method component.
(FRAME_TTY): Use the display structure, not output_data.
src/term.c (display_list): New variable.
(cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook)
(clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook)
(ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook)
(update_begin_hook, update_end_hook, set_terminal_window_hook)
(insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook)
(frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook)
(frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook)
(redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display.
(tty_display_method_template): Removed.
(syms_of_term): Don't initialize tty_display_method_template.
(ring_bell, set_terminal_modes, reset_terminal_modes, update_begin)
(update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end)
(clear_frame, clear_end_of_line, write_glyphs, insert_glyphs)
(delete_glyphs, ins_del_lines): Access display hooks through the frame pointer.
(Ftty_display_color_p): Use the frame given as a parameter, or else return nil.
(Ftty_display_color_cells): Ditto.
(get_named_tty): Renamed to get_named_tty_display, changed return type to struct display.
(term_dummy_init): Renamed to initial_term_init. Create and return an initial display.
(term_init): Initialize a new struct display and return a pointer to
it instead of tty_display_info. Removed frame initialization kludge.
(Fdelete_tty): Updated for struct display.
(delete_tty): The parameter type is now struct display, not tty_display_info.
Delete the display, too.
(create_tty_output): New function for creating tty_output structures.
(delete_tty_output): New function for deleting tty_output structures.
(create_display): New function for creating and registering display structures.
(delete_display): New function for deleting and unregistering display structures.
src/dispextern.h: Updated prototypes.
src/dispnew.c: Include frame.h before termhooks.h.
(init_display): Updated term_init call to new signature.
src/emacs.c: Include frame.h (for termhooks.h).
src/keymap.c: Ditto.
src/lread.c: Ditto.
src/xsmfns.c: Ditto.
src/process.c: Include frame.h before termhooks.h.
src/frame.c (Fwindow_system): New function.
(syms_of_frame): Initialize it.
(make_terminal_frame): Open the terminal device before creating the new frame.
Disable scrollbars here, term_init cannot do that anymore.
(Fdelete_frame): Use the new delete_frame_hook, don't do display-specific
frame deletion here. Ditto for delete_display_hook.
(Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame)
(Fredirect_frame_focus): Access display hooks through the frame pointer.
src/keyboard.c: Include frame.h before termhooks.h.
(start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook.
(kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer.
(read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error.
src/sysdep.c (discard_tty_input): Ignore read_socket_hook.
(stuff_char): Don't do anything if the current frame is not on a termcap display.
(request_sigio, unrequest_sigio): Ignore read_socket_hook.
(init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X.
src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal)
(set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer.
(echo_area_display): Don't be afraid of termcap frames during an X+tty combo session.
src/xfaces.c: Include termhooks.h.
(Ftty_supports_face_attributes_p): Use the given frame, not selected_frame.
src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer.
(Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure.
src/xmenu.c: Include termhooks.h after frame.h.
src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection)
(Fx_disown_selection_internal, Fx_get_cut_buffer_internal)
(Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything
if the selected frame is not an X frame.
src/xterm.c (x_display_method): Removed.
(x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects.
(x_term_init): Set up a new struct display object, too.
(x_delete_display): Delete the struct display corresponding to the X display.
(x_initialize): Moved hook initialization to x_create_frame_display.
src/xterm.h (x_display_method): Removed.
(struct x_display_info): Added frame_display component.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
2004-01-05 05:54:35 +00:00
|
|
|
|
(cond ((null (window-system frame))
|
2000-10-11 10:02:10 +00:00
|
|
|
|
(if (tty-display-color-p frame) 'color 'mono))
|
2007-02-07 14:36:35 +00:00
|
|
|
|
((display-color-p frame)
|
2000-10-11 10:02:10 +00:00
|
|
|
|
'color)
|
|
|
|
|
((x-display-grayscale-p frame)
|
|
|
|
|
'grayscale)
|
|
|
|
|
(t 'mono)))
|
|
|
|
|
(old-bg-mode
|
|
|
|
|
(frame-parameter frame 'background-mode))
|
|
|
|
|
(old-display-type
|
|
|
|
|
(frame-parameter frame 'display-type)))
|
|
|
|
|
|
|
|
|
|
(unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
|
2000-12-06 05:11:20 +00:00
|
|
|
|
(let ((locally-modified-faces nil))
|
|
|
|
|
;; Before modifying the frame parameters, we collect a list of
|
|
|
|
|
;; faces that don't match what their face-spec says they should
|
2007-12-30 03:32:34 +00:00
|
|
|
|
;; look like; we then avoid changing these faces below.
|
|
|
|
|
;; These are the faces whose attributes were modified on FRAME.
|
|
|
|
|
;; We use a negative list on the assumption that most faces will
|
2000-12-06 05:11:20 +00:00
|
|
|
|
;; be unmodified, so we can avoid consing in the common case.
|
|
|
|
|
(dolist (face (face-list))
|
2007-12-30 03:32:34 +00:00
|
|
|
|
(and (not (get face 'face-override-spec))
|
|
|
|
|
(not (face-spec-match-p face
|
|
|
|
|
(face-user-default-spec face)
|
|
|
|
|
(selected-frame)))
|
|
|
|
|
(push face locally-modified-faces)))
|
2000-12-06 05:11:20 +00:00
|
|
|
|
;; Now change to the new frame parameters
|
|
|
|
|
(modify-frame-parameters frame
|
|
|
|
|
(list (cons 'background-mode bg-mode)
|
|
|
|
|
(cons 'display-type display-type)))
|
|
|
|
|
;; For all named faces, choose face specs matching the new frame
|
|
|
|
|
;; parameters, unless they have been locally modified.
|
|
|
|
|
(dolist (face (face-list))
|
|
|
|
|
(unless (memq face locally-modified-faces)
|
2007-12-30 03:32:34 +00:00
|
|
|
|
(face-spec-recalc face frame)))))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Frame creation.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defun x-handle-named-frame-geometry (parameters)
|
|
|
|
|
"Add geometry parameters for a named frame to parameter list PARAMETERS.
|
|
|
|
|
Value is the new parameter list."
|
|
|
|
|
(let* ((name (or (cdr (assq 'name parameters))
|
|
|
|
|
(cdr (assq 'name default-frame-alist))))
|
|
|
|
|
(x-resource-name name)
|
|
|
|
|
(res-geometry (if name (x-get-resource "geometry" "Geometry"))))
|
|
|
|
|
(when res-geometry
|
|
|
|
|
(let ((parsed (x-parse-geometry res-geometry)))
|
|
|
|
|
;; If the resource specifies a position, call the position
|
|
|
|
|
;; and size "user-specified".
|
|
|
|
|
(when (or (assq 'top parsed)
|
|
|
|
|
(assq 'left parsed))
|
|
|
|
|
(setq parsed (append '((user-position . t) (user-size . t)) parsed)))
|
|
|
|
|
;; Put the geometry parameters at the end. Copy
|
|
|
|
|
;; default-frame-alist so that they go after it.
|
|
|
|
|
(setq parameters (append parameters default-frame-alist parsed))))
|
|
|
|
|
parameters))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun x-handle-reverse-video (frame parameters)
|
|
|
|
|
"Handle the reverse-video frame parameter and X resource.
|
|
|
|
|
`x-create-frame' does not handle this one."
|
|
|
|
|
(when (cdr (or (assq 'reverse parameters)
|
|
|
|
|
(assq 'reverse default-frame-alist)
|
|
|
|
|
(let ((resource (x-get-resource "reverseVideo"
|
|
|
|
|
"ReverseVideo")))
|
|
|
|
|
(if resource
|
|
|
|
|
(cons nil (member (downcase resource)
|
|
|
|
|
'("on" "true")))))))
|
|
|
|
|
(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 'border-color params)))
|
|
|
|
|
(modify-frame-parameters frame
|
|
|
|
|
(list (cons 'border-color fg))))
|
|
|
|
|
(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 x-create-frame-with-faces (&optional parameters)
|
|
|
|
|
"Create a frame from optional frame parameters PARAMETERS.
|
|
|
|
|
Parameters not specified by PARAMETERS are taken from
|
|
|
|
|
`default-frame-alist'. If PARAMETERS specify a frame name,
|
|
|
|
|
handle X geometry resources for that name. If either PARAMETERS
|
|
|
|
|
or `default-frame-alist' contains a `reverse' parameter, or
|
|
|
|
|
the X resource ``reverseVideo'' is present, handle that.
|
|
|
|
|
Value is the new frame created."
|
|
|
|
|
(setq parameters (x-handle-named-frame-geometry parameters))
|
|
|
|
|
(let ((visibility-spec (assq 'visibility parameters))
|
2004-01-12 00:45:42 +00:00
|
|
|
|
(frame (x-create-frame `((visibility . nil) . ,parameters)))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
success)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
2005-06-26 03:19:45 +00:00
|
|
|
|
(x-setup-function-keys frame)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(x-handle-reverse-video frame parameters)
|
|
|
|
|
(frame-set-background-mode frame)
|
2003-05-26 19:15:42 +00:00
|
|
|
|
(face-set-after-frame-default frame)
|
2006-03-26 13:57:43 +00:00
|
|
|
|
;; Make sure the tool-bar is ready to be enabled. The
|
|
|
|
|
;; `tool-bar-lines' frame parameter will not take effect
|
|
|
|
|
;; without this call.
|
|
|
|
|
(tool-bar-setup frame)
|
|
|
|
|
(if (null visibility-spec)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(make-frame-visible frame)
|
|
|
|
|
(modify-frame-parameters frame (list visibility-spec)))
|
|
|
|
|
(setq success t))
|
|
|
|
|
(unless success
|
|
|
|
|
(delete-frame frame)))
|
|
|
|
|
frame))
|
|
|
|
|
|
|
|
|
|
(defun face-set-after-frame-default (frame)
|
1999-09-07 14:48:52 +00:00
|
|
|
|
"Set frame-local faces of FRAME from face specs and resources.
|
|
|
|
|
Initialize colors of certain faces from frame parameters."
|
2005-10-24 00:10:02 +00:00
|
|
|
|
(unless inhibit-face-set-after-frame-default
|
|
|
|
|
(if (face-attribute 'default :font t)
|
|
|
|
|
(set-face-attribute 'default frame :font
|
|
|
|
|
(face-attribute 'default :font t))
|
|
|
|
|
(set-face-attribute 'default frame :family
|
|
|
|
|
(face-attribute 'default :family t))
|
|
|
|
|
(set-face-attribute 'default frame :height
|
|
|
|
|
(face-attribute 'default :height t))
|
|
|
|
|
(set-face-attribute 'default frame :slant
|
|
|
|
|
(face-attribute 'default :slant t))
|
|
|
|
|
(set-face-attribute 'default frame :weight
|
|
|
|
|
(face-attribute 'default :weight t))
|
|
|
|
|
(set-face-attribute 'default frame :width
|
|
|
|
|
(face-attribute 'default :width t))))
|
2007-02-06 22:36:42 +00:00
|
|
|
|
;; Find attributes that should be initialized from frame parameters.
|
|
|
|
|
(let ((face-params '((foreground-color default :foreground)
|
|
|
|
|
(background-color default :background)
|
|
|
|
|
(border-color border :background)
|
|
|
|
|
(cursor-color cursor :background)
|
|
|
|
|
(scroll-bar-foreground scroll-bar :foreground)
|
|
|
|
|
(scroll-bar-background scroll-bar :background)
|
|
|
|
|
(mouse-color mouse :background)))
|
|
|
|
|
apply-params)
|
|
|
|
|
(dolist (param face-params)
|
|
|
|
|
(let* ((value (frame-parameter frame (nth 0 param)))
|
|
|
|
|
(face (nth 1 param))
|
|
|
|
|
(attr (nth 2 param))
|
|
|
|
|
(default-value (face-attribute face attr t)))
|
|
|
|
|
;; Compile a list of face attributes to set, but don't set
|
|
|
|
|
;; them yet. The call to make-face-x-resource-internal,
|
|
|
|
|
;; below, can change frame parameters, and the final set of
|
|
|
|
|
;; frame parameters should be the ones acquired at this step.
|
|
|
|
|
(if (eq default-value 'unspecified)
|
|
|
|
|
;; The face spec does not specify a new-frame value for
|
|
|
|
|
;; this attribute. Check if the existing frame parameter
|
|
|
|
|
;; specifies it.
|
|
|
|
|
(if value
|
|
|
|
|
(push (list face frame attr value) apply-params))
|
|
|
|
|
;; The face spec specifies a value for this attribute, to be
|
|
|
|
|
;; applied to the face on all new frames.
|
|
|
|
|
(push (list face frame attr default-value) apply-params))))
|
|
|
|
|
;; Initialize faces from face specs and X resources. The
|
|
|
|
|
;; condition-case prevents invalid specs from causing frame
|
|
|
|
|
;; creation to fail.
|
|
|
|
|
(dolist (face (delq 'default (face-list)))
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(progn
|
2007-12-30 03:32:34 +00:00
|
|
|
|
(face-spec-recalc face frame)
|
2007-02-24 19:26:54 +00:00
|
|
|
|
(if (memq (window-system frame) '(x w32 mac))
|
2007-03-10 22:28:51 +00:00
|
|
|
|
(make-face-x-resource-internal face frame))
|
2007-03-25 18:58:06 +00:00
|
|
|
|
(internal-merge-in-global-face face frame))
|
2007-02-06 22:36:42 +00:00
|
|
|
|
(error nil)))
|
|
|
|
|
;; Apply the attributes specified by frame parameters. This
|
|
|
|
|
;; rewrites parameters changed by make-face-x-resource-internal
|
|
|
|
|
(dolist (param apply-params)
|
|
|
|
|
(apply 'set-face-attribute param))))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2000-10-28 17:17:42 +00:00
|
|
|
|
(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)))
|
|
|
|
|
(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)))))))
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
(defun tty-create-frame-with-faces (&optional parameters)
|
|
|
|
|
"Create a frame from optional frame parameters PARAMETERS.
|
|
|
|
|
Parameters not specified by PARAMETERS are taken from
|
|
|
|
|
`default-frame-alist'. If either PARAMETERS or `default-frame-alist'
|
|
|
|
|
contains a `reverse' parameter, handle that. Value is the new frame
|
|
|
|
|
created."
|
|
|
|
|
(let ((frame (make-terminal-frame parameters))
|
|
|
|
|
success)
|
|
|
|
|
(unwind-protect
|
2004-05-23 02:34:53 +00:00
|
|
|
|
(with-selected-frame frame
|
2000-10-28 17:17:42 +00:00
|
|
|
|
(tty-handle-reverse-video frame (frame-parameters frame))
|
2005-09-07 02:29:18 +00:00
|
|
|
|
|
2007-10-18 19:02:23 +00:00
|
|
|
|
(unless (terminal-parameter frame 'terminal-initted)
|
|
|
|
|
(set-terminal-parameter frame 'terminal-initted t)
|
|
|
|
|
(set-locale-environment nil frame)
|
|
|
|
|
(tty-run-terminal-initialization frame))
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(frame-set-background-mode frame)
|
|
|
|
|
(face-set-after-frame-default frame)
|
|
|
|
|
(setq success t))
|
|
|
|
|
(unless success
|
|
|
|
|
(delete-frame frame)))
|
|
|
|
|
frame))
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2006-05-20 15:28:05 +00:00
|
|
|
|
(defun tty-find-type (pred type)
|
|
|
|
|
"Return the longest prefix of TYPE to which PRED returns non-nil.
|
|
|
|
|
TYPE should be a tty type name such as \"xterm-16color\".
|
|
|
|
|
|
|
|
|
|
The function tries only those prefixes that are followed by a
|
|
|
|
|
dash or underscore in the original type name, like \"xterm\" in
|
|
|
|
|
the above example."
|
|
|
|
|
(let (hyphend)
|
|
|
|
|
(while (and type
|
|
|
|
|
(not (funcall pred type)))
|
|
|
|
|
;; Strip off last hyphen and what follows, then try again
|
|
|
|
|
(setq type
|
|
|
|
|
(if (setq hyphend (string-match "[-_][^-_]+$" type))
|
|
|
|
|
(substring type 0 hyphend)
|
|
|
|
|
nil))))
|
|
|
|
|
type)
|
|
|
|
|
|
2006-05-20 17:02:47 +00:00
|
|
|
|
(defun tty-run-terminal-initialization (frame &optional type)
|
|
|
|
|
"Run the special initialization code for the terminal type of FRAME.
|
|
|
|
|
The optional TYPE parameter may be used to override the autodetected
|
|
|
|
|
terminal type to a different value."
|
|
|
|
|
(setq type (or type (tty-type frame)))
|
2005-09-07 02:29:18 +00:00
|
|
|
|
;; Load library for our terminal type.
|
|
|
|
|
;; User init file can set term-file-prefix to nil to prevent this.
|
|
|
|
|
(with-selected-frame frame
|
2007-10-18 19:02:23 +00:00
|
|
|
|
(unless (null term-file-prefix)
|
2006-05-20 15:28:05 +00:00
|
|
|
|
(let* (term-init-func)
|
|
|
|
|
;; First, load the terminal initialization file, if it is
|
|
|
|
|
;; available and it hasn't been loaded already.
|
|
|
|
|
(tty-find-type #'(lambda (type)
|
|
|
|
|
(let ((file (locate-library (concat term-file-prefix type))))
|
|
|
|
|
(and file
|
|
|
|
|
(or (assoc file load-history)
|
|
|
|
|
(load file t t)))))
|
2006-05-20 17:02:47 +00:00
|
|
|
|
type)
|
2006-05-20 15:28:05 +00:00
|
|
|
|
;; Next, try to find a matching initialization function, and call it.
|
|
|
|
|
(tty-find-type #'(lambda (type)
|
|
|
|
|
(fboundp (setq term-init-func
|
|
|
|
|
(intern (concat "terminal-init-" type)))))
|
2006-05-20 17:02:47 +00:00
|
|
|
|
type)
|
2005-09-17 19:00:49 +00:00
|
|
|
|
(when (fboundp term-init-func)
|
2006-05-20 15:28:05 +00:00
|
|
|
|
(funcall term-init-func))
|
|
|
|
|
(set-terminal-parameter frame 'terminal-initted term-init-func)))))
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;; Called from C function init_display to initialize faces of the
|
|
|
|
|
;; dumped terminal frame on startup.
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defun tty-set-up-initial-frame-faces ()
|
|
|
|
|
(let ((frame (selected-frame)))
|
|
|
|
|
(frame-set-background-mode frame)
|
|
|
|
|
(face-set-after-frame-default frame)))
|
2001-05-29 16:12:03 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Compatiblity with 20.2
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1994-10-17 07:31:52 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;; Update a frame's faces when we change its default font.
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2004-06-02 00:35:23 +00:00
|
|
|
|
(defalias 'frame-update-faces 'ignore "")
|
2002-06-27 16:09:19 +00:00
|
|
|
|
(make-obsolete 'frame-update-faces "no longer necessary." "21.1")
|
1997-05-25 21:39:38 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;; Update the colors of FACE, after FRAME's own colors have been
|
|
|
|
|
;; changed.
|
1997-08-18 02:32:18 +00:00
|
|
|
|
|
2005-07-20 15:38:50 +00:00
|
|
|
|
(define-obsolete-function-alias 'frame-update-face-colors
|
|
|
|
|
'frame-set-background-mode "21.1")
|
1997-04-21 03:56:57 +00:00
|
|
|
|
|
1993-05-11 19:14:34 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Standard faces.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(defgroup basic-faces nil
|
|
|
|
|
"The standard faces of Emacs."
|
|
|
|
|
:group 'faces)
|
1995-07-17 22:57:32 +00:00
|
|
|
|
|
2008-02-22 19:03:06 +00:00
|
|
|
|
(defface default nil
|
1999-07-21 21:43:52 +00:00
|
|
|
|
"Basic default face."
|
|
|
|
|
:group 'basic-faces)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2005-09-29 22:55:13 +00:00
|
|
|
|
(defface bold
|
|
|
|
|
'((t :weight bold))
|
|
|
|
|
"Basic bold face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface italic
|
|
|
|
|
'((((supports :slant italic))
|
|
|
|
|
:slant italic)
|
|
|
|
|
(((supports :underline t))
|
|
|
|
|
:underline t)
|
|
|
|
|
(t
|
|
|
|
|
;; default to italic, even it doesn't appear to be supported,
|
|
|
|
|
;; because in some cases the display engine will do it's own
|
|
|
|
|
;; workaround (to `dim' on ttys)
|
|
|
|
|
:slant italic))
|
|
|
|
|
"Basic italic face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface bold-italic
|
|
|
|
|
'((t :weight bold :slant italic))
|
|
|
|
|
"Basic bold-italic face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface underline
|
|
|
|
|
'((((supports :underline t))
|
|
|
|
|
:underline t)
|
|
|
|
|
(((supports :weight bold))
|
|
|
|
|
:weight bold)
|
|
|
|
|
(t :underline t))
|
|
|
|
|
"Basic underlined face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface fixed-pitch
|
|
|
|
|
'((t :family "courier"))
|
|
|
|
|
"The basic fixed-pitch face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface variable-pitch
|
|
|
|
|
'((t :family "helv"))
|
|
|
|
|
"The basic variable-pitch face."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface shadow
|
|
|
|
|
'((((class color grayscale) (min-colors 88) (background light))
|
|
|
|
|
:foreground "grey50")
|
|
|
|
|
(((class color grayscale) (min-colors 88) (background dark))
|
|
|
|
|
:foreground "grey70")
|
|
|
|
|
(((class color) (min-colors 8) (background light))
|
|
|
|
|
:foreground "green")
|
|
|
|
|
(((class color) (min-colors 8) (background dark))
|
|
|
|
|
:foreground "yellow"))
|
|
|
|
|
"Basic face for shadowed text."
|
|
|
|
|
:group 'basic-faces
|
|
|
|
|
:version "22.1")
|
|
|
|
|
|
2006-01-23 01:16:57 +00:00
|
|
|
|
(defface link
|
|
|
|
|
'((((class color) (min-colors 88) (background light))
|
|
|
|
|
:foreground "blue1" :underline t)
|
|
|
|
|
(((class color) (background light))
|
|
|
|
|
:foreground "blue" :underline t)
|
|
|
|
|
(((class color) (min-colors 88) (background dark))
|
|
|
|
|
:foreground "cyan1" :underline t)
|
|
|
|
|
(((class color) (background dark))
|
|
|
|
|
:foreground "cyan" :underline t)
|
|
|
|
|
(t :inherit underline))
|
|
|
|
|
"Basic face for unvisited links."
|
|
|
|
|
:group 'basic-faces
|
|
|
|
|
:version "22.1")
|
|
|
|
|
|
|
|
|
|
(defface link-visited
|
|
|
|
|
'((default :inherit link)
|
|
|
|
|
(((class color) (background light)) :foreground "magenta4")
|
|
|
|
|
(((class color) (background dark)) :foreground "violet"))
|
|
|
|
|
"Basic face for visited links."
|
|
|
|
|
:group 'basic-faces
|
|
|
|
|
:version "22.1")
|
|
|
|
|
|
2005-09-29 22:55:13 +00:00
|
|
|
|
(defface highlight
|
|
|
|
|
'((((class color) (min-colors 88) (background light))
|
|
|
|
|
:background "darkseagreen2")
|
|
|
|
|
(((class color) (min-colors 88) (background dark))
|
|
|
|
|
:background "darkolivegreen")
|
|
|
|
|
(((class color) (min-colors 16) (background light))
|
|
|
|
|
:background "darkseagreen2")
|
|
|
|
|
(((class color) (min-colors 16) (background dark))
|
|
|
|
|
:background "darkolivegreen")
|
|
|
|
|
(((class color) (min-colors 8))
|
|
|
|
|
:background "green" :foreground "black")
|
|
|
|
|
(t :inverse-video t))
|
|
|
|
|
"Basic face for highlighting."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface region
|
|
|
|
|
'((((class color) (min-colors 88) (background dark))
|
|
|
|
|
:background "blue3")
|
|
|
|
|
(((class color) (min-colors 88) (background light))
|
|
|
|
|
:background "lightgoldenrod2")
|
|
|
|
|
(((class color) (min-colors 16) (background dark))
|
|
|
|
|
:background "blue3")
|
|
|
|
|
(((class color) (min-colors 16) (background light))
|
|
|
|
|
:background "lightgoldenrod2")
|
|
|
|
|
(((class color) (min-colors 8))
|
|
|
|
|
:background "blue" :foreground "white")
|
|
|
|
|
(((type tty) (class mono))
|
|
|
|
|
:inverse-video t)
|
|
|
|
|
(t :background "gray"))
|
|
|
|
|
"Basic face for highlighting the region."
|
|
|
|
|
:version "21.1"
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface secondary-selection
|
|
|
|
|
'((((class color) (min-colors 88) (background light))
|
|
|
|
|
:background "yellow1")
|
|
|
|
|
(((class color) (min-colors 88) (background dark))
|
|
|
|
|
:background "SkyBlue4")
|
|
|
|
|
(((class color) (min-colors 16) (background light))
|
|
|
|
|
:background "yellow")
|
|
|
|
|
(((class color) (min-colors 16) (background dark))
|
|
|
|
|
:background "SkyBlue4")
|
|
|
|
|
(((class color) (min-colors 8))
|
|
|
|
|
:background "cyan" :foreground "black")
|
|
|
|
|
(t :inverse-video t))
|
|
|
|
|
"Basic face for displaying the secondary selection."
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface trailing-whitespace
|
|
|
|
|
'((((class color) (background light))
|
|
|
|
|
:background "red1")
|
|
|
|
|
(((class color) (background dark))
|
|
|
|
|
:background "red1")
|
|
|
|
|
(t :inverse-video t))
|
|
|
|
|
"Basic face for highlighting trailing whitespace."
|
|
|
|
|
:version "21.1"
|
2005-12-11 11:09:33 +00:00
|
|
|
|
:group 'whitespace-faces ; like `show-trailing-whitespace'
|
2005-09-29 22:55:13 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface escape-glyph
|
|
|
|
|
'((((background dark)) :foreground "cyan")
|
|
|
|
|
;; See the comment in minibuffer-prompt for
|
|
|
|
|
;; the reason not to use blue on MS-DOS.
|
|
|
|
|
(((type pc)) :foreground "magenta")
|
|
|
|
|
;; red4 is too dark, but some say blue is too loud.
|
|
|
|
|
;; brown seems to work ok. -- rms.
|
|
|
|
|
(t :foreground "brown"))
|
2006-08-05 04:42:57 +00:00
|
|
|
|
"Face for characters displayed as sequences using `^' or `\\'."
|
2005-09-29 22:55:13 +00:00
|
|
|
|
:group 'basic-faces
|
|
|
|
|
:version "22.1")
|
|
|
|
|
|
|
|
|
|
(defface nobreak-space
|
|
|
|
|
'((((class color) (min-colors 88)) :inherit escape-glyph :underline t)
|
|
|
|
|
(((class color) (min-colors 8)) :background "magenta")
|
|
|
|
|
(t :inverse-video t))
|
|
|
|
|
"Face for displaying nobreak space."
|
|
|
|
|
:group 'basic-faces
|
|
|
|
|
:version "22.1")
|
1994-10-17 07:31:52 +00:00
|
|
|
|
|
2006-01-16 23:45:34 +00:00
|
|
|
|
(defgroup mode-line-faces nil
|
|
|
|
|
"Faces used in the mode line."
|
2006-09-14 23:54:44 +00:00
|
|
|
|
:group 'mode-line
|
2006-01-16 23:45:34 +00:00
|
|
|
|
:group 'faces
|
|
|
|
|
:version "22.1")
|
|
|
|
|
|
1999-09-12 20:21:44 +00:00
|
|
|
|
(defface mode-line
|
2004-12-23 18:28:13 +00:00
|
|
|
|
'((((class color) (min-colors 88))
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
:box (:line-width -1 :style released-button)
|
|
|
|
|
:background "grey75" :foreground "black")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
(t
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
:inverse-video t))
|
2002-02-08 23:51:56 +00:00
|
|
|
|
"Basic mode line face for selected window."
|
1999-09-13 13:59:58 +00:00
|
|
|
|
:version "21.1"
|
2006-01-16 23:45:34 +00:00
|
|
|
|
:group 'mode-line-faces
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'basic-faces)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
2002-02-08 23:51:56 +00:00
|
|
|
|
(defface mode-line-inactive
|
2004-12-13 19:29:33 +00:00
|
|
|
|
'((default
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
:inherit mode-line)
|
2004-12-23 18:28:13 +00:00
|
|
|
|
(((class color) (min-colors 88) (background light))
|
2002-02-08 23:51:56 +00:00
|
|
|
|
:weight light
|
|
|
|
|
:box (:line-width -1 :color "grey75" :style nil)
|
|
|
|
|
:foreground "grey20" :background "grey90")
|
2004-12-23 18:28:13 +00:00
|
|
|
|
(((class color) (min-colors 88) (background dark) )
|
2002-02-12 02:59:39 +00:00
|
|
|
|
:weight light
|
|
|
|
|
:box (:line-width -1 :color "grey40" :style nil)
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
:foreground "grey80" :background "grey30"))
|
2002-02-08 23:51:56 +00:00
|
|
|
|
"Basic mode line face for non-selected windows."
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1"
|
2006-01-16 23:45:34 +00:00
|
|
|
|
:group 'mode-line-faces
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(defface mode-line-highlight
|
|
|
|
|
'((((class color) (min-colors 88))
|
|
|
|
|
:box (:line-width 2 :color "grey40" :style released-button))
|
|
|
|
|
(t
|
|
|
|
|
:inherit highlight))
|
|
|
|
|
"Basic mode line face for highlighting."
|
|
|
|
|
:version "22.1"
|
|
|
|
|
:group 'mode-line-faces
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2008-03-11 02:58:23 +00:00
|
|
|
|
(defface mode-line-emphasis
|
|
|
|
|
'((t (:weight bold)))
|
|
|
|
|
"Face used to emphasize certain mode line features.
|
|
|
|
|
Use the face `mode-line-highlight' for features that can be selected."
|
|
|
|
|
:version "23.1"
|
|
|
|
|
:group 'mode-line-faces
|
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2006-01-16 23:45:34 +00:00
|
|
|
|
(defface mode-line-buffer-id
|
|
|
|
|
'((t (:weight bold)))
|
|
|
|
|
"Face used for buffer identification parts of the mode line."
|
|
|
|
|
:version "22.1"
|
|
|
|
|
:group 'mode-line-faces
|
2002-02-08 23:51:56 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
1999-09-12 20:21:44 +00:00
|
|
|
|
;; Make `modeline' an alias for `mode-line', for compatibility.
|
|
|
|
|
(put 'modeline 'face-alias 'mode-line)
|
2002-02-08 23:51:56 +00:00
|
|
|
|
(put 'modeline-inactive 'face-alias 'mode-line-inactive)
|
2005-06-11 13:10:11 +00:00
|
|
|
|
(put 'modeline-highlight 'face-alias 'mode-line-highlight)
|
2006-01-16 23:45:34 +00:00
|
|
|
|
(put 'modeline-buffer-id 'face-alias 'mode-line-buffer-id)
|
1997-04-21 03:56:57 +00:00
|
|
|
|
|
1999-09-05 16:38:56 +00:00
|
|
|
|
(defface header-line
|
2004-12-13 19:29:33 +00:00
|
|
|
|
'((default
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:inherit mode-line)
|
|
|
|
|
(((type tty))
|
2000-10-12 07:52:42 +00:00
|
|
|
|
;; This used to be `:inverse-video t', but that doesn't look very
|
|
|
|
|
;; good when combined with inverse-video mode-lines and multiple
|
|
|
|
|
;; windows. Underlining looks better, and is more consistent with
|
|
|
|
|
;; the window-system face variants, which deemphasize the
|
|
|
|
|
;; header-line in relation to the mode-line face. If a terminal
|
|
|
|
|
;; can't underline, then the header-line will end up without any
|
|
|
|
|
;; 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
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:inverse-video nil ;Override the value inherited from mode-line.
|
2002-07-03 07:09:44 +00:00
|
|
|
|
:underline t)
|
2000-10-23 04:50:20 +00:00
|
|
|
|
(((class color grayscale) (background light))
|
2000-11-14 09:02:02 +00:00
|
|
|
|
:background "grey90" :foreground "grey20"
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:box nil)
|
2000-10-23 04:50:20 +00:00
|
|
|
|
(((class color grayscale) (background dark))
|
2000-11-14 09:02:02 +00:00
|
|
|
|
:background "grey20" :foreground "grey90"
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:box nil)
|
2000-10-23 04:50:20 +00:00
|
|
|
|
(((class mono) (background light))
|
2000-11-14 09:02:02 +00:00
|
|
|
|
:background "white" :foreground "black"
|
|
|
|
|
:inverse-video nil
|
|
|
|
|
:box nil
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:underline t)
|
2000-10-23 04:50:20 +00:00
|
|
|
|
(((class mono) (background dark))
|
2000-11-14 09:02:02 +00:00
|
|
|
|
:background "black" :foreground "white"
|
|
|
|
|
:inverse-video nil
|
|
|
|
|
:box nil
|
2004-04-16 12:51:06 +00:00
|
|
|
|
:underline t))
|
1999-09-05 16:38:56 +00:00
|
|
|
|
"Basic header-line face."
|
1999-09-13 13:59:58 +00:00
|
|
|
|
:version "21.1"
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'basic-faces)
|
1997-05-25 21:39:38 +00:00
|
|
|
|
|
2005-09-29 22:55:13 +00:00
|
|
|
|
(defface vertical-border
|
|
|
|
|
'((((type tty)) :inherit mode-line-inactive))
|
|
|
|
|
"Face used for vertical window dividers on ttys."
|
|
|
|
|
:version "22.1"
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'basic-faces)
|
1997-04-21 03:56:57 +00:00
|
|
|
|
|
2005-08-23 21:01:24 +00:00
|
|
|
|
(defface minibuffer-prompt
|
|
|
|
|
'((((background dark)) :foreground "cyan")
|
|
|
|
|
;; Don't use blue because many users of the MS-DOS port customize
|
|
|
|
|
;; their foreground color to be blue.
|
|
|
|
|
(((type pc)) :foreground "magenta")
|
2007-03-04 17:44:42 +00:00
|
|
|
|
(t :foreground "medium blue"))
|
2005-08-23 21:01:24 +00:00
|
|
|
|
"Face for minibuffer prompts.
|
|
|
|
|
By default, Emacs automatically adds this face to the value of
|
|
|
|
|
`minibuffer-prompt-properties', which is a list of text properties
|
|
|
|
|
used to display the prompt text."
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1"
|
2001-12-24 16:39:31 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
|
|
|
|
(setq minibuffer-prompt-properties
|
|
|
|
|
(append minibuffer-prompt-properties (list 'face 'minibuffer-prompt)))
|
|
|
|
|
|
1999-09-07 14:48:52 +00:00
|
|
|
|
(defface fringe
|
2000-06-26 15:05:34 +00:00
|
|
|
|
'((((class color) (background light))
|
(face-spec-choose): Allow `t' to appear before the end.
(mode-line, tool-bar, minibuffer-prompt, region, fringe, bold, italic)
(bold-italic, underline, highlight, secondary-selection, fixed-pitch)
(variable-pitch, trailing-whitespace): Don't use the old-style entries.
(mode-line-inactive, header-line): Move the `t' section to the
beginning so the `:inherit' setting can be shared.
2002-03-04 23:00:28 +00:00
|
|
|
|
:background "grey95")
|
|
|
|
|
(((class color) (background dark))
|
|
|
|
|
:background "grey10")
|
|
|
|
|
(t
|
|
|
|
|
:background "gray"))
|
1999-09-07 14:48:52 +00:00
|
|
|
|
"Basic face for the fringes to the left and right of windows under X."
|
|
|
|
|
:version "21.1"
|
2000-02-16 22:58:42 +00:00
|
|
|
|
:group 'frames
|
1999-09-07 14:48:52 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2006-04-21 23:36:59 +00:00
|
|
|
|
(defface scroll-bar '((t nil))
|
1999-09-07 14:48:52 +00:00
|
|
|
|
"Basic face for the scroll bar colors under X."
|
|
|
|
|
:version "21.1"
|
2000-02-16 22:58:42 +00:00
|
|
|
|
:group 'frames
|
1999-09-07 14:48:52 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2006-04-21 23:36:59 +00:00
|
|
|
|
(defface border '((t nil))
|
1999-09-07 14:48:52 +00:00
|
|
|
|
"Basic face for the frame border under X."
|
|
|
|
|
:version "21.1"
|
2000-02-16 22:58:42 +00:00
|
|
|
|
:group 'frames
|
1999-09-07 14:48:52 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2006-04-21 23:36:59 +00:00
|
|
|
|
(defface cursor '((t nil))
|
2004-09-14 19:57:52 +00:00
|
|
|
|
"Basic face for the cursor color under X.
|
|
|
|
|
Note: Other faces cannot inherit from the cursor face."
|
1999-09-07 14:48:52 +00:00
|
|
|
|
:version "21.1"
|
2000-02-16 22:58:42 +00:00
|
|
|
|
:group 'cursor
|
1999-09-07 14:48:52 +00:00
|
|
|
|
:group 'basic-faces)
|
|
|
|
|
|
2004-09-14 19:57:52 +00:00
|
|
|
|
(put 'cursor 'face-no-inherit t)
|
1999-09-07 14:48:52 +00:00
|
|
|
|
|
2006-04-21 23:36:59 +00:00
|
|
|
|
(defface mouse '((t nil))
|
1999-09-07 14:48:52 +00:00
|
|
|
|
"Basic face for the mouse color under X."
|
1999-07-30 18:03:23 +00:00
|
|
|
|
:version "21.1"
|
2000-02-16 22:58:42 +00:00
|
|
|
|
:group 'mouse
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'basic-faces)
|
1993-05-11 19:14:34 +00:00
|
|
|
|
|
2005-09-29 22:55:13 +00:00
|
|
|
|
(defface tool-bar
|
|
|
|
|
'((default
|
|
|
|
|
:box (:line-width 1 :style released-button)
|
|
|
|
|
:foreground "black")
|
|
|
|
|
(((type x w32 mac) (class color))
|
|
|
|
|
:background "grey75")
|
|
|
|
|
(((type x) (class mono))
|
|
|
|
|
:background "grey"))
|
|
|
|
|
"Basic tool-bar face."
|
|
|
|
|
:version "21.1"
|
1999-07-21 21:43:52 +00:00
|
|
|
|
:group 'basic-faces)
|
1993-05-11 19:14:34 +00:00
|
|
|
|
|
2005-09-29 22:55:13 +00:00
|
|
|
|
(defface menu
|
|
|
|
|
'((((type tty))
|
|
|
|
|
:inverse-video t)
|
|
|
|
|
(((type x-toolkit))
|
|
|
|
|
)
|
2002-06-10 02:15:24 +00:00
|
|
|
|
(t
|
2005-09-29 22:55:13 +00:00
|
|
|
|
:inverse-video t))
|
|
|
|
|
"Basic face for the font and colors of the menu bar and popup menus."
|
1999-09-13 13:59:58 +00:00
|
|
|
|
:version "21.1"
|
2005-09-29 22:55:13 +00:00
|
|
|
|
:group 'menu
|
1999-09-13 13:59:58 +00:00
|
|
|
|
:group 'basic-faces)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;; Manipulating font names.
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;; This is here for compatibilty with Emacs 20.2. For example,
|
2000-05-14 15:30:59 +00:00
|
|
|
|
;; international/fontset.el uses x-resolve-font-name. The following
|
|
|
|
|
;; functions are not used in the face implementation itself.
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1996-12-16 01:33:02 +00:00
|
|
|
|
(defvar x-font-regexp nil)
|
|
|
|
|
(defvar x-font-regexp-head nil)
|
|
|
|
|
(defvar x-font-regexp-weight nil)
|
|
|
|
|
(defvar x-font-regexp-slant nil)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1995-07-25 22:06:08 +00:00
|
|
|
|
(defconst x-font-regexp-weight-subnum 1)
|
|
|
|
|
(defconst x-font-regexp-slant-subnum 2)
|
|
|
|
|
(defconst x-font-regexp-swidth-subnum 3)
|
|
|
|
|
(defconst x-font-regexp-adstyle-subnum 4)
|
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
;;; Regexps matching font names in "Host Portable Character Representation."
|
|
|
|
|
;;;
|
|
|
|
|
(let ((- "[-?]")
|
|
|
|
|
(foundry "[^-]+")
|
|
|
|
|
(family "[^-]+")
|
|
|
|
|
(weight "\\(bold\\|demibold\\|medium\\)") ; 1
|
|
|
|
|
; (weight\? "\\(\\*\\|bold\\|demibold\\|medium\\|\\)") ; 1
|
|
|
|
|
(weight\? "\\([^-]*\\)") ; 1
|
|
|
|
|
(slant "\\([ior]\\)") ; 2
|
|
|
|
|
; (slant\? "\\([ior?*]?\\)") ; 2
|
|
|
|
|
(slant\? "\\([^-]?\\)") ; 2
|
|
|
|
|
; (swidth "\\(\\*\\|normal\\|semicondensed\\|\\)") ; 3
|
|
|
|
|
(swidth "\\([^-]*\\)") ; 3
|
|
|
|
|
; (adstyle "\\(\\*\\|sans\\|\\)") ; 4
|
1995-07-27 19:10:36 +00:00
|
|
|
|
(adstyle "\\([^-]*\\)") ; 4
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(pixelsize "[0-9]+")
|
|
|
|
|
(pointsize "[0-9][0-9]+")
|
|
|
|
|
(resx "[0-9][0-9]+")
|
|
|
|
|
(resy "[0-9][0-9]+")
|
|
|
|
|
(spacing "[cmp?*]")
|
|
|
|
|
(avgwidth "[0-9]+")
|
|
|
|
|
(registry "[^-]+")
|
|
|
|
|
(encoding "[^-]+")
|
|
|
|
|
)
|
|
|
|
|
(setq x-font-regexp
|
|
|
|
|
(concat "\\`\\*?[-?*]"
|
|
|
|
|
foundry - family - weight\? - slant\? - swidth - adstyle -
|
1995-07-02 08:34:02 +00:00
|
|
|
|
pixelsize - pointsize - resx - resy - spacing - avgwidth -
|
|
|
|
|
registry - encoding "\\*?\\'"
|
1993-04-03 23:28:03 +00:00
|
|
|
|
))
|
|
|
|
|
(setq x-font-regexp-head
|
|
|
|
|
(concat "\\`[-?*]" foundry - family - weight\? - slant\?
|
|
|
|
|
"\\([-*?]\\|\\'\\)"))
|
|
|
|
|
(setq x-font-regexp-slant (concat - slant -))
|
|
|
|
|
(setq x-font-regexp-weight (concat - weight -))
|
2000-05-09 15:45:57 +00:00
|
|
|
|
nil)
|
1993-04-03 23:28:03 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-05-25 13:19:28 +00:00
|
|
|
|
(defun x-resolve-font-name (pattern &optional face frame)
|
|
|
|
|
"Return a font name matching PATTERN.
|
2000-05-10 09:35:14 +00:00
|
|
|
|
All wildcards in PATTERN are instantiated.
|
1993-05-26 19:42:36 +00:00
|
|
|
|
If PATTERN is nil, return the name of the frame's base font, which never
|
|
|
|
|
contains wildcards.
|
1994-12-15 13:49:51 +00:00
|
|
|
|
Given optional arguments FACE and FRAME, return a font which is
|
|
|
|
|
also the same size as FACE on FRAME, or fail."
|
1993-05-29 04:36:40 +00:00
|
|
|
|
(or (symbolp face)
|
|
|
|
|
(setq face (face-name face)))
|
|
|
|
|
(and (eq frame t)
|
|
|
|
|
(setq frame nil))
|
1993-05-26 19:42:36 +00:00
|
|
|
|
(if pattern
|
1993-11-21 07:23:17 +00:00
|
|
|
|
;; Note that x-list-fonts has code to handle a face with nil as its font.
|
1996-08-31 22:03:30 +00:00
|
|
|
|
(let ((fonts (x-list-fonts pattern face frame 1)))
|
1993-05-26 19:42:36 +00:00
|
|
|
|
(or fonts
|
|
|
|
|
(if face
|
1995-01-28 08:27:31 +00:00
|
|
|
|
(if (string-match "\\*" pattern)
|
|
|
|
|
(if (null (face-font face))
|
|
|
|
|
(error "No matching fonts are the same height as the frame default font")
|
|
|
|
|
(error "No matching fonts are the same height as face `%s'" face))
|
|
|
|
|
(if (null (face-font face))
|
|
|
|
|
(error "Height of font `%s' doesn't match the frame default font"
|
|
|
|
|
pattern)
|
|
|
|
|
(error "Height of font `%s' doesn't match face `%s'"
|
|
|
|
|
pattern face)))
|
1993-05-31 18:02:03 +00:00
|
|
|
|
(error "No fonts match `%s'" pattern)))
|
1993-05-26 19:42:36 +00:00
|
|
|
|
(car fonts))
|
|
|
|
|
(cdr (assq 'font (frame-parameters (selected-frame))))))
|
1993-05-25 13:19:28 +00:00
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-frob-font-weight (font which)
|
1995-12-12 08:20:37 +00:00
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(cond ((string-match x-font-regexp font)
|
|
|
|
|
(concat (substring font 0
|
|
|
|
|
(match-beginning x-font-regexp-weight-subnum))
|
|
|
|
|
which
|
|
|
|
|
(substring font (match-end x-font-regexp-weight-subnum)
|
|
|
|
|
(match-beginning x-font-regexp-adstyle-subnum))
|
|
|
|
|
;; Replace the ADD_STYLE_NAME field with *
|
|
|
|
|
;; because the info in it may not be the same
|
|
|
|
|
;; for related fonts.
|
|
|
|
|
"*"
|
|
|
|
|
(substring font (match-end x-font-regexp-adstyle-subnum))))
|
1996-03-25 15:09:27 +00:00
|
|
|
|
((string-match x-font-regexp-head font)
|
|
|
|
|
(concat (substring font 0 (match-beginning 1)) which
|
|
|
|
|
(substring font (match-end 1))))
|
|
|
|
|
((string-match x-font-regexp-weight font)
|
1995-12-12 08:20:37 +00:00
|
|
|
|
(concat (substring font 0 (match-beginning 1)) which
|
|
|
|
|
(substring font (match-end 1)))))))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-frob-font-weight 'make-face-... "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-frob-font-slant (font which)
|
1995-12-12 08:20:37 +00:00
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(cond ((string-match x-font-regexp font)
|
|
|
|
|
(concat (substring font 0
|
|
|
|
|
(match-beginning x-font-regexp-slant-subnum))
|
|
|
|
|
which
|
|
|
|
|
(substring font (match-end x-font-regexp-slant-subnum)
|
|
|
|
|
(match-beginning x-font-regexp-adstyle-subnum))
|
|
|
|
|
;; Replace the ADD_STYLE_NAME field with *
|
|
|
|
|
;; because the info in it may not be the same
|
|
|
|
|
;; for related fonts.
|
|
|
|
|
"*"
|
|
|
|
|
(substring font (match-end x-font-regexp-adstyle-subnum))))
|
1996-03-25 15:09:27 +00:00
|
|
|
|
((string-match x-font-regexp-head font)
|
|
|
|
|
(concat (substring font 0 (match-beginning 2)) which
|
|
|
|
|
(substring font (match-end 2))))
|
|
|
|
|
((string-match x-font-regexp-slant font)
|
1995-12-12 08:20:37 +00:00
|
|
|
|
(concat (substring font 0 (match-beginning 1)) which
|
|
|
|
|
(substring font (match-end 1)))))))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
2001-10-26 21:16:09 +00:00
|
|
|
|
;; These aliases are here so that we don't get warnings about obsolete
|
|
|
|
|
;; functions from the byte compiler.
|
|
|
|
|
(defalias 'internal-frob-font-weight 'x-frob-font-weight)
|
|
|
|
|
(defalias 'internal-frob-font-slant 'x-frob-font-slant)
|
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-bold (font)
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make a bold version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-weight font "bold"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-bold 'make-face-bold "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-demibold (font)
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make a demibold version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-weight font "demibold"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-demibold 'make-face-bold "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-unbold (font)
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make a non-bold version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-weight font "medium"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-unbold 'make-face-unbold "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-italic (font)
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make an italic version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-slant font "i"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-italic 'make-face-italic "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-oblique (font) ; you say tomayto...
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make an oblique version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-slant font "o"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-oblique 'make-face-italic "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1993-04-03 23:28:03 +00:00
|
|
|
|
(defun x-make-font-unitalic (font)
|
1993-08-03 07:12:34 +00:00
|
|
|
|
"Given an X font specification, make a non-italic version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(internal-frob-font-slant font "r"))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-unitalic 'make-face-unitalic "21.1")
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
1997-05-12 05:26:35 +00:00
|
|
|
|
(defun x-make-font-bold-italic (font)
|
|
|
|
|
"Given an X font specification, make a bold and italic version of it.
|
|
|
|
|
If that can't be done, return nil."
|
2001-10-26 21:16:09 +00:00
|
|
|
|
(and (setq font (internal-frob-font-weight font "bold"))
|
|
|
|
|
(internal-frob-font-slant font "i")))
|
2000-06-01 05:07:32 +00:00
|
|
|
|
(make-obsolete 'x-make-font-bold-italic 'make-face-bold-italic "21.1")
|
1997-10-23 06:36:33 +00:00
|
|
|
|
|
1993-05-09 23:48:41 +00:00
|
|
|
|
(provide 'faces)
|
|
|
|
|
|
2005-06-13 20:47:08 +00:00
|
|
|
|
;; arch-tag: 19a4759f-2963-445f-b004-425b9aadd7d6
|
2000-05-09 15:45:57 +00:00
|
|
|
|
;;; faces.el ends here
|