;; cutup.el - traditional cutups in Emacs ;; regions - fill to 160 (defconst cutup-line-length 160) (defconst frames 4) (defun cutup-fill () (interactive) (set-fill-column cutup-line-length) (fill-region (point-min) (point-max))) ;; regions into kill ring and randomly place these back in position in alt buffer (defun cutup (&optional frames) (interactive) (setq bfw (buffer-name)) (setq frames 4) (setq cutup-line-length 160) (setq page-size (* cutup-line-length cutup-line-length)) (cutup-fill) (goto-char (point-min)) ;; deal with each 160*160 region (let ((x 0) (ppp 0) (page-inc 0) (counter (* frames frames)) (frmes (- frames 1)) (divisor (/ cutup-line-length frames))) (while (> (point-max) page-inc) (while (< x counter) (setq ppp (+ page-inc (+ (* divisor (random frmes)) (* (random frmes) (* divisor cutup-line-length))))) (kill-rectangle ppp (+ ppp (+ divisor (* divisor cutup-line-length)))) (setq x (+ x 1)) ;; open alt buffer ;; (switch-to-buffer "*cut*") ;; yank-rectangle ;; Command: Yank the last killed rectangle with upper left corner at point. ;; (setq point (+ page-inc (+ (* divisor (random frmes)) (* (random frmes) (* divisor cutup-line-length))))) ;; x and y? (setq oldpt (point)) (goto-char (* divisor (random frmes))) (next-line (+ (/ page-inc cutup-line-length) (* divisor (random frmes)))) (yank-rectangle) (goto-char oldpt) ;; back to buffer ;; (switch-to-buffer bfw)) (setq x 0) (setq frames (random 12)) (setq page-inc (+ page-size page-inc))))) (cutup-fill))