all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* uniq
@ 2010-12-04  2:41 Tak Ota
  2010-12-04 12:08 ` uniq Stephen Berman
  0 siblings, 1 reply; 5+ messages in thread
From: Tak Ota @ 2010-12-04  2:41 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-05 19:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-04  2:41 uniq Tak Ota
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

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.