From e5b8c84602c6cc1df87ff8e0abf9516335ad2e25 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 7 Apr 2018 14:36:29 -0700 Subject: drop randomize-region.el --- .emacs.d/site-lisp/randomize-region.el | 73 ---------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 .emacs.d/site-lisp/randomize-region.el (limited to '.emacs.d/site-lisp') diff --git a/.emacs.d/site-lisp/randomize-region.el b/.emacs.d/site-lisp/randomize-region.el deleted file mode 100644 index d5f50e81..00000000 --- a/.emacs.d/site-lisp/randomize-region.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; randomize-region.el --- randomize line order in a region - -;; Copyright (C) 2005 Joe Corneli <[EMAIL PROTECTED]> -;; Copyright (C) 1986, 1987, 1993, 1994, 1995, 2003 Free Software Foundation, Inc. - -;; Time-stamp: - -;; This file is not part of GNU Emacs, but it is distributed under -;; the same terms as GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 2, or (at your -;; option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Uses copied & modified versions of `shuffle-vector' -;; from cookie1.el and `reverse-region' from sort.el - -;;; Code: - -(defun randomize-region (beg end) - (interactive "r") - (if (> beg end) - (let (mid) (setq mid end end beg beg mid))) - (save-excursion - ;; put beg at the start of a line and end and the end of one -- - ;; the largest possible region which fits this criteria - (goto-char beg) - (or (bolp) (forward-line 1)) - (setq beg (point)) - (goto-char end) - ;; the test for bolp is for those times when end is on an empty - ;; line; it is probably not the case that the line should be - ;; included in the reversal; it isn't difficult to add it - ;; afterward. - (or (and (eolp) (not (bolp))) - (progn (forward-line -1) (end-of-line))) - (setq end (point-marker)) - (let ((strs (shuffle-list - (split-string (buffer-substring-no-properties beg end) - "\n")))) - (delete-region beg end) - (dolist (str strs) - (insert (concat str "\n")))))) - -(defun shuffle-list (list) - "Randomly permute the elements of LIST. -All permutations equally likely." - (let ((i 0) - j - temp - (len (length list))) - (while (< i len) - (setq j (+ i (random (- len i)))) - (setq temp (nth i list)) - (setcar (nthcdr i list) (nth j list)) - (setcar (nthcdr j list) temp) - (setq i (1+ i)))) - list) - -;;; randomize-region.el -- cgit v1.2.3