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: enriched-mode and switching major modes. Date: Sat, 4 Sep 2004 18:58:45 -0500 (CDT) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200409042358.i84Nwjt19152@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1094342372 8259 80.91.224.253 (4 Sep 2004 23:59:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2004 23:59:32 +0000 (UTC) Cc: boris@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 05 01:59:22 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 1C3kRG-0001hd-00 for ; Sun, 05 Sep 2004 01:59:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C3kWL-0005Uu-Vw for ged-emacs-devel@m.gmane.org; Sat, 04 Sep 2004 20:04:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C3kWG-0005Ue-01 for emacs-devel@gnu.org; Sat, 04 Sep 2004 20:04:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C3kWF-0005US-Bq for emacs-devel@gnu.org; Sat, 04 Sep 2004 20:04:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C3kWF-0005UP-8Z for emacs-devel@gnu.org; Sat, 04 Sep 2004 20:04:31 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C3kQr-0007HP-8H; Sat, 04 Sep 2004 19:58:57 -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 i84NwouE000023; Sat, 4 Sep 2004 18:58:50 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id i84Nwjt19152; Sat, 4 Sep 2004 18:58:45 -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:26787 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26787 I noted in an earlier message that when visiting a file that Emacs earlier saved in text/enriched format, say enriched.text (which forces Text mode), Enriched mode is turned on, but `use-hard-newlines' is nil (and hence hard newlines do not work). I suggested solving that problem by making `use-hard-newlines' a permanent local and Richard agreed. I still believe that `use-hard-newlines' should be a permanent local, regardless of the problems with Enriched mode, but I will wait a little bit before installing, since some related issues need to be discussed.. There are several other similar problems. In the same enriched.text buffer, `default-text-properties' is nil, which also messes up some stuff. Also, `indent-line-function' is `indent-relative' instead of `indent-to-left-margin'. `buffer-display-table' is nil. `enriched-old-bindings' is nil. These problems have the same cause as the one I noted earlier for `use-hard-newlines'. `enriched-mode' sets buffer-local values for these variables, but when the major mode is set by `after-find-file', these variables are killed. Of course, similar problems arise whenever the _user_ switches major modes in a buffer already in Enriched mode: all local variables are killed. Enriched mode is currently a minor mode and a permanent local as a variable. It can not possibly set local variables that are non-permanent locals for the reasons described above. If it _has_ to do that, it should be a major mode. One solution is to make Enriched mode into a major mode. It already very much "feels" like one. The other solution would be to make all variables that Enriched mode needs to set permanent locals. For `use-hard-newlines' we already decided that there was no problem. `default-text-properties' is currently not even an automatically local variable, but maybe it should be made into a permanent local. It is _only_ used by enriched mode, so making it into a permanent local should not cause problems. `buffer-display-table' is used by several other packages, but all seem to use it in buffers where changing the major mode does not seem to make any sense to begin with. So it could be made into a permanent local. I believe that there is no way to make `indent-line-function' into a permanent local. Here, I believe that the solution is to no longer have Enriched mode set the variable. Setting `indent-line-function' is the prerogative of the major mode. If Enriched mode absolutely _needs_ to set `indent-line-function' to `indent-to-left-margin', then Enriched mode _needs_ to be a major mode (and then the other problems automatically disappear). `enriched-old-bindings' should not be a permanent local. Its implementation is iffy to begin with. Here I believe all we can do is rely on the fact that disabling Enriched mode only seems to make sense if it was enabled by mistake. Thus, problems arising from `enriched-old-bindings' having the wrong value, though they theoretically exist, are unlikely to arise in practice. Making Enriched mode into a major mode would make `enriched-old-bindings' completely unnecessary. Sincerely, Luc.