From: Tak Ota <Takaaki.Ota@am.sony.com>
To: <emacs-devel@gnu.org>
Subject: uniq
Date: Fri, 3 Dec 2010 18:41:12 -0800 [thread overview]
Message-ID: <20101203.184112.37434497.Takaaki.Ota@am.sony.com> (raw)
Do we have something equivalent to the next command? I know the name
is bad as it is not same as UNIQ(1). It works better because sorting
is not required.
-Tak
;;
;; uniq
;;
(defun uniq ()
"Omit duplicated lines."
(interactive)
(save-excursion
(goto-char (point-min))
(while (not (= (point) (point-max)))
(let* ((start (point))
(str (format "^%s"
(regexp-quote
(buffer-substring start
(progn (forward-line 1) (point)))))))
(save-excursion
(while (re-search-forward str nil t)
(delete-region (match-beginning 0) (match-end 0))))))))
next reply other threads:[~2010-12-04 2:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-04 2:41 Tak Ota [this message]
2010-12-04 12:08 ` uniq Stephen Berman
2010-12-04 14:09 ` uniq Stefan Monnier
2010-12-05 18:54 ` uniq René Kyllingstad
2010-12-05 19:15 ` uniq Lennart Borgman
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=20101203.184112.37434497.Takaaki.Ota@am.sony.com \
--to=takaaki.ota@am.sony.com \
--cc=emacs-devel@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.