X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/430d2ee2919b2d4693780f2474ba40148442d206..0f6990a78ae5016d8ae73253cdb4739adf0197e7:/lisp/textmodes/enriched.el diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index 24a54e8a56..357b9d6c94 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -1,17 +1,16 @@ ;;; enriched.el --- read and save files in text/enriched format -;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1994-1996, 2001-2011 Free Software Foundation, Inc. ;; Author: Boris Goldowsky ;; Keywords: wp, faces ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,9 +18,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -52,7 +49,7 @@ :group 'wp) (defcustom enriched-verbose t - "*If non-nil, give status messages when reading and writing files." + "If non-nil, give status messages when reading and writing files." :type 'boolean :group 'enriched) @@ -166,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 ;;; @@ -187,6 +202,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 @@ -202,6 +219,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. @@ -229,8 +248,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)) @@ -238,29 +255,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 "\C-a" 'beginning-of-line-text) -(define-key enriched-mode-map "\C-m" 'reindent-then-newline-and-indent) -(define-key enriched-mode-map "\C-j" '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 @@ -503,5 +499,4 @@ the range of text to assign text property SYMBOL with value VALUE." (message "Warning: invalid parameter %s" param)) (list start end 'display prop))) -;;; arch-tag: 05cae488-3fea-45cd-ac29-5b02cb64e42b ;;; enriched.el ends here