From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Some further problems with enriched mode. Date: Wed, 22 Sep 2004 20:18:47 -0500 (CDT) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200409230118.i8N1IlC29160@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1095902375 11943 80.91.229.6 (23 Sep 2004 01:19:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Sep 2004 01:19:35 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 23 03:19:23 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CAIGZ-0003ZS-00 for ; Thu, 23 Sep 2004 03:19:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAIMZ-0005JD-8m for ged-emacs-devel@m.gmane.org; Wed, 22 Sep 2004 21:25:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CAIMP-0005Gp-A1 for emacs-devel@gnu.org; Wed, 22 Sep 2004 21:25:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CAIMO-0005GG-7S for emacs-devel@gnu.org; Wed, 22 Sep 2004 21:25:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAIMO-0005GB-3V for emacs-devel@gnu.org; Wed, 22 Sep 2004 21:25:24 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CAIGI-0002Zk-Vg for emacs-devel@gnu.org; Wed, 22 Sep 2004 21:19:07 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i8N1J0iU002077 for ; Wed, 22 Sep 2004 20:19:00 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id i8N1IlC29160; Wed, 22 Sep 2004 20:18:47 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27468 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27468 When foo-mode is a minor mode, I would normally expect that running (foo-mode) twice in succession would be a no-op. With `enriched-mode' this is not the case. Enabling and immediately disabling Enriched mode will leave hard newlines enabled, even if they were previously disabled. It will also result in `default-text-properties' being made buffer local, even if it was not before (it is not buffer local by default). The following patch would make enabling and disabling Enriched mode a no-op. I can install if desired. ===File ~/enriched.el-diff================================== *** enriched.el 14 Sep 2004 17:10:54 -0500 1.5 --- enriched.el 22 Sep 2004 19:04:51 -0500 *************** *** 154,159 **** --- 154,165 ---- 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,175 **** "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'. More information about Enriched mode is available in the file etc/enriched.doc in the Emacs distribution directory. --- 175,181 ---- "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 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,189 **** (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)))) ((and (memq 'text/enriched buffer-file-format) (not enriched-rerun-flag)) --- 189,199 ---- (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))) ! (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,202 **** ;; 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)) (make-local-variable 'default-text-properties) (setq buffer-display-table enriched-display-table) (use-hard-newlines 1 (if enriched-rerun-flag 'never nil)) --- 206,216 ---- ;; 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 ! '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)) ============================================================