]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/enriched.el
Update copyright year to 2015
[gnu-emacs] / lisp / textmodes / enriched.el
index c2711a7345c451d53bbfb519df7c2c3de18f21d5..b9d45b3a32fecac590174f779fd0d8217125ef7e 100644 (file)
@@ -1,7 +1,6 @@
 ;;; enriched.el --- read and save files in text/enriched format
 
-;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
-;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2015 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: wp, faces
@@ -32,7 +31,7 @@
 ;; are supported except for <smaller> and <bigger>, which are currently not
 ;; possible to display.
 
-;; A separate file, enriched.doc, contains further documentation and other
+;; A separate file, enriched.txt, contains further documentation and other
 ;; important information about this code.  It also serves as an example
 ;; file in text/enriched format.  It should be in the etc directory of your
 ;; emacs distribution.
@@ -164,6 +163,24 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
 ;; variables and to correctly update `enriched-old-bindings'.
 (defvar enriched-rerun-flag nil)
 
+;;;
+;;; Keybindings
+;;;
+
+(defvar enriched-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [remap move-beginning-of-line] 'beginning-of-line-text)
+    (define-key map "\C-m" 'reindent-then-newline-and-indent)
+    (define-key map
+      [remap newline-and-indent] 'reindent-then-newline-and-indent)
+    (define-key map "\M-j" 'facemenu-justification-menu)
+    (define-key map "\M-S" 'set-justification-center)
+    (define-key map "\C-x\t" 'increase-left-margin)
+    (define-key map "\C-c[" 'set-left-margin)
+    (define-key map "\C-c]" 'set-right-margin)
+    map)
+  "Keymap for Enriched mode.")
+
 ;;;
 ;;; Define the mode
 ;;;
@@ -174,10 +191,15 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
   "Minor mode for editing text/enriched files.
 These are files with embedded formatting information in the MIME standard
 text/enriched format.
+
+With a prefix argument ARG, enable the mode if ARG is positive,
+and disable it otherwise.  If called from Lisp, enable the mode
+if ARG is omitted or nil.
+
 Turning the mode on or off runs `enriched-mode-hook'.
 
 More information about Enriched mode is available in the file
-etc/enriched.doc in the Emacs distribution directory.
+\"enriched.txt\" in `data-directory'.
 
 Commands:
 
@@ -185,6 +207,8 @@ Commands:
   :group 'enriched :lighter " Enriched"
   (cond ((null enriched-mode)
         ;; Turn mode off
+         (remove-hook 'change-major-mode-hook
+                      'enriched-before-change-major-mode 'local)
         (setq buffer-file-format (delq 'text/enriched buffer-file-format))
         ;; restore old variable values
         (while enriched-old-bindings
@@ -200,6 +224,8 @@ Commands:
         nil)
 
        (t                              ; Turn mode on
+         (add-hook 'change-major-mode-hook
+                   'enriched-before-change-major-mode nil 'local)
         (add-to-list 'buffer-file-format 'text/enriched)
         ;; Save old variable values before we change them.
         ;; These will be restored if we exit Enriched mode.
@@ -227,8 +253,6 @@ Commands:
     (while enriched-old-bindings
       (set (pop enriched-old-bindings) (pop enriched-old-bindings)))))
 
-(add-hook 'change-major-mode-hook 'enriched-before-change-major-mode)
-
 (defun enriched-after-change-major-mode ()
   (when enriched-mode
     (let ((enriched-rerun-flag t))
@@ -236,30 +260,8 @@ Commands:
 
 (add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode)
 
-;;;
-;;; Keybindings
-;;;
-
-(defvar enriched-mode-map nil
-  "Keymap for Enriched mode.")
-
-(if (null enriched-mode-map)
-    (fset 'enriched-mode-map (setq enriched-mode-map (make-sparse-keymap))))
-
-(if (not (assq 'enriched-mode minor-mode-map-alist))
-    (setq minor-mode-map-alist
-         (cons (cons 'enriched-mode enriched-mode-map)
-               minor-mode-map-alist)))
 
-(define-key enriched-mode-map [remap move-beginning-of-line] 'beginning-of-line-text)
-(define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map
-  [remap newline-and-indent] 'reindent-then-newline-and-indent)
-(define-key enriched-mode-map "\M-j" 'facemenu-justification-menu)
-(define-key enriched-mode-map "\M-S" 'set-justification-center)
-(define-key enriched-mode-map "\C-x\t" 'increase-left-margin)
-(define-key enriched-mode-map "\C-c[" 'set-left-margin)
-(define-key enriched-mode-map "\C-c]" 'set-right-margin)
+(fset 'enriched-mode-map enriched-mode-map)
 
 ;;;
 ;;; Some functions dealing with text-properties, especially indentation
@@ -435,7 +437,7 @@ Return value is \(begin end name positive-p), or nil if none was found."
              (progn (goto-char (match-beginning 0))
                     (not (looking-at enriched-annotation-regexp))))
     (forward-char 1)
-    (if (= ?< (char-after (point)))
+    (if (eq ?< (char-after (point)))
        (delete-char 1)
       ;; A single < that does not start an annotation is an error,
       ;; which we note and then ignore.
@@ -502,5 +504,4 @@ the range of text to assign text property SYMBOL with value VALUE."
       (message "Warning: invalid <x-display> parameter %s" param))
     (list start end 'display prop)))
 
-;; arch-tag: 05cae488-3fea-45cd-ac29-5b02cb64e42b
 ;;; enriched.el ends here