From: Randy Yates
Subject: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <fzekpnto.fsf@ieee.org>
Hello,
Yes, I'm begging for help. Feel free to ignore, but help is
much welcome.
I am using XEmacs 21.4.13 (native win32). I want to write a function
that returns a buffer (not an XEmacs buffer, but just a few lines
of text) of text by doing the following:
1. Get a directory listing of files in a specified directory into a list
in which each element is a file name.
2. Index into this list randomly and choose one of the filenames.
3. Open the file into a buffer. Note that each file will have N
lines, N a constant.
4. Append a static amount of text consisting also of N lines to the
buffer, in the same way as "yank-rectangle"
I've got the very rudiments of lisp down, but constructing this level of
a function has got me stumped. For example, what command will get the
directory files into a list?
Again, any help is appreciated.
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <·····@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr
From: rydis (Martin Rydstr|m) @CD.Chalmers.SE
Subject: Re: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <w4c7jzw7csb.fsf@basil.cd.chalmers.se>
Randy Yates <·····@ieee.org> writes:
> Hello,
>
> Yes, I'm begging for help. Feel free to ignore, but help is
> much welcome.
>
> I am using XEmacs 21.4.13 (native win32). I want to write a function
> that returns a buffer (not an XEmacs buffer, but just a few lines
> of text) of text by doing the following:
This really would be more on-topic in comp.emacs.
> 1. Get a directory listing of files in a specified directory into a list
> in which each element is a file name.
directory-files
> 2. Index into this list randomly and choose one of the filenames.
nth
> 3. Open the file into a buffer. Note that each file will have N
> lines, N a constant.
find-file(-noselect)
> 4. Append a static amount of text consisting also of N lines to the
> buffer, in the same way as "yank-rectangle"
insert
Regards,
'mr
--
[Emacs] is written in Lisp, which is the only computer language that is
beautiful. -- Neal Stephenson, _In the Beginning was the Command Line_
From: Randy Yates
Subject: Re: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <3cajw6qh.fsf@ieee.org>
rydis (Martin Rydstr|m) @CD.Chalmers.SE writes:
> [...]
Beautiful! Thanks much, Martin!!
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <·····@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr
From: Randy Yates
Subject: Re: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <zncrmc8l.fsf@ieee.org>
rydis (Martin Rydstr|m) @CD.Chalmers.SE writes:
Thanks Martin - that's just what I needed.
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <·····@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr
From: Randy Yates
Subject: Re: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <wu7vmbyn.fsf@ieee.org>
rydis (Martin Rydstr|m) @CD.Chalmers.SE writes:
Thanks Martin - that's just what I needed.
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <·····@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr
From: Randy Yates
Subject: Re: Lisp Beginner: Please Give Me Some Hints
Date:
Message-ID: <7jzvrx5p.fsf@ieee.org>
rydis (Martin Rydstr|m) @CD.Chalmers.SE writes:
Thanks Martin - that was just what I needed!
--Randy
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <·····@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr