From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dani Moncayo Newsgroups: gmane.emacs.bugs Subject: bug#13032: 24.3.50; Request: Provide a `delete-duplicate-lines' command Date: Sat, 1 Dec 2012 10:22:00 +0100 Message-ID: References: <87obig2ap2.fsf@mail.jurta.org> <874nk728ci.fsf@mail.jurta.org> <874nk63aps.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1354353778 21569 80.91.229.3 (1 Dec 2012 09:22:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2012 09:22:58 +0000 (UTC) Cc: Juanma Barranquero , 13032@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 01 10:23:10 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1TejHu-0006xr-Av for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Dec 2012 10:23:06 +0100 Original-Received: from localhost ([::1]:50737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TejHi-0005vo-Q0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Dec 2012 04:22:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TejHg-0005vb-Pb for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2012 04:22:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TejHf-00023J-Q3 for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2012 04:22:52 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TejHf-00023F-Mf for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2012 04:22:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TejJl-0003E8-Lv for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2012 04:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dani Moncayo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2012 09:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13032 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13032-submit@debbugs.gnu.org id=B13032.135435385612346 (code B ref 13032); Sat, 01 Dec 2012 09:25:01 +0000 Original-Received: (at 13032) by debbugs.gnu.org; 1 Dec 2012 09:24:16 +0000 Original-Received: from localhost ([127.0.0.1]:47940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TejJ1-0003D5-VX for submit@debbugs.gnu.org; Sat, 01 Dec 2012 04:24:16 -0500 Original-Received: from mail-oa0-f44.google.com ([209.85.219.44]:57896) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TejIz-0003Cx-3K for 13032@debbugs.gnu.org; Sat, 01 Dec 2012 04:24:14 -0500 Original-Received: by mail-oa0-f44.google.com with SMTP id n5so1236803oag.3 for <13032@debbugs.gnu.org>; Sat, 01 Dec 2012 01:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=V7oUipg333p4C5LjAGMpc43+17epyxsEWl5t7P/WDjQ=; b=CgTm0kVxXW2YNf56P1aTa4yXD3kqeiLEQROeLax6Xg/v5kyOfkmJEdGH9IhDtUvmS7 uyfTsMKenM7VhTdRtzQgEvEGy+VZ0vsq3C1LaEOuv7MTOh7Xa9AHnyFngTMIINnvyEyQ xUmtywCXsEhLEatAHs4/v3DpIW9uA5Kd2O/sBbtYIQYuNLIJWaVufYGoJNa02on7VtMB ccYdMiBaSi+57q20umfW5Z1oemX1F969joI9z3NU+THnozKHeWhGL/dAKg4ZTU+8v8Q6 fjJMoT8AL/+CKpmYKleJXkyQ4SMoRqs72SI4woiilpjQ7m+QwLxpQL/3cdtVpCnmoNEp ft8Q== Original-Received: by 10.60.24.97 with SMTP id t1mr625513oef.6.1354353720433; Sat, 01 Dec 2012 01:22:00 -0800 (PST) Original-Received: by 10.60.64.170 with HTTP; Sat, 1 Dec 2012 01:22:00 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67727 Archived-At: >> (defun delete-duplicate-lines (rstart rend &optional reverse adjacent interactive) >> "Delete duplicate lines in the region between RSTART and REND. >> If REVERSE is nil, search and delete duplicates forward keeping the first >> occurrence of duplicate lines. If REVERSE is non-nil, search and delete >> duplicates backward keeping the last occurrence of duplicate lines. >> If ADJACENT is non-nil, delete repeated lines only if they are adjacent." > > Looks pretty fine to me. Your version is more general and versatile. > > Some comments: > * Why is needed the INTERACTIVE command? I mean, Cannot that info > (whether the function has been called interactively) be retrieved > using some Lips primitive? > * In case the INTERACTIVE command is indeed necessary, it should be > explained in the docstring, no? > * I think that the docstring should explain also the return value > (number of duplicate lines deleted). Sorry, replace "command" by "argument" in the above paragraph. Another comment: * I'm thinking that the ADJACENT argument is kinda unnecessary. I can't think of a use-case where someone wants to remove only the _adjacent_ duplicate lines but not the ones which aren't adjacent. So, I think that both the interface and the implementation could be simplified by removing that argument. -- Dani Moncayo