From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.devel Subject: Re: gratuitous changes Date: Thu, 6 Feb 2003 12:22:31 -0500 Sender: cc-mode-help-admin@lists.sourceforge.net Message-ID: <20030206172231.GA32231@gnu.org> References: <5b3cn7lgx6.fsf@lister.roxen.com> <20030202061404.GB3660@gnu.org> <5bk7gd74hw.fsf@lister.roxen.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1044552119 13684 80.91.224.249 (6 Feb 2003 17:21:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 6 Feb 2003 17:21:59 +0000 (UTC) Cc: Eli Zaretskii , mast@lysator.liu.se, emacs-devel@gnu.org, rms@gnu.org Return-path: Original-Received: from lists.sourceforge.net ([66.35.250.206] helo=sc8-sf-list2.sourceforge.net) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18gpim-0003YU-00 for ; Thu, 06 Feb 2003 18:21:57 +0100 Original-Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13] helo=sc8-sf-list1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 18gpk4-0006Kp-00; Thu, 06 Feb 2003 09:23:16 -0800 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by sc8-sf-list1.sourceforge.net with esmtp (Cipher TLSv1:DES-CBC3-SHA:168) (Exim 3.31-VA-mm2 #1 (Debian)) id 18gpjT-0005jb-00 for ; Thu, 06 Feb 2003 09:22:39 -0800 Original-Received: from miles by fencepost.gnu.org with local (Exim 4.10) id 18gpjL-0000Dx-00; Thu, 06 Feb 2003 12:22:31 -0500 Original-To: bug-cc-mode@gnu.org Content-Disposition: inline In-Reply-To: <5bk7gd74hw.fsf@lister.roxen.com> User-Agent: Mutt/1.3.28i Blat: Foop Errors-To: cc-mode-help-admin@lists.sourceforge.net X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports, feature requests, and general talk about CC Mode. List-Unsubscribe: , List-Archive: X-Original-Date: Thu, 6 Feb 2003 12:22:31 -0500 Xref: main.gmane.org gmane.emacs.cc-mode.general:382 gmane.emacs.devel:11422 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11422 On Thu, Feb 06, 2003 at 05:34:03PM +0100, Martin Stjernholm wrote: > > Me too, but I'm a bit fearful of how it's implemented -- is it > > yet-another-entry in post-command-hook, or is it more clever? > > It uses after-change-functions, post-command-hook, first-change-hook > and write-contents-hooks. What's the problem with that? It slows down editing. post-command-hook is especially bad because it happens after _every_ command, even all those little cursor-movement commands that people expect to be _fast_. While this is acceptable for localized and special uses, I think it's good to avoid global (or widespread) use of these hooks unless it's absolutely possible to do otherwise. Remember, other packages could be using them too, and the time adds up! > Is there a more "clever" way? I don't know, I haven't really thought about it. Here's an off-the-top-of-my-head idea though: Suppose some hook wrapped all the text in a visited file with an appropriate `modification-hooks' property, which would simply remove itself from any lines that were modified. Then the file-write-time hook could scan through and only remove line-ending whitespace from lines that aren't wrapped by that property. This method has the advantage that it only affects text modification, not cursor movement etc., and it only causes slowdown the first time a particular piece of text is modified; since most editing is localized, this means it probably wouldn't have much speed impact at all. Of course it probably has disadvantages too, but they don't come to mind... :-) -Miles -- Quidquid latine dictum sit, altum viditur. ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com