Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2011
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.76 KB | None | 0 0
  1. (defun my-column-ruler (width)
  2.   "Display temp ruler at point."
  3.   (interactive `(,(- (+ (window-hscroll)(window-width)) 1)))
  4.   (momentary-string-display
  5.    (if (< width 10)
  6.        "1   5   10\n|...|....|\n"
  7.      (let* ((iterations (/ width 10))
  8.             (short (- width (* 10 iterations)))
  9.             (result1 "|...|....|")
  10.             (result2 "1   5   10")
  11.             (inc1 "....|....|")
  12.             (inc2 "        %d0")
  13.             (i 1))
  14.        (while  (< i iterations)
  15.          (setq i (1+ i))
  16.          (setq result1 (concat result1 inc1))
  17.          (setq result2 (concat result2 (substring (format inc2 i) -10))))
  18.        (concat result2 "\n" result1 (substring inc1 0 short) "\n")))
  19.    (line-beginning-position)
  20.    nil "[space] Clears ruler"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement