From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: Emacs scale generator? Date: Thu, 12 Mar 2015 22:30:39 -0400 Organization: A noiseless patient Spider Message-ID: References: <87wq2lsoob.fsf@debian.uxu> <87pp8dslvp.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426214123 25042 80.91.229.3 (13 Mar 2015 02:35:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2015 02:35:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 13 03:35:23 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YWFRa-0004nx-Sp for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 03:35:23 +0100 Original-Received: from localhost ([::1]:34849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWFRa-0008Ee-2P for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Mar 2015 22:35:22 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Injection-Info: mx02.eternal-september.org; posting-host="ad871ce417d1fb2ea3c87e49e48c0ae1"; logging-data="17670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jwA+pnPKnvU1esvTEds733YlysgC+G8k=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:/VMDbzj4M7INqXhRuT6UFbPI3lY= Original-Xref: usenet.stanford.edu gnu.emacs.help:210854 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103133 Archived-At: Emanuel Berg writes: > Emanuel Berg writes: > >> Dan Espen 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