[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: newbie elisp help ??
From: |
Pascal Bourguignon |
Subject: |
Re: newbie elisp help ?? |
Date: |
Wed, 15 Aug 2007 20:02:52 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux) |
William Case <billlinux@rogers.com> writes:
> 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".
Wrong. (insert "* ") returns just nil, whose textual representation
is inserted by the command bound to C-j.
> Obviously I
> don't want the "nil" to appear. How do I get rid of it?
I don't know what command you have bound to C-j. I use C-x C-e and
C-u C-x C-e to execute forms. Without C-u, it doesn't print (insert
the textual representation of) the result of the form.
> More importantly to me, how do I get the (insert "* ") command to repeat
> 27 times to give me 54 characters across the buffer?
Writting a loop!
(require 'cl) C-x C-e
(loop repeat 27 do (insert "* ")) C-x C-e
inserts:
* * * * * * * * * * * * * * * * * * * * * * * * * * *
> 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.
How do I make a static mobile?
How do I make a red blue?
> I suppose I am asking for the programming equivalent of 'C-u n'.
I suppose you could read some programming tutorial. Wouldn't that be a good
idea?
What about googling for: emacs lisp tutorial
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.