0
|
1 ;;; enriched.el --- read and save files in text/enriched format
|
|
2 ;; Copyright (c) 1994, 1995 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; XEmacs version: Mike Sperber <sperber@informatik.uni-tuebingen.de>
|
|
5 ;; Original author: Boris Goldowsky <boris@gnu.ai.mit.edu>
|
|
6 ;; Keywords: wp, faces
|
|
7
|
2
|
8 ;; This file is part of XEmacs.
|
0
|
9
|
2
|
10 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
11 ;; under the terms of the GNU General Public License as published by
|
0
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
2
|
14
|
|
15 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18 ;; General Public License for more details.
|
|
19
|
0
|
20 ;; You should have received a copy of the GNU General Public License
|
2
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
23 ;; 02111-1307, USA.
|
0
|
24
|
2
|
25 ;;; Synched up with: FSF 19.34.
|
0
|
26
|
|
27 ;;; Commentary:
|
|
28 ;;
|
|
29 ;; This file implements reading, editing, and saving files with
|
2
|
30 ;; text-properties such as faces, levels of indentation, and true line
|
|
31 ;; breaks distinguished from newlines just used to fit text into the
|
|
32 ;; window.
|
0
|
33 ;;
|
|
34 ;; The file format used is the MIME text/enriched format, which is a
|
|
35 ;; standard format defined in internet RFC 1563. All standard
|
|
36 ;; annotations are supported.
|
|
37 ;;
|
2
|
38 ;; A separate file, enriched.doc, contains further documentation and
|
|
39 ;; other important information about this code. It also serves as an
|
|
40 ;; example file in text/enriched format. It should be in the etc
|
|
41 ;; directory of your emacs distribution.
|
0
|
42 ;;
|
|
43 ;;; TODO for the XEmacs port:
|
|
44 ;;
|
|
45 ;; Currently XEmacs does not support default-text-properties. The
|
|
46 ;; original enriched.el uses this to set the left-margin,
|
|
47 ;; right-margin, and justification properties to 'front-sticky.
|
|
48 ;; If you know the Right Way to fix this, contact
|
|
49 ;; Mike Sperber <sperber@informatik.uni-tuebingen.de>.
|
|
50
|
|
51 (provide 'enriched)
|
2
|
52 (if window-system (require 'facemenu))
|
0
|
53
|
|
54 ;;;
|
|
55 ;;; Variables controlling the display
|
|
56 ;;;
|
|
57
|
|
58 (defvar enriched-verbose t
|
|
59 "*If non-nil, give status messages when reading and writing files.")
|
|
60
|
|
61 (defvar enriched-default-right-margin 10
|
|
62 "*Default amount of space to leave on the right edge of the screen.
|
|
63 This can be increased inside text by changing the 'right-margin text property.
|
|
64 Measured in character widths. If the screen is narrower than this, it is
|
|
65 assumed to be 0.")
|
|
66
|
|
67 (defvar enriched-fill-after-visiting t
|
|
68 "If t, fills paragraphs when reading in enriched documents.
|
|
69 If nil, only fills when you explicitly request it. If the value is 'ask, then
|
|
70 it will query you whether to fill.
|
|
71 Filling is never done if the current text-width is the same as the value
|
|
72 stored in the file.")
|
|
73
|
|
74 ;;;
|
|
75 ;;; Set up faces & display table
|
|
76 ;;;
|
|
77
|
2
|
78 ;; XEmacs change (Can't cheat, we have variable width fonts)
|
0
|
79 (if (not (find-face 'fixed))
|
|
80 (copy-face 'default 'fixed))
|
|
81
|
|
82 (if (not (find-face 'excerpt))
|
|
83 (copy-face 'italic 'excerpt))
|
|
84
|
|
85 (defconst enriched-display-table (make-display-table))
|
|
86 (aset enriched-display-table ?\f (make-string (1- (frame-width)) ?-))
|
|
87
|
2
|
88 (defconst enriched-par-props '(left-margin right-margin justification)
|
|
89 "Text-properties that usually apply to whole paragraphs.
|
|
90 These are set front-sticky everywhere except at hard newlines.")
|
|
91
|
0
|
92 ;;;
|
|
93 ;;; Variables controlling the file format
|
|
94 ;;; (bidirectional)
|
|
95
|
|
96 (defconst enriched-initial-annotation
|
|
97 (lambda ()
|
|
98 (format "Content-Type: text/enriched\nText-Width: %d\n\n"
|
|
99 (enriched-text-width)))
|
|
100 "What to insert at the start of a text/enriched file.
|
|
101 If this is a string, it is inserted. If it is a list, it should be a lambda
|
|
102 expression, which is evaluated to get the string to insert.")
|
|
103
|
|
104 (defconst enriched-annotation-format "<%s%s>"
|
|
105 "General format of enriched-text annotations.")
|
|
106
|
|
107 (defconst enriched-annotation-regexp "<\\(/\\)?\\([-A-za-z0-9]+\\)>"
|
|
108 "Regular expression matching enriched-text annotations.")
|
|
109
|
|
110 (defconst enriched-translations
|
|
111 '((face (bold-italic "bold" "italic")
|
|
112 (bold "bold")
|
|
113 (italic "italic")
|
|
114 (underline "underline")
|
|
115 (fixed "fixed")
|
|
116 (excerpt "excerpt")
|
|
117 (default )
|
|
118 (nil enriched-encode-other-face))
|
2
|
119 (left-margin (4 "indent"))
|
|
120 (right-margin (4 "indentright"))
|
0
|
121 (justification (none "nofill")
|
|
122 (right "flushright")
|
|
123 (left "flushleft")
|
|
124 (full "flushboth")
|
|
125 (center "center"))
|
|
126 (PARAMETER (t "param")) ; Argument of preceding annotation
|
2
|
127 ;; The following are not part of the standard:
|
0
|
128 (FUNCTION (enriched-decode-foreground "x-color")
|
|
129 (enriched-decode-background "x-bg-color")
|
2
|
130 ;; XEmacs addition
|
0
|
131 (facemenu-make-larger "bigger")
|
|
132 (facemenu-make-smaller "smaller"))
|
|
133 (read-only (t "x-read-only"))
|
2
|
134 (unknown (nil format-annotate-value))
|
|
135 ; (font-size (2 "bigger") ; unimplemented
|
|
136 ; (-2 "smaller"))
|
|
137 )
|
0
|
138 "List of definitions of text/enriched annotations.
|
|
139 See `format-annotate-region' and `format-deannotate-region' for the definition
|
|
140 of this structure.")
|
|
141
|
2
|
142 (defconst enriched-ignore
|
|
143 '(front-sticky rear-nonsticky hard)
|
0
|
144 "Properties that are OK to ignore when saving text/enriched files.
|
|
145 Any property that is neither on this list nor dealt with by
|
|
146 `enriched-translations' will generate a warning.")
|
|
147
|
|
148 ;;; Internal variables
|
|
149
|
|
150 (defvar enriched-mode nil
|
2
|
151 "True if Enriched mode is in use.")
|
0
|
152 (make-variable-buffer-local 'enriched-mode)
|
|
153
|
|
154 (if (not (assq 'enriched-mode minor-mode-alist))
|
|
155 (setq minor-mode-alist
|
|
156 (cons '(enriched-mode " Enriched")
|
|
157 minor-mode-alist)))
|
|
158
|
2
|
159 (defvar enriched-mode-hook nil
|
|
160 "Functions to run when entering Enriched mode.
|
0
|
161 If you set variables in this hook, you should arrange for them to be restored
|
2
|
162 to their old values if you leave Enriched mode. One way to do this is to add
|
0
|
163 them and their old values to `enriched-old-bindings'.")
|
|
164
|
|
165 (defvar enriched-old-bindings nil
|
|
166 "Store old variable values that we change when entering mode.
|
|
167 The value is a list of \(VAR VALUE VAR VALUE...).")
|
|
168 (make-variable-buffer-local 'enriched-old-bindings)
|
|
169
|
|
170 (defvar enriched-text-width nil)
|
|
171 (make-variable-buffer-local 'enriched-text-width)
|
|
172
|
|
173 ;;;
|
|
174 ;;; Define the mode
|
|
175 ;;;
|
|
176
|
|
177 ;;;###autoload
|
|
178 (defun enriched-mode (&optional arg)
|
|
179 "Minor mode for editing text/enriched files.
|
|
180 These are files with embedded formatting information in the MIME standard
|
|
181 text/enriched format.
|
2
|
182 Turning the mode on runs `enriched-mode-hook'.
|
0
|
183
|
2
|
184 More information about Enriched mode is available in the file
|
0
|
185 etc/enriched.doc in the Emacs distribution directory.
|
|
186
|
|
187 Commands:
|
|
188
|
|
189 \\<enriched-mode-map>\\{enriched-mode-map}"
|
|
190 (interactive "P")
|
|
191 (let ((mod (buffer-modified-p)))
|
|
192 (cond ((or (<= (prefix-numeric-value arg) 0)
|
|
193 (and enriched-mode (null arg)))
|
|
194 ;; Turn mode off
|
|
195 (setq enriched-mode nil)
|
|
196 (setq buffer-file-format (delq 'text/enriched buffer-file-format))
|
|
197 ;; restore old variable values
|
|
198 (while enriched-old-bindings
|
|
199 (funcall 'set (car enriched-old-bindings)
|
|
200 (car (cdr enriched-old-bindings)))
|
|
201 (setq enriched-old-bindings (cdr (cdr enriched-old-bindings)))))
|
|
202
|
|
203 (enriched-mode nil) ; Mode already on; do nothing.
|
|
204
|
|
205 (t (setq enriched-mode t) ; Turn mode on
|
|
206 (if (not (memq 'text/enriched buffer-file-format))
|
|
207 (setq buffer-file-format
|
|
208 (cons 'text/enriched buffer-file-format)))
|
|
209 ;; Save old variable values before we change them.
|
2
|
210 ;; These will be restored if we exit Enriched mode.
|
0
|
211 (setq enriched-old-bindings
|
2
|
212 ;; XEmacs change
|
|
213 (list ; 'buffer-display-table buffer-display-table
|
|
214 'indent-line-function indent-line-function
|
|
215 'use-hard-newlines use-hard-newlines
|
|
216 'default-text-properties default-text-properties))
|
0
|
217 (make-local-variable 'indent-line-function)
|
|
218 (make-local-variable 'use-hard-newlines)
|
2
|
219 (make-local-variable 'default-text-properties)
|
0
|
220 (setq indent-line-function 'indent-to-left-margin
|
2
|
221 ;; XEmacs change
|
|
222 ;; buffer-display-table enriched-display-table
|
|
223 use-hard-newlines t)
|
|
224 (let ((sticky (plist-get default-text-properties 'front-sticky))
|
|
225 (p enriched-par-props))
|
|
226 (while p
|
|
227 (if (not (memq (car p) sticky))
|
|
228 (setq sticky (cons (car p) sticky)))
|
|
229 (setq p (cdr p)))
|
|
230 (if sticky
|
|
231 (setq default-text-properties
|
|
232 (plist-put default-text-properties
|
|
233 'front-sticky sticky))))
|
|
234 (run-hooks 'enriched-mode-hook)))
|
0
|
235 (set-buffer-modified-p mod)
|
2
|
236 ;; XEmacs change
|
0
|
237 (redraw-modeline)))
|
|
238
|
|
239 ;;;
|
|
240 ;;; Keybindings
|
|
241 ;;;
|
|
242
|
|
243 (defvar enriched-mode-map nil
|
2
|
244 "Keymap for Enriched mode.")
|
0
|
245
|
|
246 (if (null enriched-mode-map)
|
|
247 (fset 'enriched-mode-map (setq enriched-mode-map (make-sparse-keymap))))
|
|
248
|
|
249 (if (not (assq 'enriched-mode minor-mode-map-alist))
|
|
250 (setq minor-mode-map-alist
|
|
251 (cons (cons 'enriched-mode enriched-mode-map)
|
|
252 minor-mode-map-alist)))
|
|
253
|
|
254 (define-key enriched-mode-map "\C-a" 'beginning-of-line-text)
|
|
255 (define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent)
|
|
256 (define-key enriched-mode-map "\C-j" 'reindent-then-newline-and-indent)
|
|
257 (define-key enriched-mode-map "\M-j" 'facemenu-justification-menu)
|
|
258 (define-key enriched-mode-map "\M-S" 'set-justification-center)
|
|
259 (define-key enriched-mode-map "\C-x\t" 'increase-left-margin)
|
|
260 (define-key enriched-mode-map "\C-c\C-l" 'set-left-margin)
|
|
261 (define-key enriched-mode-map "\C-c\C-r" 'set-right-margin)
|
|
262
|
|
263 ;;;
|
|
264 ;;; Some functions dealing with text-properties, especially indentation
|
|
265 ;;;
|
|
266
|
|
267 (defun enriched-map-property-regions (prop func &optional from to)
|
|
268 "Apply a function to regions of the buffer based on a text property.
|
|
269 For each contiguous region of the buffer for which the value of PROPERTY is
|
|
270 eq, the FUNCTION will be called. Optional arguments FROM and TO specify the
|
|
271 region over which to scan.
|
|
272
|
|
273 The specified function receives three arguments: the VALUE of the property in
|
|
274 the region, and the START and END of each region."
|
|
275 (save-excursion
|
|
276 (save-restriction
|
|
277 (if to (narrow-to-region (point-min) to))
|
|
278 (goto-char (or from (point-min)))
|
|
279 (let ((begin (point))
|
|
280 end
|
|
281 (marker (make-marker))
|
|
282 (val (get-text-property (point) prop)))
|
|
283 (while (setq end (text-property-not-all begin (point-max) prop val))
|
|
284 (move-marker marker end)
|
|
285 (funcall func val begin (marker-position marker))
|
|
286 (setq begin (marker-position marker)
|
|
287 val (get-text-property marker prop)))
|
|
288 (if (< begin (point-max))
|
|
289 (funcall func val begin (point-max)))))))
|
|
290
|
|
291 (put 'enriched-map-property-regions 'lisp-indent-hook 1)
|
|
292
|
|
293 (defun enriched-insert-indentation (&optional from to)
|
|
294 "Indent and justify each line in the region."
|
|
295 (save-excursion
|
|
296 (save-restriction
|
|
297 (if to (narrow-to-region (point-min) to))
|
|
298 (goto-char (or from (point-min)))
|
|
299 (if (not (bolp)) (forward-line 1))
|
|
300 (while (not (eobp))
|
|
301 (if (eolp)
|
|
302 nil ; skip blank lines
|
|
303 (indent-to (current-left-margin))
|
|
304 (justify-current-line t nil t))
|
|
305 (forward-line 1)))))
|
|
306
|
|
307 (defun enriched-text-width ()
|
|
308 "The width of unindented text in this window, in characters.
|
|
309 This is the width of the window minus `enriched-default-right-margin'."
|
|
310 (or enriched-text-width
|
|
311 (let ((ww (window-width)))
|
|
312 (setq enriched-text-width
|
|
313 (if (> ww enriched-default-right-margin)
|
|
314 (- ww enriched-default-right-margin)
|
|
315 ww)))))
|
|
316
|
|
317 ;;;
|
|
318 ;;; Encoding Files
|
|
319 ;;;
|
|
320
|
|
321 ;;;###autoload
|
|
322 (defun enriched-encode (from to)
|
|
323 (if enriched-verbose (message "Enriched: encoding document..."))
|
|
324 (save-restriction
|
|
325 (narrow-to-region from to)
|
|
326 (delete-to-left-margin)
|
|
327 (unjustify-region)
|
|
328 (goto-char from)
|
|
329 (format-replace-strings '(("<" . "<<")))
|
|
330 (format-insert-annotations
|
|
331 (format-annotate-region from (point-max) enriched-translations
|
|
332 'enriched-make-annotation enriched-ignore))
|
|
333 (goto-char from)
|
|
334 (insert (if (stringp enriched-initial-annotation)
|
|
335 enriched-initial-annotation
|
|
336 (funcall enriched-initial-annotation)))
|
|
337 (enriched-map-property-regions 'hard
|
|
338 (lambda (v b e)
|
|
339 (if (and v (= ?\n (char-after b)))
|
|
340 (progn (goto-char b) (insert "\n"))))
|
|
341 (point) nil)
|
|
342 (if enriched-verbose (message nil))
|
|
343 ;; Return new end.
|
|
344 (point-max)))
|
|
345
|
|
346 (defun enriched-make-annotation (name positive)
|
|
347 "Format an annotation called NAME.
|
|
348 If POSITIVE is non-nil, this is the opening annotation, if nil, this is the
|
|
349 matching close."
|
|
350 (cond ((stringp name)
|
|
351 (format enriched-annotation-format (if positive "" "/") name))
|
|
352 ;; Otherwise it is an annotation with parameters, represented as a list
|
|
353 (positive
|
|
354 (let ((item (car name))
|
|
355 (params (cdr name)))
|
|
356 (concat (format enriched-annotation-format "" item)
|
|
357 (mapconcat (lambda (i) (concat "<param>" i "</param>"))
|
|
358 params ""))))
|
|
359 (t (format enriched-annotation-format "/" (car name)))))
|
|
360
|
2
|
361 ;; XEmacs addition
|
0
|
362 (defun enriched-face-strip-size (face)
|
|
363 "Create a symbol from the name of FACE devoid of size information,
|
|
364 i.e. remove all larger- and smaller- prefixes."
|
|
365 (let* ((face-symbol (face-name face))
|
|
366 (face-name (symbol-name face-symbol))
|
|
367 (old-name face-name)
|
|
368 new-name)
|
|
369 (while
|
|
370 (not (string-equal
|
|
371 old-name
|
|
372 (setq new-name (replace-in-string old-name "^larger-" ""))))
|
|
373 (setq old-name new-name))
|
|
374
|
|
375 (while
|
|
376 (not (string-equal
|
|
377 old-name
|
|
378 (setq new-name (replace-in-string old-name "^smaller-" ""))))
|
|
379 (setq old-name new-name))
|
|
380
|
|
381 (if (string-equal new-name face-name)
|
|
382 face-symbol
|
|
383 (intern new-name))))
|
|
384
|
|
385 (defun enriched-encode-other-face (old new)
|
|
386 "Generate annotations for random face change.
|
|
387 One annotation each for foreground color, background color, italic, etc."
|
|
388 (cons (and old (enriched-face-ans old))
|
|
389 (and new (enriched-face-ans new))))
|
|
390
|
|
391 (defun enriched-face-ans (face)
|
|
392 "Return annotations specifying FACE."
|
2
|
393 ;; XEmacs change (entire body of this function)
|
0
|
394 (let ((face-name (symbol-name face)))
|
|
395 (cond ((string-match "^fg:" face-name)
|
|
396 (list (list "x-color" (substring face-name 3))))
|
|
397 ((string-match "^bg:" face-name)
|
|
398 (list (list "x-bg-color" (substring face-name 3))))
|
|
399 ((or (string-match "^larger-" face-name)
|
|
400 (string-match "^smaller-" face-name))
|
|
401 (cdr (format-annotate-single-property-change
|
|
402 'face nil (enriched-face-strip-size face)
|
|
403 enriched-translations)))
|
|
404 (t
|
|
405 (let* ((fg (and (not (eq (face-foreground face)
|
|
406 (face-foreground 'default)))
|
|
407 (color-instance-name (face-foreground face))))
|
|
408 (bg (and (not (eq (face-background face)
|
|
409 (face-background 'default)))
|
|
410 (color-instance-name (face-background face))))
|
|
411 (ans '()))
|
|
412 (if fg (setq ans (cons (list "x-color" fg) ans)))
|
|
413 (if bg (setq ans (cons (list "x-bg-color" bg) ans)))
|
|
414 ans)))))
|
|
415
|
2
|
416 ;; XEmacs addition
|
0
|
417 (defun enriched-size-annotation (n annotation)
|
|
418 "Generate ANNOTATION N times."
|
|
419 (let ((l '()))
|
|
420 (while (not (zerop n))
|
|
421 (setq l (cons annotation l))
|
|
422 (setq n (1- n)))
|
|
423 l))
|
|
424
|
2
|
425 ;; XEmacs addition
|
0
|
426 (defun enriched-encode-size (old new)
|
|
427 "Return annotations specifying SIZE."
|
|
428 (let* ((old (or old 0))
|
|
429 (new (or new 0))
|
|
430 (closing-annotation
|
|
431 (enriched-size-annotation (abs old)
|
|
432 (if (> old 0) "bigger" "smaller")))
|
|
433 (opening-annotation
|
|
434 (enriched-size-annotation (abs new)
|
|
435 (if (> new 0) "bigger" "smaller"))))
|
|
436 (cons closing-annotation
|
|
437 opening-annotation)))
|
|
438
|
|
439 ;;;
|
|
440 ;;; Decoding files
|
|
441 ;;;
|
|
442
|
|
443 ;;;###autoload
|
|
444 (defun enriched-decode (from to)
|
|
445 (if enriched-verbose (message "Enriched: decoding document..."))
|
|
446 (save-excursion
|
|
447 (save-restriction
|
|
448 (narrow-to-region from to)
|
|
449 (goto-char from)
|
|
450 (let ((file-width (enriched-get-file-width))
|
|
451 (use-hard-newlines t))
|
|
452 (enriched-remove-header)
|
|
453
|
|
454 ;; Deal with newlines
|
|
455 (goto-char from)
|
|
456 (while (search-forward-regexp "\n\n+" nil t)
|
|
457 (if (current-justification)
|
|
458 (delete-char -1))
|
|
459 (put-text-property (match-beginning 0) (point) 'hard t)
|
|
460 (put-text-property (match-beginning 0) (point) 'front-sticky nil))
|
|
461
|
|
462 ;; Translate annotations
|
|
463 (format-deannotate-region from (point-max) enriched-translations
|
|
464 'enriched-next-annotation)
|
|
465
|
|
466 ;; Fill paragraphs
|
|
467 (if (or (and file-width ; possible reasons not to fill:
|
|
468 (= file-width (enriched-text-width))) ; correct wd.
|
|
469 (null enriched-fill-after-visiting) ; never fill
|
|
470 (and (eq 'ask enriched-fill-after-visiting) ; asked & declined
|
|
471 (not (y-or-n-p "Re-fill for current display width? "))))
|
|
472 ;; Minimally, we have to insert indentation and justification.
|
|
473 (enriched-insert-indentation)
|
|
474 (if enriched-verbose (message "Filling paragraphs..."))
|
|
475 (fill-region (point-min) (point-max))))
|
|
476 (if enriched-verbose (message nil))
|
|
477 (point-max))))
|
|
478
|
|
479 (defun enriched-next-annotation ()
|
|
480 "Find and return next text/enriched annotation.
|
|
481 Any \"<<\" strings encountered are converted to \"<\".
|
|
482 Return value is \(begin end name positive-p), or nil if none was found."
|
|
483 (while (and (search-forward "<" nil 1)
|
|
484 (progn (goto-char (match-beginning 0))
|
|
485 (not (looking-at enriched-annotation-regexp))))
|
|
486 (forward-char 1)
|
|
487 (if (= ?< (char-after (point)))
|
|
488 (delete-char 1)
|
|
489 ;; A single < that does not start an annotation is an error,
|
|
490 ;; which we note and then ignore.
|
2
|
491 (message "Warning: malformed annotation in file at %s"
|
|
492 (1- (point)))))
|
0
|
493 (if (not (eobp))
|
|
494 (let* ((beg (match-beginning 0))
|
|
495 (end (match-end 0))
|
|
496 (name (downcase (buffer-substring
|
|
497 (match-beginning 2) (match-end 2))))
|
|
498 (pos (not (match-beginning 1))))
|
|
499 (list beg end name pos))))
|
|
500
|
|
501 (defun enriched-get-file-width ()
|
|
502 "Look for file width information on this line."
|
|
503 (save-excursion
|
|
504 (if (search-forward "Text-Width: " (+ (point) 1000) t)
|
|
505 (read (current-buffer)))))
|
|
506
|
|
507 (defun enriched-remove-header ()
|
|
508 "Remove file-format header at point."
|
|
509 (while (looking-at "^[-A-Za-z]+: .*\n")
|
|
510 (delete-region (point) (match-end 0)))
|
|
511 (if (looking-at "^\n")
|
|
512 (delete-char 1)))
|
|
513
|
|
514 (defun enriched-decode-foreground (from to color)
|
2
|
515 ;; XEmacs change
|
0
|
516 (let ((face (facemenu-get-face (intern (concat "fg:" color)))))
|
|
517 (if (not face)
|
|
518 (progn
|
|
519 (make-face face)
|
|
520 (message "Warning: Color \"%s\" can't be displayed." color)))
|
|
521 (list from to 'face face)))
|
|
522
|
|
523 (defun enriched-decode-background (from to color)
|
2
|
524 ;; XEmacs change
|
0
|
525 (let ((face (facemenu-get-face (intern (concat "bg:" color)))))
|
|
526 (if (not face)
|
|
527 (progn
|
|
528 (make-face face)
|
|
529 (message "Warning: Color \"%s\" can't be displayed." color)))
|
|
530 (list from to 'face face)))
|
|
531
|
|
532 ;;; enriched.el ends here
|