From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: Removing duplicated lines Date: Thu, 29 Nov 2012 17:42:25 +0530 Message-ID: <87vcco38wm.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354191010 30089 80.91.229.3 (29 Nov 2012 12:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2012 12:10:10 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Dani Moncayo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 29 13:10:22 2012 Return-path: Envelope-to: geh-help-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 1Te2wf-0000L9-UF for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Nov 2012 13:10:22 +0100 Original-Received: from localhost ([::1]:47561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te2wU-0001Es-5p for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Nov 2012 07:10:10 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te2wK-0001BH-2d for help-gnu-emacs@gnu.org; Thu, 29 Nov 2012 07:10:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Te2wE-00028x-Ab for help-gnu-emacs@gnu.org; Thu, 29 Nov 2012 07:10:00 -0500 Original-Received: from mail-pa0-f41.google.com ([209.85.220.41]:65350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Te2wE-00028m-35 for help-gnu-emacs@gnu.org; Thu, 29 Nov 2012 07:09:54 -0500 Original-Received: by mail-pa0-f41.google.com with SMTP id bj3so6547298pad.0 for ; Thu, 29 Nov 2012 04:09:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=UaV7ex79aKy5UNOH061B3zCq5Ij/XAtml9vl0dX+lHE=; b=wb7ED505PGzxOE4SXfqlBem/OCfJkotnNkzzRi5qbyZNfZdyk/W5K5kDLo9h/06TTA LE2J1eYFXJ4S/HKQXIohD1PEed93AUjVkocm5f0SqabF39jZUirVo4+qulNtHz61DQm1 VFZIA5AKPBdIDwD3IEWT0C/FnbiEGqXhs1pzCCxe4p5ZCkIvyNbvdMBGscejKnD9hun8 3/ut4Z87v4Uc1cqkDiXhLsvVg3dzEdIIgw4JcCRlYynVFL9QBrnddzHeNJi8iDlf7tVr Idtd3BqWcNFT3eCX5AL3PGhK7UtVPt/xCX1GyKtgzzejhf3dKApCbB1HG7bvBJuLGDN6 6DWQ== Original-Received: by 10.68.203.198 with SMTP id ks6mr67369065pbc.35.1354190993306; Thu, 29 Nov 2012 04:09:53 -0800 (PST) Original-Received: from debian-6.05 ([101.62.49.251]) by mx.google.com with ESMTPS id tm5sm1151888pbc.64.2012.11.29.04.09.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Nov 2012 04:09:51 -0800 (PST) In-Reply-To: (Dani Moncayo's message of "Thu, 29 Nov 2012 11:50:57 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87936 Archived-At: Dani Moncayo writes: > Hi, > > Does (vanilla) Emacs have some command for removing duplicated lines > in a given region? > > This is a command I'm missing for some time. > > I've done a quick search, but didn't found anything. > > If there isn't such command, I think I'd file a feature request. Something like this ... (defun delete-duplicate-lines (beg end) (interactive "r") (let ((lines (split-string (buffer-substring beg end) "\n"))) (delete-region beg end) (insert (mapconcat #'identity (delete-dups lines) "\n")))) > TIA. --