|
From: | Emanuel Berg |
Subject: | Re: Emacs scale generator? |
Date: | Fri, 13 Mar 2015 02:54:02 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Emanuel Berg <embe8573@student.uu.se> writes: > Dan Espen <despen@verizon.net> writes: > >> ... I'm actually looking for something that puts >> the text in the buffer. > > Try this ... I made a better version and an interactive interface. This was interesting. Especially the '(16) or `C-u C-u' case below (!). (defun scale (end step &optional current) (unless current (setq current 0)) (if (<= current end) (let*((digit-str (if (= (% current step) 0) (format "%s" current) ".")) (digit-str-len (length digit-str)) ) (insert digit-str) (scale end step (+ digit-str-len current)) ))) (defun scale-simple (&optional end) (interactive "p") (let*((the-end (if (= end 1) 30 end)) (the-step (max 1 (/ the-end 10))) ) (scale the-end the-step) )) ;; C-u M-x scale-simple RET 01234 ;; C-u C-u M-x scale-simple RET 012345678910121416 ;; M-x scale-simple RET 0..3..6..9..12.15.18.21.24.27.30 ;; C-u 1 0 0 M-x scale-simple RET 0.........10........20........30 ... -- underground experts united
[Prev in Thread] | Current Thread | [Next in Thread] |