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: Re: enriched-mode and switching major modes. Date: Sat, 11 Sep 2004 20:46:15 -0500 (CDT) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200409120146.i8C1kFu13576@raven.dms.auburn.edu> References: <200409042358.i84Nwjt19152@raven.dms.auburn.edu> <200409060059.i860xdo20431@raven.dms.auburn.edu> <200409110214.i8B2EaZ12276@raven.dms.auburn.edu> <200409112151.i8BLpRB13427@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1094953656 17469 80.91.229.6 (12 Sep 2004 01:47:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Sep 2004 01:47:36 +0000 (UTC) Cc: boris@gnu.org, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 12 03:47:20 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 1C6JSa-0003JX-00 for ; Sun, 12 Sep 2004 03:47:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6JY2-0004Np-89 for ged-emacs-devel@m.gmane.org; Sat, 11 Sep 2004 21:52:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6JXu-0004Nk-NT for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:52:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6JXt-0004NY-5M for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:52:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6JXt-0004NV-3O for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:52:49 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6JRw-0002kx-6a; Sat, 11 Sep 2004 21:46:40 -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 i8C1kduE005852; Sat, 11 Sep 2004 20:46:39 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id i8C1kFu13576; Sat, 11 Sep 2004 20:46:15 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan on Sat, 11 Sep 2004 18:55:49 -0400) 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:27033 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27033 Stefan Monnier wrote: It seems you don't realize that a lot of elisp code suffers from such "not 100% correct state if C-g is hit at the wrong moment". It's not such a big deal. It is a big deal if the nature of the inconsistent state is not obvious. In this case the situation is particularly bad, because even immediately doing C-x C-c after the quit may result in buffers being saved in the wrong format. you can do ! (add-to-list 'enriched-marked-buffers (current-buffer)))) ! (setq enriched-change-major-mode-flag t) ! (enriched-mode 0) No, because enriched-mode sets enriched-change-major-mode-flag to nil, (It has to.) ! (add-to-list 'enriched-marked-buffers (current-buffer)))) ! (setq enriched-change-major-mode-flag t) ! (let (enriched-change-major-mode-flag) ! (enriched-mode 0)) would be less bad. But even that would give problems if a quit happened during the execution of enriched-mode. Ayway, why try to find half-baked solutions to a completely _non-existent_ problem? `inhibit-quit' is only a problem around code that can take a non-trivial time to execute. Oh, and please don't go through details like mentioning with-local-quit when it's just one of many possible cases (and especially since the cause of the "problem" is not with-local-quit, but just the `quit' itself). It is because of `with-local-quit' that more than one buffer can be involved. That could not happen with an error or a regular quit. (Unless the error was handled in a way similar to `with-local-quit'.) BTW, looking at the enriched-mode code, I'm wondering whether all this fiddling is necessary. After all the variables it sets are: Eventually Enriched mode will need to set more variables. It is not a major mode but feels very much like one. >>From other people's reactions it would seem that the two major alternatives are my patch (or some variation thereof) and simply making enriched-mode into a major mode. I do not object against making enriched-mode into a major mode. It would be a lot _simpler_ than the solution I implemented. But note that after my patch you can use Enriched mode as a major mode _anyway_ (for all practical purposes) by combining it with fundamental mode. But you can also combine it with any other major mode that is "compatible" with Enriched mode. So you get extra flexibility for the added complexity. Details: - use-hard-newlines: we agreed this should also be permanent-local. It now is. (I installed that.) Sincerely, Luc.