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

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

Re: Emacs scale generator?


From: Dan Espen
Subject: Re: Emacs scale generator?
Date: Thu, 12 Mar 2015 22:16:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Emanuel Berg <address@hidden> writes:

> Dan Espen <address@hidden> writes:
>
>> Wow, never saw that before.
>>
>> Nope, I'm actually looking for something that puts
>> the text in the buffer.
>
> Try this:
>
>     (defun scale (end step &optional current)
>       (unless current (setq current 0))
>       (if (<= current end)
>           (progn
>             (if (= (% current step) 0)
>                 (progn
>                   (let*((digit-str      (format "%s" current))
>                         (digit-str-len  (length digit-str)) )
>                     (insert digit-str)
>                     (setq current (+ digit-str-len current))))
>               (progn
>                 (insert ".")
>                 (setq current (1+ current)) ))
>             (scale end step current) )))
>
>     (scale 100 10)


(scale 80 5 1)

....5....10...15...20...25...30...35...40...45...50...55...60...65...70...75...80

Just about perfect.

Thanks.

Nice code too.  I'm not much of a lisper but that looks good to me.

This should be great, no more typos in my scales making me wonder why
things don't line up.


-- 
Dan Espen


reply via email to

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