]> git.eshelyaron.com Git - emacs.git/commitdiff
(enriched-default-text-properties-local-flag): New variable.
authorLuc Teirlinck <teirllm@auburn.edu>
Thu, 23 Sep 2004 22:12:15 +0000 (22:12 +0000)
committerLuc Teirlinck <teirllm@auburn.edu>
Thu, 23 Sep 2004 22:12:15 +0000 (22:12 +0000)
(enriched-mode): Make sure that enabling and disabling the mode is a no-op.
Doc fix.

lisp/ChangeLog
lisp/textmodes/enriched.el

index 0842def464e61e7193c42d6dccbf16425a9b2c85..55c648d32692f918f8f3c0a398e498073d69ff4e 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+       * textmodes/enriched.el
+       (enriched-default-text-properties-local-flag): New variable.
+       (enriched-mode): Make sure that enabling and disabling the mode is
+       a no-op.  Doc fix.
+
 2004-09-23  H\e,Ae\e(Bkon Malmedal  <hmalmedal@yahoo.no>
 
        * calendar/holidays.el (holiday-advent): Report on a specified day
index f25bec2d84188e8f2845f614531ee89e0e0afcdf..4db493803ef9c14009a12b686e59ef036c7ea5bb 100644 (file)
@@ -154,6 +154,12 @@ them and their old values to `enriched-old-bindings'."
 The value is a list of \(VAR VALUE VAR VALUE...).")
 (make-variable-buffer-local 'enriched-old-bindings)
 
+;; The next variable is buffer local if and only if Enriched mode is
+;; enabled.  The buffer local value records whether
+;; `default-text-properties' should remain buffer local when disabling
+;; Enriched mode.  For technical reasons, the default value should be t.
+(defvar enriched-default-text-properties-local-flag t)
+
 ;; Technical internal variable.  Bound to t if `enriched-mode' is
 ;; being rerun by a major mode to allow it to restore buffer-local
 ;; variables and to correctly update `enriched-old-bindings'.
@@ -169,7 +175,7 @@ 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.
-Turning the mode on runs `enriched-mode-hook'.
+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.
@@ -183,7 +189,11 @@ Commands:
         (setq buffer-file-format (delq 'text/enriched buffer-file-format))
         ;; restore old variable values
         (while enriched-old-bindings
-          (set (pop enriched-old-bindings) (pop enriched-old-bindings))))
+          (set (pop enriched-old-bindings) (pop enriched-old-bindings)))
+        (unless enriched-default-text-properties-local-flag
+          (kill-local-variable 'default-text-properties))
+        (kill-local-variable 'enriched-default-text-properties-local-flag)
+        (unless use-hard-newlines (use-hard-newlines 0)))
 
        ((and (memq 'text/enriched buffer-file-format)
              (not enriched-rerun-flag))
@@ -196,7 +206,11 @@ Commands:
         ;; These will be restored if we exit Enriched mode.
         (setq enriched-old-bindings
               (list 'buffer-display-table buffer-display-table
-                    'default-text-properties default-text-properties))
+                    'default-text-properties default-text-properties
+                    'use-hard-newlines use-hard-newlines))
+        (make-local-variable 'enriched-default-text-properties-local-flag)
+        (setq enriched-default-text-properties-local-flag
+              (local-variable-p 'default-text-properties))
         (make-local-variable 'default-text-properties)
         (setq buffer-display-table  enriched-display-table)
         (use-hard-newlines 1 (if enriched-rerun-flag 'never nil))