Mercurial > emacs
annotate lisp/enriched.el @ 16288:2a6b69865ba2
(unread-command-event, unread-command-events)
(last-command-event): defvars deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 22 Sep 1996 22:23:25 +0000 |
parents | ac3fea1b270e |
children | 2d0b382efa26 |
rev | line source |
---|---|
13337 | 1 ;;; enriched.el --- read and save files in text/enriched format |
14169 | 2 |
16022
ac3fea1b270e
Add 1996 to copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
16021
diff
changeset
|
3 ;; Copyright (c) 1994, 1995, 1996 Free Software Foundation, Inc. |
9676 | 4 |
12082
257af4819582
Change email address for Boris.
Boris Goldowsky <boris@gnu.org>
parents:
11234
diff
changeset
|
5 ;; Author: Boris Goldowsky <boris@gnu.ai.mit.edu> |
9676 | 6 ;; Keywords: wp, faces |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14169 | 14 |
9676 | 15 ;; GNU Emacs is distributed in the hope that it will be useful, |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
14169 | 19 |
9676 | 20 ;; You should have received a copy of the GNU General Public License |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
9676 | 24 |
25 ;;; Commentary: | |
14169 | 26 |
9676 | 27 ;; This file implements reading, editing, and saving files with |
14169 | 28 ;; text-properties such as faces, levels of indentation, and true line |
29 ;; breaks distinguished from newlines just used to fit text into the window. | |
30 | |
9676 | 31 ;; The file format used is the MIME text/enriched format, which is a |
14169 | 32 ;; standard format defined in internet RFC 1563. All standard annotations |
33 ;; are supported except for <smaller> and <bigger>, which are currently not | |
9676 | 34 ;; possible to display. |
14169 | 35 |
9676 | 36 ;; A separate file, enriched.doc, contains further documentation and other |
14169 | 37 ;; important information about this code. It also serves as an example |
38 ;; file in text/enriched format. It should be in the etc directory of your | |
39 ;; emacs distribution. | |
40 | |
41 ;;; Code: | |
9676 | 42 |
43 (provide 'enriched) | |
44 | |
45 ;;; | |
46 ;;; Variables controlling the display | |
47 ;;; | |
48 | |
49 (defvar enriched-verbose t | |
50 "*If non-nil, give status messages when reading and writing files.") | |
51 | |
52 ;;; | |
53 ;;; Set up faces & display table | |
54 ;;; | |
55 | |
56 ;; A slight cheat - all emacs's faces are fixed-width. | |
57 ;; The idea is just to pick one that looks different from the default. | |
58 (if (internal-find-face 'fixed) | |
59 nil | |
60 (make-face 'fixed) | |
61 (if window-system | |
62 (set-face-font 'fixed | |
63 (car (or (x-list-fonts "*fixed-medium*" | |
64 'default (selected-frame)) | |
65 (x-list-fonts "*fixed*" | |
66 'default (selected-frame))))))) | |
67 | |
68 (if (internal-find-face 'excerpt) | |
69 nil | |
70 (make-face 'excerpt) | |
71 (if window-system | |
12370
07d919c1b14a
(excerpt): Ignore error making `excerpt' italic.
Richard M. Stallman <rms@gnu.org>
parents:
12082
diff
changeset
|
72 (make-face-italic 'excerpt nil t))) |
9676 | 73 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
74 (defconst enriched-display-table (or (copy-sequence standard-display-table) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
75 (make-display-table))) |
9676 | 76 (aset enriched-display-table ?\f (make-vector (1- (frame-width)) ?-)) |
77 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
78 (defconst enriched-par-props '(left-margin right-margin justification) |
9676 | 79 "Text-properties that usually apply to whole paragraphs. |
80 These are set front-sticky everywhere except at hard newlines.") | |
81 | |
82 ;;; | |
83 ;;; Variables controlling the file format | |
84 ;;; (bidirectional) | |
85 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
86 (defconst enriched-initial-annotation |
9676 | 87 (lambda () |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
88 (format "Content-Type: text/enriched\nText-Width: %d\n\n" |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
89 fill-column)) |
9676 | 90 "What to insert at the start of a text/enriched file. |
91 If this is a string, it is inserted. If it is a list, it should be a lambda | |
92 expression, which is evaluated to get the string to insert.") | |
93 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
94 (defconst enriched-annotation-format "<%s%s>" |
9676 | 95 "General format of enriched-text annotations.") |
96 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
97 (defconst enriched-annotation-regexp "<\\(/\\)?\\([-A-za-z0-9]+\\)>" |
9676 | 98 "Regular expression matching enriched-text annotations.") |
99 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
100 (defconst enriched-translations |
9676 | 101 '((face (bold-italic "bold" "italic") |
102 (bold "bold") | |
103 (italic "italic") | |
104 (underline "underline") | |
105 (fixed "fixed") | |
106 (excerpt "excerpt") | |
107 (default ) | |
108 (nil enriched-encode-other-face)) | |
109 (left-margin (4 "indent")) | |
110 (right-margin (4 "indentright")) | |
111 (justification (none "nofill") | |
112 (right "flushright") | |
113 (left "flushleft") | |
10519
66c7e651194d
(enriched-annotation-list): property `hard-newline'
Richard M. Stallman <rms@gnu.org>
parents:
9694
diff
changeset
|
114 (full "flushboth") |
9676 | 115 (center "center")) |
116 (PARAMETER (t "param")) ; Argument of preceding annotation | |
117 ;; The following are not part of the standard: | |
118 (FUNCTION (enriched-decode-foreground "x-color") | |
119 (enriched-decode-background "x-bg-color")) | |
120 (read-only (t "x-read-only")) | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
121 (unknown (nil format-annotate-value)) |
9676 | 122 ; (font-size (2 "bigger") ; unimplemented |
123 ; (-2 "smaller")) | |
124 ) | |
125 "List of definitions of text/enriched annotations. | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
126 See `format-annotate-region' and `format-deannotate-region' for the definition |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
127 of this structure.") |
9676 | 128 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
129 (defconst enriched-ignore |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
130 '(front-sticky rear-nonsticky hard) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
131 "Properties that are OK to ignore when saving text/enriched files. |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
132 Any property that is neither on this list nor dealt with by |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
133 `enriched-translations' will generate a warning.") |
9676 | 134 |
135 ;;; Internal variables | |
136 | |
137 (defvar enriched-mode nil | |
15239 | 138 "True if Enriched mode is in use.") |
9676 | 139 (make-variable-buffer-local 'enriched-mode) |
140 | |
141 (if (not (assq 'enriched-mode minor-mode-alist)) | |
142 (setq minor-mode-alist | |
143 (cons '(enriched-mode " Enriched") | |
144 minor-mode-alist))) | |
145 | |
15239 | 146 (defvar enriched-mode-hook nil |
147 "Functions to run when entering Enriched mode. | |
9676 | 148 If you set variables in this hook, you should arrange for them to be restored |
15239 | 149 to their old values if you leave Enriched mode. One way to do this is to add |
9676 | 150 them and their old values to `enriched-old-bindings'.") |
151 | |
152 (defvar enriched-old-bindings nil | |
153 "Store old variable values that we change when entering mode. | |
154 The value is a list of \(VAR VALUE VAR VALUE...).") | |
155 (make-variable-buffer-local 'enriched-old-bindings) | |
156 | |
157 ;;; | |
158 ;;; Define the mode | |
159 ;;; | |
160 | |
9694
f8aa9230c3fa
(enriched-mode): Add autoload cookie.
Boris Goldowsky <boris@gnu.org>
parents:
9677
diff
changeset
|
161 ;;;###autoload |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
162 (defun enriched-mode (&optional arg) |
9676 | 163 "Minor mode for editing text/enriched files. |
164 These are files with embedded formatting information in the MIME standard | |
165 text/enriched format. | |
15239 | 166 Turning the mode on runs `enriched-mode-hook'. |
9676 | 167 |
15239 | 168 More information about Enriched mode is available in the file |
9676 | 169 etc/enriched.doc in the Emacs distribution directory. |
170 | |
171 Commands: | |
172 | |
173 \\<enriched-mode-map>\\{enriched-mode-map}" | |
174 (interactive "P") | |
175 (let ((mod (buffer-modified-p))) | |
176 (cond ((or (<= (prefix-numeric-value arg) 0) | |
177 (and enriched-mode (null arg))) | |
178 ;; Turn mode off | |
179 (setq enriched-mode nil) | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
180 (setq buffer-file-format (delq 'text/enriched buffer-file-format)) |
9676 | 181 ;; restore old variable values |
182 (while enriched-old-bindings | |
183 (funcall 'set (car enriched-old-bindings) | |
184 (car (cdr enriched-old-bindings))) | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
185 (setq enriched-old-bindings (cdr (cdr enriched-old-bindings))))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
186 |
9676 | 187 (enriched-mode nil) ; Mode already on; do nothing. |
188 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
189 (t (setq enriched-mode t) ; Turn mode on |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
190 (add-to-list 'buffer-file-format 'text/enriched) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
191 ;; Save old variable values before we change them. |
15239 | 192 ;; These will be restored if we exit Enriched mode. |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
193 (setq enriched-old-bindings |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
194 (list 'buffer-display-table buffer-display-table |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
195 'indent-line-function indent-line-function |
11129
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
196 'default-text-properties default-text-properties)) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
197 (make-local-variable 'indent-line-function) |
11129
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
198 (make-local-variable 'default-text-properties) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
199 (setq indent-line-function 'indent-to-left-margin |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
200 buffer-display-table enriched-display-table) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
201 (use-hard-newlines 1 nil) |
11129
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
202 (let ((sticky (plist-get default-text-properties 'front-sticky)) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
203 (p enriched-par-props)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
204 (while p |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
205 (add-to-list 'sticky (car p)) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
206 (setq p (cdr p))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
207 (if sticky |
11129
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
208 (setq default-text-properties |
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
209 (plist-put default-text-properties |
2ce4b0aac50c
(enriched-mode): Use new plist-put and plist-get fns,
Boris Goldowsky <boris@gnu.org>
parents:
11055
diff
changeset
|
210 'front-sticky sticky)))) |
15239 | 211 (run-hooks 'enriched-mode-hook))) |
9676 | 212 (set-buffer-modified-p mod) |
213 (force-mode-line-update))) | |
214 | |
215 ;;; | |
216 ;;; Keybindings | |
217 ;;; | |
218 | |
219 (defvar enriched-mode-map nil | |
15239 | 220 "Keymap for Enriched mode.") |
9676 | 221 |
222 (if (null enriched-mode-map) | |
223 (fset 'enriched-mode-map (setq enriched-mode-map (make-sparse-keymap)))) | |
224 | |
225 (if (not (assq 'enriched-mode minor-mode-map-alist)) | |
226 (setq minor-mode-map-alist | |
227 (cons (cons 'enriched-mode enriched-mode-map) | |
228 minor-mode-map-alist))) | |
229 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
230 (define-key enriched-mode-map "\C-a" 'beginning-of-line-text) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
231 (define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
232 (define-key enriched-mode-map "\C-j" 'reindent-then-newline-and-indent) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
233 (define-key enriched-mode-map "\M-j" 'facemenu-justification-menu) |
10519
66c7e651194d
(enriched-annotation-list): property `hard-newline'
Richard M. Stallman <rms@gnu.org>
parents:
9694
diff
changeset
|
234 (define-key enriched-mode-map "\M-S" 'set-justification-center) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
235 (define-key enriched-mode-map "\C-x\t" 'increase-left-margin) |
10519
66c7e651194d
(enriched-annotation-list): property `hard-newline'
Richard M. Stallman <rms@gnu.org>
parents:
9694
diff
changeset
|
236 (define-key enriched-mode-map "\C-c\C-l" 'set-left-margin) |
66c7e651194d
(enriched-annotation-list): property `hard-newline'
Richard M. Stallman <rms@gnu.org>
parents:
9694
diff
changeset
|
237 (define-key enriched-mode-map "\C-c\C-r" 'set-right-margin) |
9676 | 238 |
239 ;;; | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
240 ;;; Some functions dealing with text-properties, especially indentation |
9676 | 241 ;;; |
242 | |
243 (defun enriched-map-property-regions (prop func &optional from to) | |
244 "Apply a function to regions of the buffer based on a text property. | |
245 For each contiguous region of the buffer for which the value of PROPERTY is | |
246 eq, the FUNCTION will be called. Optional arguments FROM and TO specify the | |
247 region over which to scan. | |
248 | |
249 The specified function receives three arguments: the VALUE of the property in | |
250 the region, and the START and END of each region." | |
251 (save-excursion | |
252 (save-restriction | |
253 (if to (narrow-to-region (point-min) to)) | |
254 (goto-char (or from (point-min))) | |
255 (let ((begin (point)) | |
256 end | |
257 (marker (make-marker)) | |
258 (val (get-text-property (point) prop))) | |
259 (while (setq end (text-property-not-all begin (point-max) prop val)) | |
260 (move-marker marker end) | |
261 (funcall func val begin (marker-position marker)) | |
262 (setq begin (marker-position marker) | |
263 val (get-text-property marker prop))) | |
264 (if (< begin (point-max)) | |
265 (funcall func val begin (point-max))))))) | |
266 | |
267 (put 'enriched-map-property-regions 'lisp-indent-hook 1) | |
268 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
269 (defun enriched-insert-indentation (&optional from to) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
270 "Indent and justify each line in the region." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
271 (save-excursion |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
272 (save-restriction |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
273 (if to (narrow-to-region (point-min) to)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
274 (goto-char (or from (point-min))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
275 (if (not (bolp)) (forward-line 1)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
276 (while (not (eobp)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
277 (if (eolp) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
278 nil ; skip blank lines |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
279 (indent-to (current-left-margin)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
280 (justify-current-line t nil t)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
281 (forward-line 1))))) |
9676 | 282 |
283 ;;; | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
284 ;;; Encoding Files |
9676 | 285 ;;; |
286 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
287 ;;;###autoload |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
288 (defun enriched-encode (from to orig-buf) |
9676 | 289 (if enriched-verbose (message "Enriched: encoding document...")) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
290 (save-restriction |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
291 (narrow-to-region from to) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
292 (delete-to-left-margin) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
293 (unjustify-region) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
294 (goto-char from) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
295 (format-replace-strings '(("<" . "<<"))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
296 (format-insert-annotations |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
297 (format-annotate-region from (point-max) enriched-translations |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
298 'enriched-make-annotation enriched-ignore)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
299 (goto-char from) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
300 (insert (if (stringp enriched-initial-annotation) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
301 enriched-initial-annotation |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
302 (save-excursion |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
303 ;; Eval this in the buffer we are annotating. This |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
304 ;; fixes a bug which was saving incorrect File-Width |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
305 ;; information, since we were looking at local |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
306 ;; variables in the wrong buffer. |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
307 (if orig-buf (set-buffer orig-buf)) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
308 (funcall enriched-initial-annotation)))) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
309 (enriched-map-property-regions 'hard |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
310 (lambda (v b e) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
311 (if (and v (= ?\n (char-after b))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
312 (progn (goto-char b) (insert "\n")))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
313 (point) nil) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
314 (if enriched-verbose (message nil)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
315 ;; Return new end. |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
316 (point-max))) |
9676 | 317 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
318 (defun enriched-make-annotation (name positive) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
319 "Format an annotation called NAME. |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
320 If POSITIVE is non-nil, this is the opening annotation, if nil, this is the |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
321 matching close." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
322 (cond ((stringp name) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
323 (format enriched-annotation-format (if positive "" "/") name)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
324 ;; Otherwise it is an annotation with parameters, represented as a list |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
325 (positive |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
326 (let ((item (car name)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
327 (params (cdr name))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
328 (concat (format enriched-annotation-format "" item) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
329 (mapconcat (lambda (i) (concat "<param>" i "</param>")) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
330 params "")))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
331 (t (format enriched-annotation-format "/" (car name))))) |
9676 | 332 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
333 (defun enriched-encode-other-face (old new) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
334 "Generate annotations for random face change. |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
335 One annotation each for foreground color, background color, italic, etc." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
336 (cons (and old (enriched-face-ans old)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
337 (and new (enriched-face-ans new)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
338 |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
339 (defun enriched-face-ans (face) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
340 "Return annotations specifying FACE." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
341 (cond ((string-match "^fg:" (symbol-name face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
342 (list (list "x-color" (substring (symbol-name face) 3)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
343 ((string-match "^bg:" (symbol-name face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
344 (list (list "x-bg-color" (substring (symbol-name face) 3)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
345 ((let* ((fg (face-foreground face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
346 (bg (face-background face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
347 (props (face-font face t)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
348 (ans (cdr (format-annotate-single-property-change |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
349 'face nil props enriched-translations)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
350 (if fg (setq ans (cons (list "x-color" fg) ans))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
351 (if bg (setq ans (cons (list "x-bg-color" bg) ans))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
352 ans)))) |
9676 | 353 |
354 ;;; | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
355 ;;; Decoding files |
9676 | 356 ;;; |
357 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
358 ;;;###autoload |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
359 (defun enriched-decode (from to) |
9676 | 360 (if enriched-verbose (message "Enriched: decoding document...")) |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
361 (use-hard-newlines 1 'never) |
9676 | 362 (save-excursion |
363 (save-restriction | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
364 (narrow-to-region from to) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
365 (goto-char from) |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
366 |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
367 ;; Deal with header |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
368 (let ((file-width (enriched-get-file-width))) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
369 (enriched-remove-header) |
9676 | 370 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
371 ;; Deal with newlines |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
372 (while (search-forward-regexp "\n\n+" nil t) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
373 (if (current-justification) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
374 (delete-char -1)) |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
375 (set-hard-newline-properties (match-beginning 0) (point))) |
9676 | 376 |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
377 ;; Translate annotations |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
378 (format-deannotate-region from (point-max) enriched-translations |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
379 'enriched-next-annotation) |
9676 | 380 |
16021
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
381 ;; Indent or fill the buffer |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
382 (cond (file-width ; File was filled to this width |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
383 (setq fill-column file-width) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
384 (if enriched-verbose (message "Indenting...")) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
385 (enriched-insert-indentation)) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
386 (t ; File was not filled. |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
387 (if enriched-verbose (message "Filling paragraphs...")) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
388 (fill-region (point-min) (point-max)))) |
d6a8a05960d5
Don't fill based on window width.
Richard M. Stallman <rms@gnu.org>
parents:
15239
diff
changeset
|
389 (if enriched-verbose (message nil))) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
390 (point-max)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
391 |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
392 (defun enriched-next-annotation () |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
393 "Find and return next text/enriched annotation. |
13488
71c747dc59ca
(enriched-next-annotation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13337
diff
changeset
|
394 Any \"<<\" strings encountered are converted to \"<\". |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
395 Return value is \(begin end name positive-p), or nil if none was found." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
396 (while (and (search-forward "<" nil 1) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
397 (progn (goto-char (match-beginning 0)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
398 (not (looking-at enriched-annotation-regexp)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
399 (forward-char 1) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
400 (if (= ?< (char-after (point))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
401 (delete-char 1) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
402 ;; A single < that does not start an annotation is an error, |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
403 ;; which we note and then ignore. |
14340
bf1d862f3673
(enriched-next-annotation): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
404 (message "Warning: malformed annotation in file at %s" |
bf1d862f3673
(enriched-next-annotation): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
405 (1- (point))))) |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
406 (if (not (eobp)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
407 (let* ((beg (match-beginning 0)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
408 (end (match-end 0)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
409 (name (downcase (buffer-substring |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
410 (match-beginning 2) (match-end 2)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
411 (pos (not (match-beginning 1)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
412 (list beg end name pos)))) |
9676 | 413 |
414 (defun enriched-get-file-width () | |
415 "Look for file width information on this line." | |
416 (save-excursion | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
417 (if (search-forward "Text-Width: " (+ (point) 1000) t) |
9676 | 418 (read (current-buffer))))) |
419 | |
11055
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
420 (defun enriched-remove-header () |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
421 "Remove file-format header at point." |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
422 (while (looking-at "^[-A-Za-z]+: .*\n") |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
423 (delete-region (point) (match-end 0))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
424 (if (looking-at "^\n") |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
425 (delete-char 1))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
426 |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
427 (defun enriched-decode-foreground (from to color) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
428 (let ((face (intern (concat "fg:" color)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
429 (cond ((internal-find-face face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
430 ((and window-system (facemenu-get-face face))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
431 (window-system |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
432 (message "Warning: color \"%s\" is not defined." color)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
433 ((make-face face) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
434 (message "Warning: Color \"%s\" can't be displayed." color))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
435 (list from to 'face face))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
436 |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
437 (defun enriched-decode-background (from to color) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
438 (let ((face (intern (concat "bg:" color)))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
439 (cond ((internal-find-face face)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
440 ((and window-system (facemenu-get-face face))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
441 (window-system |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
442 (message "Warning: color \"%s\" is not defined." color)) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
443 ((make-face face) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
444 (message "Warning: Color \"%s\" can't be displayed." color))) |
c8790275a636
Rewrite, many things moved to format.el.
Boris Goldowsky <boris@gnu.org>
parents:
10519
diff
changeset
|
445 (list from to 'face face))) |
9676 | 446 |
447 ;;; enriched.el ends here |