help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs scale generator?


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 <address@hidden> writes:

> Dan Espen <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]