From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: The *Warnings* buffer and undo Date: Fri, 30 Mar 2007 07:07:22 +0900 Message-ID: <87y7lf1z6t.fsf@catnip.gol.com> References: <460583AD.7010002@gmail.com> <85abxxw46j.fsf@lola.goethe.zz> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1175206068 17452 80.91.229.12 (29 Mar 2007 22:07:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 29 Mar 2007 22:07:48 +0000 (UTC) Cc: rgm@gnu.org, lennart.borgman@gmail.com, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 30 00:07:41 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HX2mO-0004dT-CK for ged-emacs-devel@m.gmane.org; Fri, 30 Mar 2007 00:07:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HX2p0-0006YS-K9 for ged-emacs-devel@m.gmane.org; Thu, 29 Mar 2007 17:10:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HX2ox-0006YI-0j for emacs-devel@gnu.org; Thu, 29 Mar 2007 18:10:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HX2ov-0006Y6-F8 for emacs-devel@gnu.org; Thu, 29 Mar 2007 18:10:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HX2ov-0006Y3-Ct for emacs-devel@gnu.org; Thu, 29 Mar 2007 17:10:13 -0500 Original-Received: from smtp02.dentaku.gol.com ([203.216.5.72]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HX2mE-0001MI-J1; Thu, 29 Mar 2007 18:07:27 -0400 Original-Received: from 203-216-104-183.dsl.gol.ne.jp ([203.216.104.183] helo=catnip.gol.com) by smtp02.dentaku.gol.com with esmtpa (Dentaku) id 1HX2mC-0006iJ-7K; Fri, 30 Mar 2007 07:07:24 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id 39B9A2F43; Fri, 30 Mar 2007 07:07:22 +0900 (JST) System-Type: i686-pc-linux-gnu In-Reply-To: (Richard Stallman's message of "Thu\, 29 Mar 2007 13\:59\:40 -0400") Original-Lines: 42 X-Abuse-Complaints: abuse@gol.com X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68764 Archived-At: Richard Stallman writes: > Otherwise undo information will be recorded sparsely (for example, for > user input), leading to inconsistent results. > > That was my first reaction, but then it occurred to me that recording > undo info only for user editing might be just the right thing. There's already another thread on exactly this topic (see the subject "A new(?) warning of erase-buffer, which was not seen before."). I want to add this feature for comint, and ERC already uses it. Basically you can't just bind buffer-undo-list; there are complications because undo information holds absolute positions (not, e.g., markers). If any changes are shielded from the undo recording mechanism, the positions in buffer-undo-list get screwed up. Possible solution to this problem are: (1) Instead of binding buffer-undo-list, have special insert/delete functions that do the operation and then update buffer-undo-list accordingly. This only works if you have control over all the relevant insert/delete calls. (2) Have an explicit function for fixing up buffer-undo-list. The caller would then let-bind buffer-undo-list around the insertions/deletions and then call the function to fix things up. This only would work if it's very simple to describe (to the fixup function) where the ignored operations happened; that might be true of e.g., comint, but maybe not in other contexts. (3) Modify the emacs insert/delete primitives to do the job, e.g., they could look for a variable like `inhibit-undo', and if non-nil, fixup buffer-undo-list to account for the new operation instead of actually recording the new operation in it. All of this for after the release of course. :-) -Miles -- Love is a snowmobile racing across the tundra. Suddenly it flips over, pinning you underneath. At night the ice weasels come. --Nietzsche