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:16:52 -0400 Organization: A noiseless patient Spider Message-ID: References: <87wq2lsoob.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426213220 13194 80.91.229.3 (13 Mar 2015 02:20:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2015 02:20:20 +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:20:19 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 1YWFD1-0006zZ-G3 for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Mar 2015 03:20:19 +0100 Original-Received: from localhost ([::1]:34822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWFD0-0004uN-Nl for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Mar 2015 22:20:18 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Injection-Info: mx02.eternal-september.org; posting-host="ad871ce417d1fb2ea3c87e49e48c0ae1"; logging-data="25654"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+W1+gT4ikvWWIMConq5+5hFKIoAgrFOZo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:MJgPj5Bi0mykTT5y5JKHyYlVQ04= Original-Xref: usenet.stanford.edu gnu.emacs.help:210853 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:103132 Archived-At: Emanuel Berg writes: > Dan Espen 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