Mercurial > hg > xemacs-beta
view man/lispref/faces.texi @ 5353:38e24b8be4ea
Improve the lexical scoping in #'block, #'return-from.
lisp/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el:
* bytecomp.el (byte-compile-initial-macro-environment):
Shadow `block', `return-from' here, we implement them differently
when byte-compiling.
* bytecomp.el (byte-compile-active-blocks): New.
* bytecomp.el (byte-compile-block-1): New.
* bytecomp.el (byte-compile-return-from-1): New.
* bytecomp.el (return-from-1): New.
* bytecomp.el (block-1): New.
These are two aliases that exist to have their own associated
byte-compile functions, which functions implement `block' and
`return-from'.
* cl-extra.el (cl-macroexpand-all):
Fix a bug here when macros in the environment have been compiled.
* cl-macs.el (block):
* cl-macs.el (return):
* cl-macs.el (return-from):
Be more careful about lexical scope in these macros.
* cl.el:
* cl.el ('cl-block-wrapper): Removed.
* cl.el ('cl-block-throw): Removed.
These aren't needed in code generated by this XEmacs. They
shouldn't be needed in code generated by XEmacs 21.4, but if it
turns out the packages do need them, we can put them back.
2011-01-30 Mike Sperber <mike@xemacs.org>
* font-lock.el (font-lock-fontify-pending-extents): Don't fail if
`font-lock-mode' is unset, which can happen in the middle of
`revert-buffer'.
2011-01-23 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete):
* cl-macs.el (delq):
* cl-macs.el (remove):
* cl-macs.el (remq):
Don't use the compiler macro if these functions were given the
wrong number of arguments, as happens in lisp-tests.el.
* cl-seq.el (remove, remq): Removed.
I added these to subr.el, and forgot to remove them from here.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-setq, byte-compile-set):
Remove kludge allowing keywords' values to be set, all the code
that does that is gone.
* cl-compat.el (elt-satisfies-test-p):
* faces.el (set-face-parent):
* faces.el (face-doc-string):
* gtk-font-menu.el:
* gtk-font-menu.el (gtk-reset-device-font-menus):
* msw-font-menu.el:
* msw-font-menu.el (mswindows-reset-device-font-menus):
* package-get.el (package-get-installedp):
* select.el (select-convert-from-image-data):
* sound.el:
* sound.el (load-sound-file):
* x-font-menu.el (x-reset-device-font-menus-core):
Don't quote keywords, they're self-quoting, and the
win from backward-compatibility is sufficiently small now that the
style problem overrides it.
2011-01-22 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (block, return-from): Require that NAME be a symbol
in these macros, as always documented in the #'block docstring and
as required by Common Lisp.
* descr-text.el (unidata-initialize-unihan-database):
Correct the use of non-symbols in #'block and #'return-from in
this function.
2011-01-15 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (concatenate): Accept more complicated TYPEs in this
function, handing the sequences over to #'coerce if we don't
understand them here.
* cl-macs.el (inline): Don't proclaim #'concatenate as inline, its
compiler macro is more useful than doing that.
2011-01-11 Aidan Kehoe <kehoea@parhasard.net>
* subr.el (delete, delq, remove, remq): Move #'remove, #'remq
here, they don't belong in cl-seq.el; move #'delete, #'delq here
from fns.c, implement them in terms of #'delete*, allowing support
for sequences generally.
* update-elc.el (do-autoload-commands): Use #'delete*, not #'delq
here, now the latter's no longer dumped.
* cl-macs.el (delete, delq): Add compiler macros transforming
#'delete and #'delq to #'delete* calls.
2011-01-10 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box): Correct a misplaced parenthesis
here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se !
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* dialog.el (make-dialog-box):
* list-mode.el (display-completion-list):
These functions used to use cl-parsing-keywords; change them to
use defun* instead, fixing the build. (Not sure what led to me
not including this change in d1b17a33450b!)
2011-01-02 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (define-star-compiler-macros):
Make sure the form has ITEM and LIST specified before attempting
to change to calls with explicit tests; necessary for some tests
in lisp-tests.el to compile correctly.
(stable-union, stable-intersection): Add compiler macros for these
functions, in the same way we do for most of the other functions
in cl-seq.el.
2011-01-01 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (dolist, dotimes, do-symbols, macrolet)
(symbol-macrolet):
Define these macros with defmacro* instead of parsing the argument
list by hand, for the sake of style and readability; use backquote
where appropriate, instead of calling #'list and and friends, for
the same reason.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* x-misc.el (device-x-display):
Provide this function, documented in the Lispref for years, but
not existing previously. Thank you Julian Bradfield, thank you
Jeff Mincy.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl-seq.el:
Move the heavy lifting from this file to C. Dump the
cl-parsing-keywords macro, but don't use defun* for the functions
we define that do take keywords, dynamic scope lossage makes that
not practical.
* subr.el (sort, fillarray): Move these aliases here.
(map-plist): #'nsublis is now built-in, but at this point #'eql
isn't necessarily available as a test; use #'eq.
* obsolete.el (cl-delete-duplicates): Make this available for old
compiler macros and old code.
(memql): Document that this is equivalent to #'member*, and worse.
* cl.el (adjoin, subst): Removed. These are in C.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* simple.el (assoc-ignore-case): Remove a duplicate definition of
this function (it's already in subr.el).
* iso8859-1.el (char-width):
On non-Mule, make this function equivalent to that produced by
(constantly 1), but preserve its docstring.
* subr.el (subst-char-in-string): Define this in terms of
#'substitute, #'nsubstitute.
(string-width): Define this using #'reduce and #'char-width.
(char-width): Give this a simpler definition, it makes far more
sense to check for mule at load time and redefine, as we do in
iso8859-1.el.
(store-substring): Implement this in terms of #'replace, now
#'replace is cheap.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* update-elc.el (lisp-files-needed-for-byte-compilation)
(lisp-files-needing-early-byte-compilation):
cl-macs belongs in the former, not the latter, it is as
fundamental as bytecomp.el.
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl.el:
Provde the Common Lisp program-error, type-error as error
symbols. This doesn't nearly go far enough for anyone using the
Common Lisp errors.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (delete-duplicates):
If the form has an incorrect number of arguments, don't attempt a
compiler macroexpansion.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (cl-safe-expr-p):
Forms that start with the symbol lambda are also safe.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
For these functions' compiler macros, the optimisation is safe
even if the first and the last arguments have side effects, since
they're only used the once.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
Unroll a loop here at macro-expansion time, so these compiler
macros are compiled. Use #'eql instead of #'eq in a couple of
places for better style.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (notany, notevery): Avoid some dynamic scope
stupidity with local variable names in these functions, when they
weren't prefixed with cl-; go into some more detail in the doc
strings.
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
free of side-effects.
(side-effect-and-error-free-fns):
Drop dot, dot-marker from the list.
2010-11-17 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (coerce):
In the argument list, name the first argument OBJECT, not X; the
former name was always used in the doc string and is clearer.
Handle vector type specifications which include the length of the
target sequence, error if there's a mismatch.
* cl-macs.el (cl-make-type-test): Handle type specifications
starting with the symbol 'eql.
2010-11-14 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (eql): Don't remove the byte-compile property of this
symbol. That was necessary to override a bug in bytecomp.el where
#'eql was confused with #'eq, which bug we no longer have.
If neither expression is constant, don't attempt to handle the
expression in this compiler macro, leave it to byte-compile-eql,
which produces better code anyway.
* bytecomp.el (eq): #'eql is not the function associated with the
byte-eq byte code.
(byte-compile-eql): Add an explicit compile method for this
function, for cases where the cl-macs compiler macro hasn't
reduced it to #'eq or #'equal.
2010-10-25 Aidan Kehoe <kehoea@parhasard.net>
Add compiler macros and compilation sanity-checking for various
functions that take keywords.
* byte-optimize.el (side-effect-free-fns): #'symbol-value is
side-effect free and not error free.
* bytecomp.el (byte-compile-normal-call): Check keyword argument
lists for sanity; store information about the positions where
keyword arguments start using the new byte-compile-keyword-start
property.
* cl-macs.el (cl-const-expr-val): Take a new optional argument,
cl-not-constant, defaulting to nil, in this function; return it if
the expression is not constant.
(cl-non-fixnum-number-p): Make this into a separate function, we
want to pass it to #'every.
(eql): Use it.
(define-star-compiler-macros): Use the same code to generate the
member*, assoc* and rassoc* compiler macros; special-case some
code in #'add-to-list in subr.el.
(remove, remq): Add compiler macros for these two functions, in
preparation for #'remove being in C.
(define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to
(remove ... :if-not) at compile time, which will be a real win
once the latter is in C.
(define-substitute-if-compiler-macros)
(define-subst-if-compiler-macros): Similarly for these functions.
(delete-duplicates): Change this compiler macro to use
#'plists-equal; if we don't have information about the type of
SEQUENCE at compile time, don't bother attempting to inline the
call, the function will be in C soon enough.
(equalp): Remove an old commented-out compiler macro for this, if
we want to see it it's in version control.
(subst-char-in-string): Transform this to a call to nsubstitute or
nsubstitute, if that is appropriate.
* cl.el (ldiff): Don't call setf here, this makes for a load-time
dependency problem in cl-macs.el
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* term/vt100.el:
Refer to XEmacs, not GNU Emacs, in permissions.
* term/bg-mouse.el:
* term/sup-mouse.el:
Put copyright notice in canonical "Copyright DATE AUTHOR" form.
Refer to XEmacs, not GNU Emacs, in permissions.
* site-load.el:
Add permission boilerplate.
* mule/canna-leim.el:
* alist.el:
Refer to XEmacs, not APEL/this program, in permissions.
* mule/canna-leim.el:
Remove my copyright, I've assigned it to the FSF.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* gtk.el:
* gtk-widget-accessors.el:
* gtk-package.el:
* gtk-marshal.el:
* gtk-compose.el:
* gnome.el:
Add copyright notice based on internal evidence.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* easymenu.el: Add reference to COPYING to permission notice.
* gutter.el:
* gutter-items.el:
* menubar-items.el:
Fix typo "Xmacs" in permissions notice.
2010-06-14 Stephen J. Turnbull <stephen@xemacs.org>
* auto-save.el:
* font.el:
* fontconfig.el:
* mule/kinsoku.el:
Add "part of XEmacs" text to permission notice.
2010-10-14 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (side-effect-free-fns):
* cl-macs.el (remf, getf):
* cl-extra.el (tailp, cl-set-getf, cl-do-remf):
* cl.el (ldiff, endp):
Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp;
add circularity checking for the first two.
#'cl-set-getf and #'cl-do-remf were Lisp implementations of
#'plist-put and #'plist-remprop; change the names to aliases,
changes the macros that use them to using #'plist-put and
#'plist-remprop directly.
2010-10-12 Aidan Kehoe <kehoea@parhasard.net>
* abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table):
Create both these abbrev tables using the usual
#'define-abbrev-table calls, rather than attempting to
special-case them.
* cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is
being loaded interpreted. Previously other, later files would
redundantly call (load "cl-macs") when interpreted, it's more
reasonable to do it here, once.
* cmdloop.el (read-quoted-char-radix): Use defcustom here, we
don't have any dump-order dependencies that would prevent that.
* custom.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling, rely on cl-extra.el in the
former case and the appropriate entry in bytecomp-load-hook in the
latter. Get rid of custom-declare-variable-list, we have no
dump-time dependencies that would require it.
* faces.el (eval-when-compile): Don't load cl-macs when
interpreted or when byte-compiling.
* packages.el: Remove some inaccurate comments.
* post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not
here, now the order of preloaded-file-list has been changed to
make it available.
* subr.el (custom-declare-variable-list): Remove. No need for it.
Also remove a stub define-abbrev-table from this file, given the
current order of preloaded-file-list there's no need for it.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are
also constant.
(byte-compile-initial-macro-environment): In #'the, if FORM is
constant and does not match TYPE, warn at byte-compile time.
2010-10-10 Aidan Kehoe <kehoea@parhasard.net>
* backquote.el (bq-vector-contents, bq-list*): Remove; the former
is equivalent to (append VECTOR nil), the latter to (list* ...).
(bq-process-2): Use (append VECTOR nil) instead of using
#'bq-vector-contents to convert to a list.
(bq-process-1): Now we use list* instead of bq-list
* subr.el (list*): Moved from cl.el, since it is now required to
be available the first time a backquoted form is encountered.
* cl.el (list*): Move to subr.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* test-harness.el (Check-Message):
Add an omitted comma here, thank you the buildbot.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* hash-table.el (hash-table-key-list, hash-table-value-list)
(hash-table-key-value-alist, hash-table-key-value-plist):
Remove some useless #'nreverse calls in these files; our hash
tables have no order, it's not helpful to pretend they do.
* behavior.el (read-behavior):
Do the same in this file, in some code evidently copied from
hash-table.el.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* info.el (Info-insert-dir):
* format.el (format-deannotate-region):
* files.el (cd, save-buffers-kill-emacs):
Use #'some, #'every and related functions for applying boolean
operations to lists, instead of rolling our own ones that cons and
don't short-circuit.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
* cl-macs.el (the):
Rephrase the docstring, make its implementation when compiling
files a little nicer.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* descr-text.el (unidata-initialize-unicodedata-database)
(unidata-initialize-unihan-database, describe-char-unicode-data)
(describe-char-unicode-data):
Wrap calls to the database functions with (with-fboundp ...),
avoiding byte compile warnings on builds without support for the
database functions.
(describe-char): (reduce #'max ...), not (apply #'max ...), no
need to cons needlessly.
(describe-char): Remove a redundant lambda wrapping
#'extent-properties.
(describe-char-unicode-data): Call #'nsubst when replacing "" with
nil in the result of #'split-string, instead of consing inside
mapcar.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* x-faces.el (x-available-font-sizes):
* specifier.el (let-specifier):
* package-ui.el (pui-add-required-packages):
* msw-faces.el (mswindows-available-font-sizes):
* modeline.el (modeline-minor-mode-menu):
* minibuf.el (minibuf-directory-files):
Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with
the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (= < > <= >=):
When these functions are handed more than two arguments, and those
arguments have no side effects, transform to a series of two
argument calls, avoiding funcall in the byte-compiled code.
* mule/mule-cmds.el (finish-set-language-environment):
Take advantage of this change in a function called 256 times at
startup.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-function-form, byte-compile-quote)
(byte-compile-quote-form):
Warn at compile time, and error at runtime, if a (quote ...) or a
(function ...) form attempts to quote more than one object.
2010-09-16 Aidan Kehoe <kehoea@parhasard.net>
* byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc
(mapcar ...)) to (mapcan ...); warn about use of the first idiom.
* update-elc.el (do-autoload-commands):
* packages.el (packages-find-package-library-path):
* frame.el (frame-list):
* extents.el (extent-descendants):
* etags.el (buffer-tag-table-files):
* dumped-lisp.el (preloaded-file-list):
* device.el (device-list):
* bytecomp-runtime.el (proclaim-inline, proclaim-notinline)
Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files.
* bytecomp-runtime.el (eval-when-compile, eval-and-compile):
In passing, mention that these macros also evaluate the body when
interpreted.
tests/ChangeLog addition:
2011-02-07 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Test lexical scope for `block', `return-from'; add a
Known-Bug-Expect-Failure for a contorted example that fails when
byte-compiled.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 07 Feb 2011 12:01:24 +0000 |
parents | f200f93c0b69 |
children | b6e59ea11533 |
line wrap: on
line source
@c -*-texinfo-*- @c This is part of the XEmacs Lisp Reference Manual. @c Copyright (C) 1995 Ben Wing. @c See the file lispref.texi for copying conditions. @setfilename ../../info/faces.info @node Faces and Window-System Objects, Glyphs, Specifiers, top @chapter Faces and Window-System Objects @cindex faces @cindex window-system objects @menu * Faces:: Controlling the way text looks. * Fonts:: Controlling the typeface of text. * Colors:: Controlling the color of text and pixmaps. @end menu @node Faces @section Faces A @dfn{face} is a named collection of graphical properties: font, foreground color, background color, background pixmap, optional underlining, and (on TTY devices) whether the text is to be highlighted, dimmed, blinking, or displayed in reverse video. Faces control the display of text on the screen. Every face has a name, which is a symbol such as @code{default} or @code{modeline}. Each built-in property of a face is controlled using a specifier, which allows it to have separate values in particular buffers, frames, windows, and devices and to further vary according to device type (X or TTY) and device class (color, mono, or grayscale). @xref{Specifiers}, for more information. The face named @code{default} is used for ordinary text. The face named @code{modeline} is used for displaying the modeline. The face named @code{highlight} is used for highlighted extents (@pxref{Extents}). The faces named @code{left-margin} and @code{right-margin} are used for the left and right margin areas, respectively (@pxref{Annotations}). The face named @code{zmacs-region} is used for the highlighted region between point and mark. @menu * Merging Faces:: How XEmacs decides which face to use for a character. * Basic Face Functions:: How to define and examine faces. * Face Properties:: How to access and modify a face's properties. * Face Convenience Functions:: Convenience functions for accessing particular properties of a face. * Other Face Display Functions:: Other functions pertaining to how a a face appears. @end menu @node Merging Faces @subsection Merging Faces for Display Here are all the ways to specify which face to use for display of text: @itemize @bullet @item With defaults. Each frame has a @dfn{default face}, which is used for all text that doesn't somehow specify another face. The face named @code{default} applies to the text area, while the faces @code{left-margin} and @code{right-margin} apply to the left and right margin areas. @item With text properties. A character may have a @code{face} property; if so, it's displayed with that face. (Text properties are actually implemented in terms of extents.) @xref{Text Properties}. @item With extents. An extent may have a @code{face} property, which applies to all the text covered by the extent; in addition, if the @code{highlight} property is set, the @code{highlight} property applies when the mouse moves over the extent or if the extent is explicitly highlighted. @xref{Extents}. @item With annotations. Annotations that are inserted into a buffer can specify their own face. (Annotations are actually implemented in terms of extents.) @xref{Annotations}. @end itemize If these various sources together specify more than one face for a particular character, XEmacs merges the properties of the various faces specified. Extents, text properties, and annotations all use the same underlying representation (as extents). When multiple extents cover one character, an extent with higher priority overrides those with lower priority. @xref{Extents}. If no extent covers a particular character, the @code{default} face is used. @cindex background pixmap If a background pixmap is specified, it determines what will be displayed in the background of text characters. If the background pixmap is actually a pixmap, with its colors specified, those colors are used; if it is a bitmap, the face's foreground and background colors are used to color it. @node Basic Face Functions @subsection Basic Functions for Working with Faces The properties a face can specify include the font, the foreground color, the background color, the background pixmap, the underlining, the display table, and (for TTY devices) whether the text is to be highlighted, dimmed, blinking, or displayed in reverse video. The face can also leave these unspecified, causing them to assume the value of the corresponding property of the @code{default} face. Here are the basic primitives for working with faces. @defun make-face name &optional doc-string temporary This function defines and returns a new face named @var{name}, initially with all properties unspecified. It does nothing if there is already a face named @var{name}. Optional argument @var{doc-string} specifies an explanatory string used for descriptive purposes. If optional argument @var{temporary} is non-@code{nil}, the face will automatically disappear when there are no more references to it anywhere in text or Lisp code (otherwise, the face will continue to exist indefinitely even if it is not used). @end defun @defun face-list &optional temporary This function returns a list of the names of all defined faces. If @var{temporary} is @code{nil}, only the permanent faces are included. If it is @code{t}, only the temporary faces are included. If it is any other non-@code{nil} value both permanent and temporary are included. @end defun @defun facep object This function returns @code{t} if @var{object} is a face, else @code{nil}. @end defun @defun copy-face old-face new-name &optional locale tag-set exact-p how-to-add This function defines a new face named @var{new-name} which is a copy of the existing face named @var{old-face}. If there is already a face named @var{new-name}, then it alters the face to have the same properties as @var{old-face}. @var{locale}, @var{tag-set}, @var{exact-p} and @var{how-to-add} let you copy just parts of the old face rather than the whole face, and are as in @code{copy-specifier} (@pxref{Specifiers}). @end defun Finally, you have the possibility to give faces different names by means of aliases. One typical use of this feature is to change the name of a face while preserving backward compatibility. If a symbol has the @code{face-alias} property set to another symbol, then this other symbol will be used as the real face name instead. Recursive aliases (aliases of aliases) are allowed, but the depth of indirection is limited to 32 to prevent alias loops. @node Face Properties @subsection Face Properties You can examine and modify the properties of an existing face with the following functions. The following symbols have predefined meanings: @table @code @item foreground The foreground color of the face. @item background The background color of the face. @item font The font used to display text covered by this face. @item display-table The display table of the face. @item background-pixmap The pixmap displayed in the background of the face. Only used by faces on GUI devices, currently X11, GTK, and Microsoft Windows. @item underline Underline all text covered by this face. @item highlight Highlight all text covered by this face. Only used by faces on TTY devices. @item dim Dim all text covered by this face. Only used by faces on TTY devices. @item blinking Blink all text covered by this face. Only used by faces on TTY devices. @item reverse Reverse the foreground and background colors. Only used by faces on TTY devices. @item doc-string Description of what the face's normal use is. NOTE: This is not a specifier, unlike all the other built-in properties, and cannot contain locale-specific values. @end table @defun set-face-property face property value &optional locale tag-set how-to-add This function changes a property of a @var{face}. For built-in properties, the actual value of the property is a specifier and you cannot change this; but you can change the specifications within the specifier, and that is what this function will do. For user-defined properties, you can use this function to either change the actual value of the property or, if this value is a specifier, change the specifications within it. If @var{property} is a built-in property, the specifications to be added to this property can be supplied in many different ways: @itemize @bullet If @var{value} is a simple instantiator (e.g. a string naming a font or color) or a list of instantiators, then the instantiator(s) will be added as a specification of the property for the given @var{locale} (which defaults to @code{global} if omitted). If @var{value} is a list of specifications (each of which is a cons of a locale and a list of instantiators), then @var{locale} must be @code{nil} (it does not make sense to explicitly specify a locale in this case), and specifications will be added as given. If @var{value} is a specifier (as would be returned by @code{face-property} if no @var{locale} argument is given), then some or all of the specifications in the specifier will be added to the property. In this case, the function is really equivalent to @code{copy-specifier} and @var{locale} has the same semantics (if it is a particular locale, the specification for the locale will be copied; if a locale type, specifications for all locales of that type will be copied; if @code{nil} or @code{all}, then all specifications will be copied). @end itemize @var{how-to-add} should be either @code{nil} or one of the symbols @code{prepend}, @code{append}, @code{remove-tag-set-prepend}, @code{remove-tag-set-append}, @code{remove-locale}, @code{remove-locale-type}, or @code{remove-all}. See @code{copy-specifier} and @code{add-spec-to-specifier} for a description of what each of these means. Most of the time, you do not need to worry about this argument; the default behavior usually is fine. In general, it is OK to pass an instance object (e.g. as returned by @code{face-property-instance}) as an instantiator in place of an actual instantiator. In such a case, the instantiator used to create that instance object will be used (for example, if you set a font-instance object as the value of the @code{font} property, then the font name used to create that object will be used instead). If some cases, however, doing this conversion does not make sense, and this will be noted in the documentation for particular types of instance objects. If @var{property} is not a built-in property, then this function will simply set its value if @var{locale} is @code{nil}. However, if @var{locale} is given, then this function will attempt to add @var{value} as the instantiator for the given @var{locale}, using @code{add-spec-to-specifier}. If the value of the property is not a specifier, it will automatically be converted into a @code{generic} specifier. @end defun @defun remove-face-property face property &optional locale tag-set exact-p This function removes a property of a @var{face}. For built-in properties, this is analogous to @code{remove-specifier}. For more information, @xref{Other Specification Functions}. When @var{property} is not a built-in property, this function will just remove its value if @var{locale} is @code{nil} or @code{all}. However, if @var{locale} is other than that, this function will attempt to remove @var{value} as the instantiator for the given @var{locale} with @code{remove-specifier}. If the value of the property is not a specifier, it will be converted into a @code{generic} specifier automatically. @end defun @defun face-property face property &optional locale tag-set exact-p This function returns @var{face}'s value of the given @var{property}. If @var{locale} is omitted, the @var{face}'s actual value for @var{property} will be returned. For built-in properties, this will be a specifier object of a type appropriate to the property (e.g. a font or color specifier). For other properties, this could be anything. If @var{locale} is supplied, then instead of returning the actual value, the specification(s) for the given locale or locale type will be returned. This will only work if the actual value of @var{property} is a specifier (this will always be the case for built-in properties, but not or not may apply to user-defined properties). If the actual value of @var{property} is not a specifier, this value will simply be returned regardless of @var{locale}. The return value will be a list of instantiators (e.g. strings specifying a font or color name), or a list of specifications, each of which is a cons of a locale and a list of instantiators. Specifically, if @var{locale} is a particular locale (a buffer, window, frame, device, or @code{global}), a list of instantiators for that locale will be returned. Otherwise, if @var{locale} is a locale type (one of the symbols @code{buffer}, @code{window}, @code{frame}, or @code{device}), the specifications for all locales of that type will be returned. Finally, if @var{locale} is @code{all}, the specifications for all locales of all types will be returned. The specifications in a specifier determine what the value of @var{property} will be in a particular @dfn{domain} or set of circumstances, which is typically a particular Emacs window along with the buffer it contains and the frame and device it lies within. The value is derived from the instantiator associated with the most specific locale (in the order buffer, window, frame, device, and @code{global}) that matches the domain in question. In other words, given a domain (i.e. an Emacs window, usually), the specifier for @var{property} will first be searched for a specification whose locale is the buffer contained within that window; then for a specification whose locale is the window itself; then for a specification whose locale is the frame that the window is contained within; etc. The first instantiator that is valid for the domain (usually this means that the instantiator is recognized by the device [i.e. the X server or TTY device] that the domain is on). The function @code{face-property-instance} actually does all this, and is used to determine how to display the face. @end defun @defun face-property-instance face property &optional domain default no-fallback This function returns the instance of @var{face}'s @var{property} in the specified @var{domain}. Under most circumstances, @var{domain} will be a particular window, and the returned instance describes how the specified property actually is displayed for that window and the particular buffer in it. Note that this may not be the same as how the property appears when the buffer is displayed in a different window or frame, or how the property appears in the same window if you switch to another buffer in that window; and in those cases, the returned instance would be different. The returned instance will typically be a color-instance, font-instance, or pixmap-instance object, and you can query it using the appropriate object-specific functions. For example, you could use @code{color-instance-rgb-components} to find out the RGB (red, green, and blue) components of how the @code{background} property of the @code{highlight} face is displayed in a particular window. The results might be different from the results you would get for another window (perhaps the user specified a different color for the frame that window is on; or perhaps the same color was specified but the window is on a different X server, and that X server has different RGB values for the color from this one). @var{domain} defaults to the selected window if omitted. @var{domain} can be a frame or device, instead of a window. The value returned for a such a domain is used in special circumstances when a more specific domain does not apply; for example, a frame value might be used for coloring a toolbar, which is conceptually attached to a frame rather than a particular window. The value is also useful in determining what the value would be for a particular window within the frame or device, if it is not overridden by a more specific specification. If @var{property} does not name a built-in property, its value will simply be returned unless it is a specifier object, in which case it will be instanced using @code{specifier-instance}. Optional arguments @var{default} and @var{no-fallback} are the same as in @code{specifier-instance}. @xref{Specifiers}. @end defun @node Face Convenience Functions @subsection Face Convenience Functions @deffn Command set-face-foreground face color &optional locale tag-set how-to-add @deffnx Command set-face-background face color &optional locale tag-set how-to-add These functions set the foreground (respectively, background) color of face @var{face} to @var{color}. The argument @var{color} should be a string (the name of a color) or a color object as returned by @code{make-color} (@pxref{Colors}). @end deffn @deffn Command set-face-background-pixmap face pixmap &optional locale tag-set how-to-add This function sets the background pixmap of face @var{face} to @var{pixmap}. The argument @var{pixmap} should be a string (the name of a bitmap or pixmap file; the directories listed in the variable @code{x-bitmap-file-path} will be searched) or a glyph object as returned by @code{make-glyph} (@pxref{Glyphs}). The argument may also be a list of the form @code{(@var{width} @var{height} @var{data})} where @var{width} and @var{height} are the size in pixels, and @var{data} is a string, containing the raw bits of the bitmap. Similarly to how the glyph's image specifier works @xref{Creating Glyphs}, you don't create your own image specifier, but rather add specifications to the existing one. Note that the image instance that is generated in order to actually display the background pixmap is of type @code{mono-pixmap}, meaning that it's a two-color image and the foreground and background of the image get filled in with the corresponding colors from the face. (#### Is this still true?) @end deffn @deffn Command set-face-background-pixmap-file face file This function sets the background pixmap of face @var{face} to the image contained in @var{file}. This is just a simplified version of @code{set-face-background-pixmap} which provides filename completion. @end deffn @deffn Command set-face-font face font &optional locale tag-set how-to-add This function sets the font of face @var{face}. The argument @var{font} should be a string or a font object as returned by @code{make-font} (@pxref{Fonts}). If you want to set a face's font for a given Mule character set, you need to include some tags in @var{tag-set} that match that character set. See the documentation of @code{define-specifier-tag} and its @code{charset-predicate} argument. @end deffn @deffn Command set-face-underline-p face underline-p &optional locale tag-set how-to-add This function sets the underline property of face @var{face}. @end deffn @defun face-foreground face &optional locale tag-set exact-p @defunx face-background face &optional locale tag-set exact-p These functions return the foreground (respectively, background) color specifier of face @var{face}. @xref{Colors}. @end defun @defun face-background-pixmap face &optional locale tag-set exact-p This function returns the background-pixmap image specifier of face @var{face}. @end defun @defun face-font face &optional locale tag-set exact-p This function returns the font specifier of face @var{face}. (Note: This is not the same as the function @code{face-font} in FSF Emacs.) @xref{Fonts}. @end defun @defun face-font-name face &optional domain This function returns the name of the font of face @var{face}, or @code{nil} if it is unspecified. This is basically equivalent to @code{(font-name (face-font @var{face}) @var{domain})} except that it does not cause an error if @var{face}'s font is @code{nil}. (This function is named @code{face-font} in FSF Emacs.) @end defun @defun face-underline-p face &optional locale This function returns the underline property of face @var{face}. @end defun @defun face-foreground-instance face &optional domain @defunx face-background-instance face &optional domain These functions return the foreground (respectively, background) color specifier of face @var{face}. @xref{Colors}. @end defun @defun face-background-pixmap-instance face &optional domain This function return the background-pixmap glyph object of face @var{face}. @end defun @defun face-font-instance face &optional domain charset This function returns the font specifier of face @var{face} in domain @var{domain} (defaulting to the selected device) with Mule charset @var{charset} (defaulting to ASCII). @xref{Fonts}. @end defun @node Other Face Display Functions @subsection Other Face Display Functions @deffn Command invert-face face &optional locale Swap the foreground and background colors of face @var{face}. If the face doesn't specify both foreground and background, then its foreground and background are set to the default background and foreground. @end deffn @defun face-equal face1 face2 &optional domain This returns @code{t} if the faces @var{face1} and @var{face2} will display in the same way. @var{domain} is as in @code{face-property-instance}. @end defun @defun face-differs-from-default-p face &optional domain This returns @code{t} if the face @var{face} displays differently from the default face. @var{domain} is as in @code{face-property-instance}. @end defun @node Fonts @section Fonts @cindex fonts This section describes how to work with font specifier and font instance objects, which encapsulate fonts in the window system. @menu * Font Specifiers:: Specifying how a font will appear. * Font Instances:: What a font specifier gets instanced as. * Font Instance Names:: The name of a font instance. * Font Instance Size:: The size of a font instance. * Font Instance Characteristics:: Display characteristics of font instances. * Font Convenience Functions:: Convenience functions that automatically instance and retrieve the properties of a font specifier. @end menu @node Font Specifiers @subsection Font Specifiers @defun font-specifier-p object This predicate returns @code{t} if @var{object} is a font specifier, and @code{nil} otherwise. @end defun @defun make-font-specifier spec-list Return a new @code{font} specifier object with the given specification list. @var{spec-list} can be a list of specifications (each of which is a cons of a locale and a list of instantiators), a single instantiator, or a list of instantiators. @xref{Specifiers}, for more information about specifiers. Valid instantiators for font specifiers are: @itemize @bullet @item A string naming a font (e.g. under X this might be "-*-courier-medium-r-*-*-*-140-*-*-*-*-iso8859-*" for a 14-point upright medium-weight Courier font). @item A font instance (use that instance directly if the device matches, or use the string that generated it). @item A vector of no elements (only on TTY's; this means to set no font at all, thus using the "natural" font of the terminal's text). @item A vector of one element (a face to inherit from). @end itemize @end defun @node Font Instances @subsection Font Instances @defun font-instance-p object This predicate returns @code{t} if @var{object} is a font instance, and @code{nil} otherwise. @end defun @defun make-font-instance name &optional device noerror This function creates a new font-instance object of the specified name. @var{device} specifies the device this object applies to and defaults to the selected device. An error is signalled if the font is unknown or cannot be allocated; however, if @var{noerror} is non-@code{nil}, @code{nil} is simply returned in this case. The returned object is a normal, first-class lisp object. The way you ``deallocate'' the font is the way you deallocate any other lisp object: you drop all pointers to it and allow it to be garbage collected. When these objects are GCed, the underlying X data is deallocated as well. @end defun @node Font Instance Names @subsection Font Instance Names @cindex font instance name @cindex available fonts @cindex fonts available @defun list-fonts pattern &optional device This function returns a list of font names matching the given pattern. @var{device} specifies which device to search for names, and defaults to the currently selected device. @end defun @defun font-instance-name font-instance This function returns the name used to allocate @var{font-instance}. @end defun @defun font-instance-truename font-instance This function returns the canonical name of the given font instance. Font names are patterns which may match any number of fonts, of which the first found is used. This returns an unambiguous name for that font (but not necessarily its only unambiguous name). @end defun @node Font Instance Size @subsection Font Instance Size @cindex font instance size @defun x-font-size font This function returns the nominal size of the given font. This is done by parsing its name, so it's likely to lose. X fonts can be specified (by the user) in either pixels or 10ths of points, and this returns the first one it finds, so you have to decide which units the returned value is measured in yourself ... @end defun @defun x-find-larger-font font &optional device This function loads a new, slightly larger version of the given font (or font name). Returns the font if it succeeds, @code{nil} otherwise. If scalable fonts are available, this returns a font which is 1 point larger. Otherwise, it returns the next larger version of this font that is defined. @end defun @defun x-find-smaller-font font &optional device This function loads a new, slightly smaller version of the given font (or font name). Returns the font if it succeeds, @code{nil} otherwise. If scalable fonts are available, this returns a font which is 1 point smaller. Otherwise, it returns the next smaller version of this font that is defined. @end defun @node Font Instance Characteristics @subsection Font Instance Characteristics @cindex font instance characteristics @cindex characteristics of font instances @cindex bold @cindex demibold @cindex italic @cindex oblique @defun font-instance-properties font-instance This function returns the properties (an alist or @code{nil}) of @var{font-instance}. @end defun @defun x-make-font-bold font &optional device Given an X font specification, this attempts to make a ``bold'' font. If it fails, it returns @code{nil}. @end defun @defun x-make-font-unbold font &optional device Given an X font specification, this attempts to make a non-bold font. If it fails, it returns @code{nil}. @end defun @defun x-make-font-italic font &optional device Given an X font specification, this attempts to make an ``italic'' font. If it fails, it returns @code{nil}. @end defun @defun x-make-font-unitalic font &optional device Given an X font specification, this attempts to make a non-italic font. If it fails, it returns @code{nil}. @end defun @defun x-make-font-bold-italic font &optional device Given an X font specification, this attempts to make a ``bold-italic'' font. If it fails, it returns @code{nil}. @end defun @node Font Convenience Functions @subsection Font Convenience Functions @defun font-name font &optional domain This function returns the name of the @var{font} in the specified @var{domain}, if any. @var{font} should be a font specifier object and @var{domain} is normally a window and defaults to the selected window if omitted. This is equivalent to using @code{specifier-instance} and applying @code{font-instance-name} to the result. @end defun @defun font-truename font &optional domain This function returns the truename of the @var{font} in the specified @var{domain}, if any. @var{font} should be a font specifier object and @var{domain} is normally a window and defaults to the selected window if omitted. This is equivalent to using @code{specifier-instance} and applying @code{font-instance-truename} to the result. @end defun @defun font-properties font &optional domain This function returns the properties of the @var{font} in the specified @var{domain}, if any. @var{font} should be a font specifier object and @var{domain} is normally a window and defaults to the selected window if omitted. This is equivalent to using @code{specifier-instance} and applying @code{font-instance-properties} to the result. @end defun @node Colors @section Colors @cindex colors @menu * Color Specifiers:: Specifying how a color will appear. * Color Instances:: What a color specifier gets instanced as. * Color Instance Properties:: Properties of color instances. * Color Convenience Functions:: Convenience functions that automatically instance and retrieve the properties of a color specifier. @end menu @node Color Specifiers @subsection Color Specifiers @defun color-specifier-p object This function returns non-@code{nil} if @var{object} is a color specifier. @end defun @defun make-color-specifier spec-list Return a new @code{color} specifier object with the given specification list. @var{spec-list} can be a list of specifications (each of which is a cons of a locale and a list of instantiators), a single instantiator, or a list of instantiators. @xref{Specifiers}, for a detailed description of how specifiers work. Valid instantiators for color specifiers are: @itemize @bullet @item A string naming a color (e.g. under X this might be "lightseagreen2" or "#F534B2"). @item A color instance (use that instance directly if the device matches, or use the string that generated it). @item A vector of no elements (only on TTY's; this means to set no color at all, thus using the "natural" color of the terminal's text). @item A vector of one or two elements: a face to inherit from, and optionally a symbol naming which property of that face to inherit, either @code{foreground} or @code{background} (if omitted, defaults to the same property that this color specifier is used for; if this specifier is not part of a face, the instantiator would not be valid). @end itemize @end defun @defun make-face-boolean-specifier spec-list Return a new @code{face-boolean} specifier object with the given spec list. @var{spec-list} can be a list of specifications (each of which is a cons of a locale and a list of instantiators), a single instantiator, or a list of instantiators. @xref{Specifiers}, for a detailed description of how specifiers work. Valid instantiators for face-boolean specifiers are @itemize @bullet @item t or nil. @item A vector of two or three elements: a face to inherit from, optionally a symbol naming the property of that face to inherit from (if omitted, defaults to the same property that this face-boolean specifier is used for; if this specifier is not part of a face, the instantiator would not be valid), and optionally a value which, if non-@code{nil}, means to invert the sense of the inherited property. @end itemize @end defun @node Color Instances @subsection Color Instances @cindex color instances A @dfn{color-instance object} is an object describing the way a color specifier is instanced in a particular domain. Functions such as @code{face-background-instance} return a color-instance object. For example, @example (face-background-instance 'default (next-window)) @result{} #<color-instance moccasin 47=(FFFF,E4E4,B5B5) 0x678d> @end example The color-instance object returned describes the way the background color of the @code{default} face is displayed in the next window after the selected one. @defun color-instance-p object This function returns non-@code{nil} if @var{object} is a color-instance. @end defun @node Color Instance Properties @subsection Color Instance Properties @defun color-instance-name color-instance This function returns the name used to allocate @var{color-instance}. @end defun @defun color-instance-rgb-components color-instance This function returns a three element list containing the red, green, and blue color components of @var{color-instance}. @example (color-instance-rgb-components (face-background-instance 'default (next-window))) @result{} (65535 58596 46517) @end example @end defun @node Color Convenience Functions @subsection Color Convenience Functions @defun color-name color &optional domain This function returns the name of the @var{color} in the specified @var{domain}, if any. @var{color} should be a color specifier object and @var{domain} is normally a window and defaults to the selected window if omitted. This is equivalent to using @code{specifier-instance} and applying @code{color-instance-name} to the result. @end defun @defun color-rgb-components color &optional domain This function returns the @sc{rgb} components of the @var{color} in the specified @var{domain}, if any. @var{color} should be a color specifier object and @var{domain} is normally a window and defaults to the selected window if omitted. This is equivalent to using @code{specifier-instance} and applying @code{color-instance-rgb-components} to the result. @example (color-rgb-components (face-background 'default (next-window))) @result{} (65535 58596 46517) @end example @end defun