From: Dan Espen <despen@verizon.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs scale generator?
Date: Thu, 12 Mar 2015 22:30:39 -0400 [thread overview]
Message-ID: <mdti33$h86$1@dont-email.me> (raw)
In-Reply-To: 87pp8dslvp.fsf@debian.uxu
Emanuel Berg <embe8573@student.uu.se> writes:
> 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 ...
That's exactly what I was going to do.
(Add the interactive wrapper.)
So, I changed the last line:
(scale the-end 5 1) ))
Then C-u 25 M-x scale-simple gives me:
....5....10...15...20...25
Thanks again!
--
Dan Espen
next prev parent reply other threads:[~2015-03-13 2:30 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 [this message]
2015-03-13 2:39 ` Emanuel Berg
2015-03-13 2:48 ` Dan Espen
2015-03-13 2:16 ` Dan Espen
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='mdti33$h86$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).