From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Case Newsgroups: gmane.emacs.help Subject: Re: newbie elisp help ?? Date: Wed, 15 Aug 2007 14:16:56 -0400 Message-ID: <1187201816.2712.177.camel@CASE> References: <1187198873.2712.158.camel@CASE> <46C33C86.7010104@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1187201832 24811 80.91.229.12 (15 Aug 2007 18:17:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Aug 2007 18:17:12 +0000 (UTC) Cc: EMACS List To: "Lennart Borgman (gmail)" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 15 20:17:08 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILNQY-0004ox-Ue for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Aug 2007 20:17:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILNQY-0001m8-BT for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Aug 2007 14:17:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ILNQJ-0001kJ-LP for help-gnu-emacs@gnu.org; Wed, 15 Aug 2007 14:16:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ILNQG-0001dx-6K for help-gnu-emacs@gnu.org; Wed, 15 Aug 2007 14:16:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILNQF-0001dn-VK for help-gnu-emacs@gnu.org; Wed, 15 Aug 2007 14:16:47 -0400 Original-Received: from smtp102.rog.mail.re2.yahoo.com ([206.190.36.80]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1ILNQF-0003gv-NS for help-gnu-emacs@gnu.org; Wed, 15 Aug 2007 14:16:47 -0400 Original-Received: (qmail 4352 invoked from network); 15 Aug 2007 18:16:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; h=Received:X-YMail-OSG:Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:Message-Id:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=QIUM46b3Z6SCen5cOnEQ30d6w1TTeYM9dez3QR91ss+JZjxBSyaJ3cJPEFU+j6Ma1SOZz13KlZeC0quGP5vVXtg24ZCon7+qIKnRC98bTUQ3MuFHR79o+2YmbkdzapK5pd7MB1M1dO5id0Qf3hupFCmLPljr6eQLliULjKj2eO8= ; Original-Received: from unknown (HELO ?192.168.1.5?) (billlinux@rogers.com@74.104.51.86 with plain) by smtp102.rog.mail.re2.yahoo.com with SMTP; 15 Aug 2007 18:16:47 -0000 X-YMail-OSG: wBZP968VM1mZ_BJETw4lFfQXEq7GYIS6vA5ZFUYR2CCh0hz9Mdqd0rPwNgB1s1ACDQ-- In-Reply-To: <46C33C86.7010104@gmail.com> X-Mailer: Evolution 2.10.3 (2.10.3-2.fc7) X-Detected-Kernel: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46576 Archived-At: Hi Lennart; Thanks for the speedy reply. On Wed, 2007-08-15 at 19:48 +0200, Lennart Borgman (gmail) wrote: > William Case wrote: > > Hi; > > > > I am trying to write a function that will insert a line of asterisks+ > > spaces across a buffer (as a section divider). It was started as an > > exercise and has become an exercise in futility. > > > > I am working in the scratch pad using C-j to test the function as it is > > being built. I have: (insert "* "). It returns "* nil". Obviously I > > don't want the "nil" to appear. How do I get rid of it? > > > > More importantly to me, how do I get the (insert "* ") command to repeat > > 27 times to give me 54 characters across the buffer? I know how to make > > a recursive loop, but it seems to me this is a fairly common challenge > > and there is a probably a function for repetition that I can't find. > > > > I suppose I am asking for the programming equivalent of 'C-u n'. > > > > 'insert-char' allows for repeating but only one character at a time, not > > two. > > > > Any guidance would be appreciated. > > Try this: > > M-: (insert (make-string 50 ?*)) Unfortunately, (make-string 50 ?*) is the single character '*', I was shooting for something that was a repetition of two characters (*SPC) so that my section divider looked like: /* * * * * * * * * * * * * * * * * * * * */ I would begin and end the function with (insert 47). I tried (insert (make-string 5 "* ")) and variations thereof, i.e. with and without quotes and ASCII numbers. -- Regards Bill