Re: lisp newbie help (semi long)
- From: John Harper <jsh unfactored org>
- To: Bret Hughes <bhughes elevating com>
- Cc: sawfish-list <sawfish-list gnome org>
- Subject: Re: lisp newbie help (semi long)
- Date: Fri, 10 Oct 2003 11:00:26 -0700
On Oct 9, 2003, at 1:37 PM, Bret Hughes wrote:
What I want to do first is find a window that has a certain string in
the title, and do something, say print its name.
(get-window-by-name "NAME")
will find the first window called NAME. If you want to do substring
searching you need to use get-window-by-name-re, which searches using a
regular expression rather than just a string
what I can't do is figure out the sytnax to iterate through the list
and
print the names (something that seemed a reasonable starting point.)
there are a number of ways to iterate over a list in rep, mapc/mapcar,
while, let, do
(mapc (lambda (x) (do-something-with x)) my-list)
(let ((x my-list))
(while x
(do-something-with (car x))
(setq x (cdr x)))
(let loop ((rest my-list))
(when rest
(do-something-with (car rest))
(loop (cdr rest)))
(do ((rest my-list (cdr rest))
((null rest))
(do-something-with (car rest)))
stylistically the first is probably the cleanest when there are no side
effects, but they all have their uses..
for printing strings in sawfish you can use the display-message
function, it creates a small window and puts some text in it, e.g.
(display-message "hello, world")
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]