all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Removing duplicated lines
Date: Thu, 29 Nov 2012 17:42:25 +0530	[thread overview]
Message-ID: <87vcco38wm.fsf@gmail.com> (raw)
In-Reply-To: <CAH8Pv0gOscwiZWnPgkbX0gs76FegPzXRn0E47vN=+uTyyapibA@mail.gmail.com> (Dani Moncayo's message of "Thu, 29 Nov 2012 11:50:57 +0100")

Dani Moncayo <dmoncayo@gmail.com> 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.

-- 



  reply	other threads:[~2012-11-29 12:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 10:50 Removing duplicated lines Dani Moncayo
2012-11-29 12:12 ` Jambunathan K [this message]
2012-11-29 12:18   ` Dani Moncayo
     [not found] <mailman.14043.1354186273.855.help-gnu-emacs@gnu.org>
2012-11-29 11:06 ` Sebastien Vauban
2012-11-29 11:25   ` Dani Moncayo
2012-11-29 11:57     ` Yuri Khan
2012-11-29 12:07       ` Dani Moncayo
     [not found]     ` <mailman.14047.1354190273.855.help-gnu-emacs@gnu.org>
2013-07-03 12:13       ` naisanza
2012-11-29 11:31   ` Yuri Khan
2013-07-03 12:14   ` naisanza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vcco38wm.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=dmoncayo@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.