Subject: bug#13032: 24.3.50; Request: Provide a `delete-duplicate-lines' command

From: Dani Moncayo <[email-masked]>
Date: Sat, 1 Dec 2012 10:22:00 +0100

>> (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