From: Dan Espen <despen@verizon.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs scale generator?
Date: Thu, 12 Mar 2015 22:16:52 -0400 [thread overview]
Message-ID: <mdth9a$p1m$1@dont-email.me> (raw)
In-Reply-To: 87wq2lsoob.fsf@debian.uxu
Emanuel Berg <embe8573@student.uu.se> writes:
> Dan Espen <despen@verizon.net> 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
prev parent reply other threads:[~2015-03-13 2:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 20:23 Emacs scale generator? Dan Espen
2015-03-12 20:33 ` J. David Boyd
[not found] ` <mailman.1916.1426192439.31049.help-gnu-emacs@gnu.org>
2015-03-13 0:07 ` Dan Espen
2015-03-13 0:07 ` Chris Van Dusen
[not found] ` <mailman.1923.1426205290.31049.help-gnu-emacs@gnu.org>
2015-03-13 0:17 ` Dan Espen
2015-03-13 0:38 ` Joost Kremers
2015-03-13 0:53 ` Emanuel Berg
2015-03-13 1:54 ` Emanuel Berg
2015-03-13 2:30 ` Dan Espen
2015-03-13 2:39 ` Emanuel Berg
2015-03-13 2:48 ` Dan Espen
2015-03-13 2:16 ` Dan Espen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='mdth9a$p1m$1@dont-email.me' \
--to=despen@verizon.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).