From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r117384: Optionally, undo several consequential deletion in one step. Date: Mon, 23 Jun 2014 21:36:01 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1403573793 12461 80.91.229.3 (24 Jun 2014 01:36:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Jun 2014 01:36:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Sam Steingold Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 24 03:36:25 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WzFen-0006PD-H9 for ged-emacs-devel@m.gmane.org; Tue, 24 Jun 2014 03:36:21 +0200 Original-Received: from localhost ([::1]:57002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzFen-0007P0-4X for ged-emacs-devel@m.gmane.org; Mon, 23 Jun 2014 21:36:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzFec-0007N3-2O for emacs-devel@gnu.org; Mon, 23 Jun 2014 21:36:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzFeU-0004jQ-Jn for emacs-devel@gnu.org; Mon, 23 Jun 2014 21:36:10 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:28098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzFeU-0004jM-Gf; Mon, 23 Jun 2014 21:36:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd+D9/2dsb2JhbABZgwaDSsA9gRcXdIImAQEEViMQCw4mEhQYDSSIDNIZF44WZAeEOASpGYFqgXGBWyGBLA X-IPAS-Result: ArUGAIDvNVNLd+D9/2dsb2JhbABZgwaDSsA9gRcXdIImAQEEViMQCw4mEhQYDSSIDNIZF44WZAeEOASpGYFqgXGBWyGBLA X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="69323455" Original-Received: from 75-119-224-253.dsl.teksavvy.com (HELO pastel.home) ([75.119.224.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Jun 2014 21:36:01 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A5037603CD; Mon, 23 Jun 2014 21:36:01 -0400 (EDT) In-Reply-To: (Sam Steingold's message of "Mon, 23 Jun 2014 20:23:36 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:172673 Archived-At: Hi Sam, Thanks for your patch. Some comments below. > + "Whether appending to kill ring also makes \\[undo] restore both pieces of text simultaneously." Please stick to a max of 80 columns, especially for docstrings. > + (when (and kill-append-merge-undo (not buffer-read-only)) > + (let ((prev buffer-undo-list) > + (next (cdr buffer-undo-list))) > + ;; find the next undo boundary Please capitalize and punctuate your comments. > + (while (car next) > + (pop next) > + (pop prev)) > + ;; remove this undo boundary > + (when prev > + (setcdr prev (cdr next))))))) I think this is a bit too aggressive. It should have an upper bound (e.g. 20). It should only remove a boundary that's at the top of buffer-undo-list. And it should make sure it only removes auto-added boundaries. Maybe one way to do that is to refactor the self-insert-command so as to export the "undo-boundary-squasher" part. Stefan