From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs 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 Message-ID: References: Reply-To: Stefan Monnier , 4587@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1254407356 12316 80.91.229.12 (1 Oct 2009 14:29:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Oct 2009 14:29:16 +0000 (UTC) Cc: 4587@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org To: Kevin Rodgers Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 01 16:29:09 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MtMeW-0004PU-IL for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2009 16:29:04 +0200 Original-Received: from localhost ([127.0.0.1]:45521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtMeV-0005H4-Pe for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2009 10:29:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtMcm-00036t-O7 for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:27:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtMch-0002zl-Jb for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:27:16 -0400 Original-Received: from [199.232.76.173] (port=41568 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtMcg-0002z7-Sh for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:27:10 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:55484) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MtMcg-0003I7-7J for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:27:10 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n91ER7wt008131; Thu, 1 Oct 2009 07:27:08 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n91EP6Kk007639; Thu, 1 Oct 2009 07:25:06 -0700 Resent-Date: Thu, 1 Oct 2009 07:25:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 01 Oct 2009 14:25:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4587 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12544067816841 (code B ref -1); Thu, 01 Oct 2009 14:25:06 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 1 Oct 2009 14:19:41 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n91EJdu8006832 for ; Thu, 1 Oct 2009 07:19:41 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtMVO-0002LP-NQ for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:19:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtMVK-0002JX-QZ for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:19:38 -0400 Original-Received: from [199.232.76.173] (port=39918 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtMVK-0002JP-Ix for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:19:34 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:9995 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtMVK-0001xt-2o for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2009 10:19:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAHlXxEpMCrXH/2dsb2JhbACBUdVLhCkEhxo X-IronPort-AV: E=Sophos;i="4.44,487,1249272000"; d="scan'208";a="46900671" Original-Received: from 76-10-181-199.dsl.teksavvy.com (HELO ceviche.home) ([76.10.181.199]) by ironport2-out.pppoe.ca with ESMTP; 01 Oct 2009 10:19:33 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 2535CB4265; Thu, 1 Oct 2009 10:19:32 -0400 (EDT) In-Reply-To: (Kevin Rodgers's message of "Thu, 01 Oct 2009 06:25:59 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-CrossAssassin-Score: 2 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Thu, 01 Oct 2009 10:27:16 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31616 Archived-At: >> 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