* Emacs scale generator?
@ 2015-03-12 20:23 Dan Espen
2015-03-12 20:33 ` J. David Boyd
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Dan Espen @ 2015-03-12 20:23 UTC (permalink / raw)
To: help-gnu-emacs
Okay, I've needed this more than a few times and Google isn't helping.
I write and design a lot of fixed format data and I need
layout scales like this:
1...5...10...15...20...
Anyone out there ever write anything like this?
Ideally I'd like to be able to do something like:
Esc 80 M-x scale
and get an 80 character long scale.
Up into the 100s for extra points:
95..100..105
--
Dan Espen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
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>
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: J. David Boyd @ 2015-03-12 20:33 UTC (permalink / raw)
To: help-gnu-emacs
Dan Espen <despen@verizon.net> writes:
> Okay, I've needed this more than a few times and Google isn't helping.
> I write and design a lot of fixed format data and I need
> layout scales like this:
>
> 1...5...10...15...20...
>
> Anyone out there ever write anything like this?
> Ideally I'd like to be able to do something like:
>
> Esc 80 M-x scale
>
> and get an 80 character long scale.
> Up into the 100s for extra points:
>
> 95..100..105
Look at http://www.emacswiki.org/emacs/download/popup-ruler.el
Dave
^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <mailman.1916.1426192439.31049.help-gnu-emacs@gnu.org>]
* Re: Emacs scale generator?
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 ` Chris Van Dusen
[not found] ` <mailman.1923.1426205290.31049.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 12+ messages in thread
From: Chris Van Dusen @ 2015-03-13 0:07 UTC (permalink / raw)
To: Dan Espen; +Cc: help-gnu-emacs
On Mar 12, 2015, at 3:23 PM, Dan Espen <despen@verizon.net> wrote:
>
> Okay, I've needed this more than a few times and Google isn't helping.
> I write and design a lot of fixed format data and I need
> layout scales like this:
>
> 1...5...10...15...20...
>
> Anyone out there ever write anything like this?
> Ideally I'd like to be able to do something like:
>
> Esc 80 M-x scale
>
> and get an 80 character long scale.
> Up into the 100s for extra points:
>
> 95..100..105
>
> --
> Dan Espen
Does M-x ruler-mode not do what you need?
Chris.
^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <mailman.1923.1426205290.31049.help-gnu-emacs@gnu.org>]
* Re: Emacs scale generator?
[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
0 siblings, 2 replies; 12+ messages in thread
From: Dan Espen @ 2015-03-13 0:17 UTC (permalink / raw)
To: help-gnu-emacs
Chris Van Dusen <cavandusen@gmail.com> writes:
> On Mar 12, 2015, at 3:23 PM, Dan Espen <despen@verizon.net> wrote:
>
>>
>> Okay, I've needed this more than a few times and Google isn't helping.
>> I write and design a lot of fixed format data and I need
>> layout scales like this:
>>
>> 1...5...10...15...20...
>>
>> Anyone out there ever write anything like this?
>> Ideally I'd like to be able to do something like:
>>
>> Esc 80 M-x scale
>>
>> and get an 80 character long scale.
>> Up into the 100s for extra points:
>>
>> 95..100..105
>
> Does M-x ruler-mode not do what you need?
Wow, never saw that before.
Nope, I'm actually looking for something that puts the text in the
buffer.
--
Dan Espen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
2015-03-13 0:17 ` Dan Espen
@ 2015-03-13 0:38 ` Joost Kremers
2015-03-13 0:53 ` Emanuel Berg
1 sibling, 0 replies; 12+ messages in thread
From: Joost Kremers @ 2015-03-13 0:38 UTC (permalink / raw)
To: help-gnu-emacs
Dan Espen wrote:
>>> Okay, I've needed this more than a few times and Google isn't helping.
>>> I write and design a lot of fixed format data and I need
>>> layout scales like this:
>>>
>>> 1...5...10...15...20...
>>>
> [...] I'm actually looking for something that puts the text in the
> buffer.
Perhaps keyboard macro counters are what you're looking for?
(info "(emacs) Keyboard Macro Counter")
I've never actually used them, but they seem like they could be useful.
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
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:16 ` Dan Espen
1 sibling, 2 replies; 12+ messages in thread
From: Emanuel Berg @ 2015-03-13 0:53 UTC (permalink / raw)
To: help-gnu-emacs
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)
--
underground experts united
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
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:16 ` Dan Espen
1 sibling, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2015-03-13 1:54 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
2015-03-13 1:54 ` Emanuel Berg
@ 2015-03-13 2:30 ` Dan Espen
2015-03-13 2:39 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Dan Espen @ 2015-03-13 2:30 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
2015-03-13 2:30 ` Dan Espen
@ 2015-03-13 2:39 ` Emanuel Berg
2015-03-13 2:48 ` Dan Espen
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2015-03-13 2:39 UTC (permalink / raw)
To: help-gnu-emacs
Dan Espen <despen@verizon.net> writes:
> 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!
No problem :)
Yes, of course change it in any way you like.
--
underground experts united
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
2015-03-13 2:39 ` Emanuel Berg
@ 2015-03-13 2:48 ` Dan Espen
0 siblings, 0 replies; 12+ messages in thread
From: Dan Espen @ 2015-03-13 2:48 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
> Dan Espen <despen@verizon.net> writes:
>
>> 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!
>
> No problem :)
>
> Yes, of course change it in any way you like.
You're multi-talented, MainFramer and a lisper.
I'll leave your name in it.
--
Dan Espen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Emacs scale generator?
2015-03-13 0:53 ` Emanuel Berg
2015-03-13 1:54 ` Emanuel Berg
@ 2015-03-13 2:16 ` Dan Espen
1 sibling, 0 replies; 12+ messages in thread
From: Dan Espen @ 2015-03-13 2:16 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-03-13 2:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).