Mercurial > emacs
annotate lisp/face-remap.el @ 106619:528f9cf7298f
Update dependencies in Makefile.in.
(alloc.o): Depend on termhooks.h.
(atimer.o): Depend on blockinput.h.
(buffer.o): Depend on indent.h, keyboard.h, coding.h, keymap.h, and frame.h.
(callint.o): Depend on systime.h, coding.h, and composite.h.
(callproc.o): Depend on buffer.h.
(casefiddle.o): Don't depend on charset.h.
(casetab.o): Depend on character.h.
(ccl.o): Depend on composite.h.
(chartab.o): Depend on ccl.h.
(cm.o): Depend on dispextern.h.
(cmds.o): Depend on systime.h, coding.h, frame.h, and composite.h.
(coding.o): Don't depend on $(INTERVALS_H).
(composite.o): Don't depend on dispextern.h explicitly (it's in
$(INTERVALS_H)). Depend on ccl.h.
(data.o): Depend on systime.h, coding.h, composite.h, dispextern.h, font.h,
and ccl.h.
(dired.o): Depend on composite.h.
(dispnew.o): Depend on coding.h. Don't depend explicitly on
composite.h (it's in $(INTERVALS_H)).
(doc.o): Depend on systime.h, coding.h, and composite.h.
(editfns.o): Don't depend explicitly on dispextern.h.
(emacs.o): Depend on frame.h and coding.h.
(eval.o): Depend on coding.h, composite.h, and xterm.h.
(fileio.o): Depend on frame.h and commands.h. Don't depend
explicitly on dispextern.h.
(filelock.o): Don't depend on epaths.h and charset.h. Depend on composite.h.
(fns.o): Don't depend on termhooks.h.
(font.o): Depend on buffer.h, composite.h, fontset.h, and xterm.h.
(fontset.o): Depend on blockinput.h, atimer.h, systime.h, coding.h,
$(INTERVALS_H), window.h, xterm.h.
(frame.o): Depend on coding.h, composite.h, termhooks.h, and ccl.h.
(fringe.o): Depend on blockinput.h, atimer.h, and systime.h.
(ftfont.o): Depend on blockinput.h, atimer.h, systime.h, coding.h,
fontset.h, ccl.h, and ftfont.h.
(ftxfont.o): Depend on atimer.h, systime.h, fontset.h, and ccl.h.
(gtkutil.o): Depend on dispextern.h and composite.h.
(image.o): Depend on epaths.h, character.h, coding.h, composite.h,
termhooks.h, and ccl.h.
(indent.o): Depend on systime.h, coding.h, and $(INTERVALS_H).
(intervals.o): Depend on systime.h and coding.h.
(keyboard.o): Depend on composite.h and coding.h.
(keymap.o): Depend on coding.h and frame.h.
(lread.o): Depend on systime.h, frame.h, blockinput.h, and atimer.h.
(macros.o): Depend on systime.h, coding.h, and composite.h.
(menu.o): Depend on systime.h, coding.h, composite.h, window.h, and atimer.h.
(minibuf.o): Depend on systime.h and coding.h. Don't depend on
dispextern.h explicitly.
(print.o): Depend on termhooks.h, coding.h, and ccl.h. Don't
depend explicitly on dispextern.h and composite.h.
(process.o): Depend on character.h, xgselect.h, and sysselect.h.
(regex.o): Don't depend on charset.h.
(scroll.o): Depend on systime.h, coding.h, composite.h, and window.h.
(search.o): Don't depend explicitly on composite.h.
(sound.o): Depend on atimer.h and systime.h.
(syntax.o): Don't depend explicitly on composite.h.
(sysdep.o): Depend on coding.h and composite.h.
(term.o): Depend on xterm.h and buffer.h.
(terminal.o): Depend on dispextern.h, composite.h, and systime.h.
(textprop.o): Don't depend on dispextern.h explicitly.
(undo.o): Depend on dispextern.h.
(window.o): Depend on coding.h and termhooks.h. Don't depend on
dispextern.h and composite.h explicitly.
(xdisp.o): Depend on ccl.h.
(xfaces.o): Depend on coding.h and ccl.h.
(xfns.o): Depend on $(INTERVALS_H) and ccl.h.
(xfont.o): Depend on atimer.h, systime.h, fontset.h, and ccl.h.
(xftfont.o): Depend on atimer.h, systime.h, fontset.h, ccl.h, and ftfont.h.
(xgselect.o): New dependency.
(xmenu.o): Depend on composite.h, keymap.h, and sysselect.h.
(xselect.o): Depend on keyboard.h, coding.h, and composite.h.
(xsettings.o): Depend on dispextern.h, keyboard.h, systime.h,
coding.h, composite.h, blockinput.h, atimer.h, and termopts.h.
(xsmfns.o): Depend on frame.h and dispextern.h.
(xterm.o): Depend on intervals.h, keymap.h, xgselect.h, and sysselect.h.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 19 Dec 2009 11:24:59 +0000 |
parents | bd2966850aac |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; face-remap.el --- Functions for managing `face-remapping-alist' |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 ;; |
100908 | 3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 ;; Author: Miles Bader <miles@gnu.org> |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
6 ;; Keywords: faces face remapping display user commands |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;;; Commentary: |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 ;; This file defines some simple operations that can be used for |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;; maintaining the `face-remapping-alist' in a cooperative way. This is |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;; especially important for the `default' face. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 ;; Each face-remapping definition in `face-remapping-alist' added by |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 ;; this code uses the form: |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 ;; (face RELATIVE_SPECS_1 RELATIVE_SPECS_2 ... BASE_SPECS) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 ;; The "specs" values are a lists of face names or face attribute-value |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 ;; pairs, and are merged together, with earlier values taking precedence. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 ;; |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
39 ;; The RELATIVE_SPECS_* values are added by `face-remap-add-relative' |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
40 ;; (and removed by `face-remap-remove-relative', and are intended for |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 ;; face "modifications" (such as increasing the size). Typical users of |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 ;; relative specs would be minor modes. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 ;; BASE_SPECS is the lowest-priority value, and by default is just the |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 ;; face name, which causes the global definition of that face to be used. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 ;; A non-default value of BASE_SPECS may also be set using |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
48 ;; `face-remap-set-base'. Because this _overwrites_ the default |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
49 ;; value inheriting from the global face definition, it is up to the |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
50 ;; caller of face-remap-set-base to add such inheritance if it is |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
51 ;; desired. A typical use of face-remap-set-base would be a major |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
52 ;; mode setting face remappings, e.g., of the default face. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
54 ;; All modifications cause face-remapping-alist to be made buffer-local. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 ;; |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
57 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 ;;; Code: |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 ;; ---------------------------------------------------------------- |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 ;; Utility functions |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 |
96041
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
64 ;; Names of face attributes corresponding to lisp face-vector positions. |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
65 ;; This variable should probably be defined in C code where the actual |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
66 ;; definitions are available. |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
67 ;; |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
68 (defvar internal-lisp-face-attributes |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
69 [nil |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
70 :family :foundry :swidth :height :weight :slant :underline :inverse |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
71 :foreground :background :stipple :overline :strike :box |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
72 :font :inherit :fontset :vector]) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
73 |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
74 (defun face-attrs-more-relative-p (attrs1 attrs2) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
75 "Return true if ATTRS1 contains a greater number of relative |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
76 face-attributes than ATTRS2. A face attribute is considered |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
77 relative if `face-attribute-relative-p' returns non-nil. |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
78 |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
79 ATTRS1 and ATTRS2 may be any value suitable for a `face' text |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
80 property, including face names, lists of face names, |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
81 face-attribute plists, etc. |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
82 |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
83 This function can be used as a predicate with `sort', to sort |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
84 face lists so that more specific faces are located near the end." |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
85 (unless (vectorp attrs1) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
86 (setq attrs1 (face-attributes-as-vector attrs1))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
87 (unless (vectorp attrs2) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
88 (setq attrs2 (face-attributes-as-vector attrs2))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
89 (let ((rel1-count 0) (rel2-count 0)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
90 (dotimes (i (length attrs1)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
91 (let ((attr (aref internal-lisp-face-attributes i))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
92 (when attr |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
93 (when (face-attribute-relative-p attr (aref attrs1 i)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
94 (setq rel1-count (+ rel1-count 1))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
95 (when (face-attribute-relative-p attr (aref attrs2 i)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
96 (setq rel2-count (+ rel2-count 1)))))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
97 (< rel1-count rel2-count))) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
98 |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
99 (defun face-remap-order (entry) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
100 "Order ENTRY so that more relative face specs are near the beginning. |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
101 The list structure of ENTRY may be destructively modified." |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
102 (setq entry (nreverse entry)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
103 (setcdr entry (sort (cdr entry) 'face-attrs-more-relative-p)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
104 (nreverse entry)) |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
105 |
96140
fea1ab635d2d
Fix autoload directives in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
96091
diff
changeset
|
106 ;;;###autoload |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
107 (defun face-remap-add-relative (face &rest specs) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
108 "Add a face remapping entry of FACE to SPECS in the current buffer. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 Return a cookie which can be used to delete the remapping with |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
111 `face-remap-remove-relative'. |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
113 SPECS can be any value suitable for the `face' text property, |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 including a face name, a list of face names, or a face-attribute |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 property list. The attributes given by SPECS will be merged with |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 any other currently active face remappings of FACE, and with the |
96041
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
117 global definition of FACE. An attempt is made to sort multiple |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
118 entries so that entries with relative face-attributes are applied |
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
119 after entries with absolute face-attributes. |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
120 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 The base (lowest priority) remapping may be set to a specific |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 value, instead of the default of the global face definition, |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
123 using `face-remap-set-base'." |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
124 (while (and (consp specs) (null (cdr specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
125 (setq specs (car specs))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
126 (make-local-variable 'face-remapping-alist) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
127 (let ((entry (assq face face-remapping-alist))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 (when (null entry) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
129 (setq entry (list face face)) ; explicitly merge with global def |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 (push entry face-remapping-alist)) |
96041
c89004e8d9a9
Order multiple entries more cleverly in face-remap-add-relative
Miles Bader <miles@gnu.org>
parents:
95563
diff
changeset
|
131 (setcdr entry (face-remap-order (cons specs (cdr entry)))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 (cons face specs))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
134 (defun face-remap-remove-relative (cookie) |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
135 "Remove a face remapping previously added by `face-remap-add-relative'. |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
136 COOKIE should be the return value from that function." |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
137 (let ((remapping (assq (car cookie) face-remapping-alist))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
138 (when remapping |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
139 (let ((updated-entries (remq (cdr cookie) (cdr remapping)))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
140 (unless (eq updated-entries (cdr remapping)) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
141 (setcdr remapping updated-entries) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
142 (when (or (null updated-entries) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 (and (eq (car-safe updated-entries) (car cookie)) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 (null (cdr updated-entries)))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 (setq face-remapping-alist |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
146 (remq remapping face-remapping-alist))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
147 (cdr cookie)))))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
148 |
96140
fea1ab635d2d
Fix autoload directives in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
96091
diff
changeset
|
149 ;;;###autoload |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
150 (defun face-remap-reset-base (face) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 "Set the base remapping of FACE to inherit from FACE's global definition." |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 (let ((entry (assq face face-remapping-alist))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
153 (when entry |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 ;; If there's nothing except a base remapping, we simply remove |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
155 ;; the entire remapping entry, as setting the base to the default |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
156 ;; would be the same as the global definition. Otherwise, we |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
157 ;; modify the base remapping. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
158 (if (null (cddr entry)) ; nothing except base remapping |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
159 (setq face-remapping-alist ; so remove entire entry |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
160 (remq entry face-remapping-alist)) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
161 (setcar (last entry) face))))) ; otherwise, just inherit global def |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
162 |
96140
fea1ab635d2d
Fix autoload directives in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
96091
diff
changeset
|
163 ;;;###autoload |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
164 (defun face-remap-set-base (face &rest specs) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
165 "Set the base remapping of FACE in the current buffer to SPECS. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
166 If SPECS is empty, the default base remapping is restored, which |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
167 inherits from the global definition of FACE; note that this is |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
168 different from SPECS containing a single value `nil', which does |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
169 not inherit from the global definition of FACE." |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
170 (while (and (consp specs) (not (null (car specs))) (null (cdr specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
171 (setq specs (car specs))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
172 (if (or (null specs) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
173 (and (eq (car specs) face) (null (cdr specs)))) ; default |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
174 ;; Set entry back to default |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
175 (face-remap-reset-base face) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
176 ;; Set the base remapping |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
177 (make-local-variable 'face-remapping-alist) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
178 (let ((entry (assq face face-remapping-alist))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
179 (if entry |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
180 (setcar (last entry) specs) ; overwrite existing base entry |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
181 (push (list face specs) face-remapping-alist))))) |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
182 |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
183 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
184 ;; ---------------------------------------------------------------- |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
185 ;; text-scale-mode |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
186 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
187 (defcustom text-scale-mode-step 1.2 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
188 "Scale factor used by `text-scale-mode'. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
189 Each positive or negative step scales the default face height by this amount." |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
190 :group 'display |
100439
5de002dfa264
* face-remap.el (text-scale-mode-step, buffer-face-mode-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
99163
diff
changeset
|
191 :type 'number |
5de002dfa264
* face-remap.el (text-scale-mode-step, buffer-face-mode-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
99163
diff
changeset
|
192 :version "23.1") |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
193 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
194 ;; current remapping cookie for text-scale-mode |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
195 (defvar text-scale-mode-remapping nil) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
196 (make-variable-buffer-local 'text-scale-mode-remapping) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
197 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
198 ;; Lighter displayed for text-scale-mode in mode-line minor-mode list |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
199 (defvar text-scale-mode-lighter "+0") |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
200 (make-variable-buffer-local 'text-scale-mode-lighter) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
201 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
202 ;; Number of steps that text-scale-mode will increase/decrease text height |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
203 (defvar text-scale-mode-amount 0) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
204 (make-variable-buffer-local 'text-scale-mode-amount) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
205 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
206 (define-minor-mode text-scale-mode |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
207 "Minor mode for displaying buffer text in a larger/smaller font than usual. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
208 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
209 The amount of scaling is determined by the variable |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
210 `text-scale-mode-amount': one step scales the global default |
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
211 face size by the value of the variable `text-scale-mode-step' |
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
212 \(a negative amount shrinks the text). |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
213 |
103568
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
214 The `text-scale-increase', `text-scale-decrease', and |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
215 `text-scale-set' functions may be used to interactively modify |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
216 the variable `text-scale-mode-amount' (they also enable or |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
217 disable `text-scale-mode' as necessary)." |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
218 :lighter (" " text-scale-mode-lighter) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
219 (when text-scale-mode-remapping |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
220 (face-remap-remove-relative text-scale-mode-remapping)) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
221 (setq text-scale-mode-lighter |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
222 (format (if (>= text-scale-mode-amount 0) "+%d" "%d") |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
223 text-scale-mode-amount)) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
224 (setq text-scale-mode-remapping |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
225 (and text-scale-mode |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
226 (face-remap-add-relative 'default |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
227 :height |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
228 (expt text-scale-mode-step |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
229 text-scale-mode-amount)))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
230 (force-window-update (current-buffer))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
231 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
232 ;;;###autoload |
103568
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
233 (defun text-scale-set (level) |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
234 "Set the scale factor of the default face in the current buffer to LEVEL. |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
235 If LEVEL is non-zero, `text-scale-mode' is enabled, otherwise it is disabled. |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
236 |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
237 LEVEL is a number of steps, with 0 representing the default size. |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
238 Each step scales the height of the default face by the variable |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
239 `text-scale-mode-step' (a negative number decreases the height by |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
240 the same amount)." |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
241 (interactive "p") |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
242 (setq text-scale-mode-amount level) |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
243 (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
244 |
90878fc8d55d
Add `text-scale-set' function
Miles Bader <miles@gnu.org>
parents:
100908
diff
changeset
|
245 ;;;###autoload |
99163
60acf25bcfb5
* face-remap.el (text-scale-increase, text-scale-decrease)
Juanma Barranquero <lekktu@gmail.com>
parents:
96152
diff
changeset
|
246 (defun text-scale-increase (inc) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
247 "Increase the height of the default face in the current buffer by INC steps. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
248 If the new height is other than the default, `text-scale-mode' is enabled. |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
249 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
250 Each step scales the height of the default face by the variable |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
251 `text-scale-mode-step' (a negative number of steps decreases the |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
252 height by the same amount). As a special case, an argument of 0 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
253 will remove any scaling currently active." |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
254 (interactive "p") |
96080
2b046bd8b819
Fix behavior of text-scale-increase when text-scale-mode is disabled
Miles Bader <miles@gnu.org>
parents:
96042
diff
changeset
|
255 (setq text-scale-mode-amount |
2b046bd8b819
Fix behavior of text-scale-increase when text-scale-mode is disabled
Miles Bader <miles@gnu.org>
parents:
96042
diff
changeset
|
256 (if (= inc 0) 0 (+ (if text-scale-mode text-scale-mode-amount 0) inc))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
257 (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
258 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
259 ;;;###autoload |
99163
60acf25bcfb5
* face-remap.el (text-scale-increase, text-scale-decrease)
Juanma Barranquero <lekktu@gmail.com>
parents:
96152
diff
changeset
|
260 (defun text-scale-decrease (dec) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
261 "Decrease the height of the default face in the current buffer by DEC steps. |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
262 See `text-scale-increase' for more details." |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
263 (interactive "p") |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
264 (text-scale-increase (- dec))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
265 |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
266 ;;;###autoload (define-key ctl-x-map [(control ?+)] 'text-scale-adjust) |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
267 ;;;###autoload (define-key ctl-x-map [(control ?-)] 'text-scale-adjust) |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
268 ;;;###autoload (define-key ctl-x-map [(control ?=)] 'text-scale-adjust) |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
269 ;;;###autoload (define-key ctl-x-map [(control ?0)] 'text-scale-adjust) |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
270 ;;;###autoload |
99163
60acf25bcfb5
* face-remap.el (text-scale-increase, text-scale-decrease)
Juanma Barranquero <lekktu@gmail.com>
parents:
96152
diff
changeset
|
271 (defun text-scale-adjust (inc) |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
272 "Increase or decrease the height of the default face in the current buffer. |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
273 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
274 The actual adjustment made depends on the final component of the |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
275 key-binding used to invoke the command, with all modifiers removed: |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
276 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
277 +, = Increase the default face height by one step |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
278 - Decrease the default face height by one step |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
279 0 Reset the default face height to the global default |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
280 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
281 Then, continue to read input events and further adjust the face |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
282 height as long as the input event read (with all modifiers removed) |
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
283 is one of the above. |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
284 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
285 Each step scales the height of the default face by the variable |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
286 `text-scale-mode-step' (a negative number of steps decreases the |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
287 height by the same amount). As a special case, an argument of 0 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
288 will remove any scaling currently active. |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
289 |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
290 This command is a special-purpose wrapper around the |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
291 `text-scale-increase' command which makes repetition convenient |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
292 even when it is bound in a non-top-level keymap. For binding in |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
293 a top-level keymap, `text-scale-increase' or |
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
294 `text-scale-decrease' may be more appropriate." |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
295 (interactive "p") |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
296 (let ((first t) |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
297 (step t) |
96152
a35eb0adf0b2
(text-scale-adjust): Bind `echo-keystrokes' to nil.
Miles Bader <miles@gnu.org>
parents:
96140
diff
changeset
|
298 (ev last-command-event) |
a35eb0adf0b2
(text-scale-adjust): Bind `echo-keystrokes' to nil.
Miles Bader <miles@gnu.org>
parents:
96140
diff
changeset
|
299 (echo-keystrokes nil)) |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
300 (while step |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
301 (let ((base (event-basic-type ev))) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
302 (cond ((or (eq base ?+) (eq base ?=)) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
303 (setq step inc)) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
304 ((eq base ?-) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
305 (setq step (- inc))) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
306 ((eq base ?0) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
307 (setq step 0)) |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
308 (first |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
309 (setq step inc)) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
310 (t |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
311 (setq step nil)))) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
312 (when step |
95563
6d9c4248a579
Rename functions in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
95552
diff
changeset
|
313 (text-scale-increase step) |
95527
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
314 (setq inc 1 first nil) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
315 (setq ev (read-event)))) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
316 (push ev unread-command-events))) |
0f9689c194e6
Add adjust-buffer-face-height command
Miles Bader <miles@gnu.org>
parents:
95515
diff
changeset
|
317 |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
318 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
319 ;; ---------------------------------------------------------------- |
96042 | 320 ;; buffer-face-mode |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
321 |
96042 | 322 (defcustom buffer-face-mode-face 'variable-pitch |
323 "The face specification used by `buffer-face-mode'. | |
324 It may contain any value suitable for a `face' text property, | |
325 including a face name, a list of face names, a face-attribute | |
326 plist, etc." | |
100439
5de002dfa264
* face-remap.el (text-scale-mode-step, buffer-face-mode-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
99163
diff
changeset
|
327 :group 'display |
5de002dfa264
* face-remap.el (text-scale-mode-step, buffer-face-mode-face):
Juanma Barranquero <lekktu@gmail.com>
parents:
99163
diff
changeset
|
328 :version "23.1") |
96042 | 329 |
330 ;; current remapping cookie for buffer-face-mode | |
331 (defvar buffer-face-mode-remapping nil) | |
332 (make-variable-buffer-local 'buffer-face-mode-remapping) | |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
333 |
96042 | 334 ;;;###autoload |
335 (define-minor-mode buffer-face-mode | |
336 "Minor mode for a buffer-specific default face. | |
337 When enabled, the face specified by the variable | |
338 `buffer-face-mode-face' is used to display the buffer text." | |
339 :lighter " BufFace" | |
340 (when buffer-face-mode-remapping | |
341 (face-remap-remove-relative buffer-face-mode-remapping)) | |
342 (setq buffer-face-mode-remapping | |
343 (and buffer-face-mode | |
344 (face-remap-add-relative 'default buffer-face-mode-face))) | |
345 (force-window-update (current-buffer))) | |
346 | |
347 ;;;###autoload | |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
348 (defun buffer-face-set (&rest specs) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
349 "Enable `buffer-face-mode', using face specs SPECS. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
350 SPECS can be any value suitable for the `face' text property, |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
351 including a face name, a list of face names, or a face-attribute |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
352 If SPECS is nil, then `buffer-face-mode' is disabled. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
353 |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
354 This function will make the variable `buffer-face-mode-face' |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
355 buffer local, and set it to FACE." |
96042 | 356 (interactive (list (read-face-name "Set buffer face"))) |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
357 (while (and (consp specs) (null (cdr specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
358 (setq specs (car specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
359 (if (null specs) |
96042 | 360 (buffer-face-mode 0) |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
361 (set (make-local-variable 'buffer-face-mode-face) specs) |
96042 | 362 (buffer-face-mode t))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
363 |
95552 | 364 ;;;###autoload |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
365 (defun buffer-face-toggle (&rest specs) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
366 "Toggle `buffer-face-mode', using face specs SPECS. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
367 SPECS can be any value suitable for the `face' text property, |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
368 including a face name, a list of face names, or a face-attribute |
96042 | 369 |
370 If `buffer-face-mode' is already enabled, and is currently using | |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
371 the face specs SPECS, then it is disabled; if buffer-face-mode is |
96042 | 372 disabled, or is enabled and currently displaying some other face, |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
373 then is left enabled, but the face changed to reflect SPECS. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
374 |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
375 This function will make the variable `buffer-face-mode-face' |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
376 buffer local, and set it to SPECS." |
96042 | 377 (interactive (list buffer-face-mode-face)) |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
378 (while (and (consp specs) (null (cdr specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
379 (setq specs (car specs))) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
380 (if (or (null specs) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
381 (and buffer-face-mode (equal buffer-face-mode-face specs))) |
96042 | 382 (buffer-face-mode 0) |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
383 (set (make-local-variable 'buffer-face-mode-face) specs) |
96042 | 384 (buffer-face-mode t))) |
385 | |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
386 (defun buffer-face-mode-invoke (specs arg &optional interactive) |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
387 "Enable or disable `buffer-face-mode' using face specs SPECS, and argument ARG. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
388 ARG controls whether the mode is enabled or disabled, and is |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
389 interpreted in the usual manner for minor-mode commands. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
390 |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
391 SPECS can be any value suitable for the `face' text property, |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
392 including a face name, a list of face names, or a face-attribute |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
393 |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
394 If INTERACTIVE is non-nil, a message will be displayed describing the result. |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
395 |
96140
fea1ab635d2d
Fix autoload directives in lisp/face-remap.el
Miles Bader <miles@gnu.org>
parents:
96091
diff
changeset
|
396 This is a wrapper function which calls `buffer-face-set' or |
96090
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
397 `buffer-face-toggle' (depending on ARG), and prints a status |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
398 message in the echo area. In many cases one of those functions |
596ac435a025
Tweak interface of buffer-face-mode functions
Miles Bader <miles@gnu.org>
parents:
96080
diff
changeset
|
399 may be more appropriate." |
96042 | 400 (let ((last-message (current-message))) |
401 (if (or (eq arg 'toggle) (not arg)) | |
96091
594843cd487e
Fix variable names in buffer-face-mode-invoke
Miles Bader <miles@gnu.org>
parents:
96090
diff
changeset
|
402 (buffer-face-toggle specs) |
594843cd487e
Fix variable names in buffer-face-mode-invoke
Miles Bader <miles@gnu.org>
parents:
96090
diff
changeset
|
403 (buffer-face-set (and (> (prefix-numeric-value arg) 0) specs))) |
96042 | 404 (when interactive |
405 (unless (and (current-message) | |
406 (not (equal last-message (current-message)))) | |
407 (message "Buffer-Face mode %sabled" | |
408 (if buffer-face-mode "en" "dis")))))) | |
409 | |
410 | |
411 ;; ---------------------------------------------------------------- | |
412 ;; variable-pitch-mode | |
413 | |
414 ;;;###autoload | |
415 (defun variable-pitch-mode (&optional arg) | |
95535
3a67eec377e0
(variable-pitch-mode): Reflow docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
95527
diff
changeset
|
416 "Variable-pitch default-face mode. |
96042 | 417 An interface to `buffer-face-mode' which uses the `variable-pitch' face. |
418 Besides the choice of face, it is the same as `buffer-face-mode'." | |
419 (interactive (list (or current-prefix-arg 'toggle))) | |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
103568
diff
changeset
|
420 (buffer-face-mode-invoke 'variable-pitch arg |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
103568
diff
changeset
|
421 (called-interactively-p 'interactive))) |
95515
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
422 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
423 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
424 (provide 'face-remap) |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
425 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
426 ;; arch-tag: 5c5f034b-8d58-4967-82bd-d61fd364e686 |
328f63bafded
Add lisp/face-remap.el and associated documentation
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
427 ;;; face-remap.el ends here |