;;; enriched.el --- read and save files in text/enriched format
-;; Copyright (c) 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (c) 1994, 1995, 1996 Free Software Foundation, Inc.
;; Author: Boris Goldowsky <boris@gnu.ai.mit.edu>
;; Keywords: wp, faces
;;; Variables controlling the display
;;;
-(defvar enriched-verbose t
- "*If non-nil, give status messages when reading and writing files.")
+(defgroup enriched nil
+ "Read and save files in text/enriched format"
+ :group 'wp)
+
+(defcustom enriched-verbose t
+ "*If non-nil, give status messages when reading and writing files."
+ :type 'boolean
+ :group 'enriched)
;;;
;;; Set up faces & display table
;;;
-;; A slight cheat - all emacs's faces are fixed-width.
-;; The idea is just to pick one that looks different from the default.
-(if (internal-find-face 'fixed)
- nil
- (make-face 'fixed)
- (if window-system
- (set-face-font 'fixed
- (car (or (x-list-fonts "*fixed-medium*"
- 'default (selected-frame))
- (x-list-fonts "*fixed*"
- 'default (selected-frame)))))))
-
-(if (internal-find-face 'excerpt)
- nil
- (make-face 'excerpt)
- (if window-system
- (make-face-italic 'excerpt nil t)))
+;; Emacs doesn't have a "fixed" face by default, since all faces currently
+;; have to be fixed-width. So we just pick one that looks different from the
+;; default.
+(defface fixed
+ '((t (:bold t)))
+ "Face used for text that must be shown in fixed width.
+Currently, emacs can only display fixed-width fonts, but this may change.
+This face is used for text specifically marked as fixed-width, for example
+in text/enriched files."
+ :group 'enriched)
+
+(defface excerpt
+ '((t (:italic t)))
+ "Face used for text that is an excerpt from another document.
+This is used in enriched-mode for text explicitly marked as an excerpt."
+ :group 'enriched)
(defconst enriched-display-table (or (copy-sequence standard-display-table)
(make-display-table)))
(cons '(enriched-mode " Enriched")
minor-mode-alist)))
-(defvar enriched-mode-hook nil
+(defcustom enriched-mode-hook nil
"Functions to run when entering Enriched mode.
If you set variables in this hook, you should arrange for them to be restored
to their old values if you leave Enriched mode. One way to do this is to add
-them and their old values to `enriched-old-bindings'.")
+them and their old values to `enriched-old-bindings'."
+ :type 'hook
+ :group 'enriched)
(defvar enriched-old-bindings nil
"Store old variable values that we change when entering mode.
(if (looking-at "^\n")
(delete-char 1)))
-(defun enriched-decode-foreground (from to color)
+(defun enriched-decode-foreground (from to &optional color)
(let ((face (intern (concat "fg:" color))))
- (cond ((internal-find-face face))
+ (cond ((null color)
+ (message "Warning: no color specified for <x-color>"))
+ ((internal-find-face face))
((and window-system (facemenu-get-face face)))
- (window-system
- (message "Warning: color \"%s\" is not defined." color))
((make-face face)
- (message "Warning: Color \"%s\" can't be displayed." color)))
+ (message "Warning: color `%s' can't be displayed" color)))
(list from to 'face face)))
-(defun enriched-decode-background (from to color)
+(defun enriched-decode-background (from to &optional color)
(let ((face (intern (concat "bg:" color))))
- (cond ((internal-find-face face))
+ (cond ((null color)
+ (message "Warning: no color specified for <x-bg-color>"))
+ ((internal-find-face face))
((and window-system (facemenu-get-face face)))
- (window-system
- (message "Warning: color \"%s\" is not defined." color))
((make-face face)
- (message "Warning: Color \"%s\" can't be displayed." color)))
+ (message "Warning: color `%s' can't be displayed" color)))
(list from to 'face face)))
;;; enriched.el ends here