all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Cc: Eli Zaretskii <eliz@is.elta.co.il>,
	mast@lysator.liu.se, emacs-devel@gnu.org, rms@gnu.org
Subject: Re: gratuitous changes
Date: Thu, 6 Feb 2003 12:22:31 -0500	[thread overview]
Message-ID: <20030206172231.GA32231@gnu.org> (raw)
In-Reply-To: <5bk7gd74hw.fsf@lister.roxen.com>

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


  reply	other threads:[~2003-02-06 17:22 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-31 21:48 gratuitous changes Stefan Monnier
2003-01-31 22:16 ` Andreas Schwab
2003-01-31 22:51   ` John Wiegley
2003-01-31 23:01 ` Juanma Barranquero
2003-02-01  0:00   ` Stefan Monnier
2003-02-01  6:51     ` Robert Anderson
2003-02-03 15:09       ` Stefan Monnier
2003-02-03 16:20         ` Robert Anderson
2003-02-01  9:54     ` Juanma Barranquero
2003-02-01  2:11 ` Miles Bader
2003-02-01 18:44   ` Bill Wohler
2003-02-01 22:11 ` Richard Stallman
2003-02-01 23:28   ` Martin Stjernholm
2003-02-02  5:52     ` Eli Zaretskii
2003-02-02  6:14       ` Miles Bader
2003-02-06 16:34         ` Martin Stjernholm
2003-02-06 17:22           ` Miles Bader [this message]
2003-02-10  0:29             ` Martin Stjernholm
2003-02-03 14:57     ` Stefan Monnier
2003-02-02  5:56 ` Eli Zaretskii
2003-02-02 12:56   ` Juanma Barranquero
2003-02-02 13:59   ` Kim F. Storm
2003-02-03 13:01     ` Richard Stallman
2003-02-03 14:11       ` Juanma Barranquero
2003-02-03 14:54         ` Stefan Monnier
2003-02-03 15:01           ` Juanma Barranquero
2003-02-04 14:59       ` Juanma Barranquero
2003-02-04 16:09         ` Robert Anderson
2003-02-04 16:44           ` Juanma Barranquero
2003-02-04 17:14             ` Robert Anderson
2003-02-04 17:22               ` Juanma Barranquero
2003-02-04 19:46         ` Eli Zaretskii
2003-02-04 20:16           ` Juanma Barranquero
2003-02-04 20:22             ` Stefan Monnier
2003-02-04 20:44               ` Nick Roberts
2003-02-04 22:59                 ` Edward O'Connor
2003-02-04 23:19                   ` Juanma Barranquero
2003-02-05  0:32                   ` Kim F. Storm
2003-02-05  0:39                     ` Kim F. Storm
2003-02-05  0:49                       ` Kenichi Handa
2003-02-05  4:24                     ` Luc Teirlinck
2003-02-05  4:51                       ` Miles Bader
2003-02-06  2:42                   ` Richard Stallman
2003-02-06  4:09                     ` Luc Teirlinck
2003-02-07  9:18                       ` Richard Stallman
2003-02-04 23:18                 ` Juanma Barranquero
2003-02-05  0:42                   ` Stefan Monnier
2003-02-05  6:03                 ` Eli Zaretskii
2003-02-06  2:42                 ` Richard Stallman
2003-02-06  2:54                   ` Luc Teirlinck
2003-02-04 23:14               ` Juanma Barranquero
2003-02-05  6:01             ` Eli Zaretskii
2003-02-05  8:18               ` Juanma Barranquero
2003-02-05 15:30                 ` Eli Zaretskii
2003-02-14 22:56                   ` Thien-Thi Nguyen
2003-02-05  0:14         ` Richard Stallman
2003-02-07 14:02 ` Francesco Potorti`
2003-02-10  1:47   ` Miles Bader
2003-02-10 10:09     ` Francesco Potorti`

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030206172231.GA32231@gnu.org \
    --to=miles@gnu.org \
    --cc=eliz@is.elta.co.il \
    --cc=emacs-devel@gnu.org \
    --cc=mast@lysator.liu.se \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.