GNU bug report logs - #4587
23.1; sort-lines and sort-fields always set buffer modified

Previous Next

Package: emacs;

Reported by: rm369 <at> arcor.de

Date: Tue, 29 Sep 2009 16:50:04 UTC

Severity: minor

Merged with 4597

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 4587 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: bug#4587: Antwort: Re: bug#4587: 23.1; sort-lines and sort-fields always set buffer modified
Date: Thu, 01 Oct 2009 10:19:32 -0400
>> I'd indeed expect that to implement the feature you request, the code
>> would have to do something like that.  Most likely not copying the text
>> itself, but instead storing an md5 or somesuch hash of the text.

> Not suitable for Emacs, but maybe useful for Roland:

> (defadvice sort-lines (around restore-buffer-modified-p activate)
>   (let* ((buffer-was-modified-p (buffer-modified-p))
> 	 (buffer-was-not-modified-md5 (if (not buffer-was-modified-p)
> 					  (md5 (current-buffer)))))
>     ad-do-it
>     (when (and (not buffer-was-modified-p)
> 	       (buffer-modified-p)
> 	       (not (equal buffer-was-not-modified-md5 (md5 (current-buffer)))))
>       (restore-buffer-modified-p buffer-was-modified-p))))

Maybe we could make it suitable, turn it into a macro and use it around
the various candidates.  AFAICT, here are the problems I see with it:
- the call to md5 should use as much as possible the internal encoding.
  I.e. at least pass an `emacs-internal' arg, tho it would be even
  better to let md5 work directly on the internal representation.
- it should only work on the afected region rather than the whole buffer
  (i.e. it needs start..end arguments).
- should it fiddle with the undo list?  or even revert the whole
  "without-effect" set of changes (the changes may result in the same
  final text, but they may very well have moved markers and changed
  text-properties, and it might be desirable to undo those changes, so
  as to better pretend nothing happened).


-- Stefan





This bug report was last modified 3 years and 76 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.