Re: lisp newbie help (semi long)



Bret Hughes <bhughes elevating com> writes:

> I have googled, till my eyes are googly.  I am experimenting with
> sawfish-client and am hoping to write some code to manage some windows
> on a computer with no key board or mouse.
>
>
> I have some stuff in bash using a cludge of xwininfo -tree -root and awk
> but I would like to extend the functionality of my program and would
> like to get a grip on lisp and sawfish interaction.
>
> I have learned quite a bit over the last day or so but still can't get
> the simplest thing to loop.  I think the main thing is I simply can't
> seem to get my head around the looping mechanism syntax in lisp.
>
> 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.
>
> I have been trying combinations of invoking sawfish-client - and adding
> a testlisp.jl to ~/.sawfish/lisp and adding a (require testlisp.jl) to
> my .sawfishrc.
>
> Once added to testlisp.jl i can execute a function from sawfish-client 
>
>>From sawfish-client -  I have been typing or cutting and pasting from vi
> the whole form I am trying to evaluate because it seems quicker thatn
> restarting sawfish all the time to reread testlisp.jl.
>
> Anyway this is where I am.
>
> I can get a list of window ids:
>
>  [bhughes bretsony bin]$ sawfish-client -
> sawfish 1.0.1, Copyright (C) 1999-2000 John Harper
> sawfish comes with ABSOLUTELY NO WARRANTY; for details see the file
> COPYING
>
> Enter `,help' to list commands.
> user> (setq winlist (managed-windows))
> (#<window 1200023> #<window 1200047> #<window 120005a> #<window 120006d>
> #<window 1200080> #<window 12001fe> #<window 1000043> #<window 1800559>
> #<window 2400070> #<window 2a05fa1> #<window 14002d5>)
> user> winlist
> (#<window 1200023> #<window 1200047> #<window 120005a> #<window 120006d>
> #<window 1200080> #<window 12001fe> #<window 1000043> #<window 1800559>
> #<window 2400070> #<window 2a05fa1> #<window 14002d5>)
> user> 
>
> 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.)

i have no read librep library but  for exemple if you want to get name
of each window you can user mapcar function :

user> (mapcar #'window-name winlist)
("pager" "~" "wmcpu" "wmnet" "wmfsm" "~" "GNU Emacs" "Mozilla Firebird")

> I keep locking up the entire ui on my laptop and having to hard restart
> the damn thing so I though I would send this plea for help and see if I
> can get past this.
>
> I am not wanting someone to write this but rather help me understand the
> syntax so I can get past this and continue learning.
>
>
> So far the best lisp tutorial I have found is written for emacs:
>
> http://www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_toc.html#SEC_Contents
>
> I currently have parenthesis paralysis Please help.
>
> Bret
>

-- 
(concatenate 'string "lam" (reverse "gro.ylimafxut@"))

Il y a deux produits majeurs qui sont sortis de Berkeley: Le LSD et BSD.
Nous ne pensons pas que ce soit un co´ncidence




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]