stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] Alt-Tab


From: Ruthard Baudach
Subject: Re: [STUMP] Alt-Tab
Date: Thu, 25 Oct 2012 22:19:36 +0200
User-agent: Sup/0.12.1

>== Auszüge aus der Nachricht von  diogofsr vom 2012-10-25 17:52:
> Ruthard Baudach <address@hidden> writes:
> 
> > Attached is my first attempt on lisp programming, just put
> > (load "/path/to/alt-tab.lisp") in stumpwmrc, and try it.
> 
> Nice work.
Thank you

> I didn't try it, but as this is your first time writing Lisp, you might
> want to make these changes:
> 
> --- /tmp/alt-tab.lisp    2012-10-25 13:37:35.591757537 -0200
> +++ /tmp/new.lisp    2012-10-25 13:43:51.118854966 -0200
> @@ -37,14 +37,14 @@
>          (setf *alt-tab-index* (mod (1+ *alt-tab-index*) (list-length 
> *alt-tab-cycle*)))
>          (select-window-by-number (nth *alt-tab-index* *alt-tab-cycle*)))
>        ;; else start anew
> -      (
> +      (t
>          (setf *alt-tab-index* 1)
>          (setf *alt-tab-cycle* (copy-list *alt-tab-list*))
>      ; if we've fokussed a frame without window, current-window will return 
> nil => select last used
>      (cond 
>        ((not (current-window))
>         (select-window-by-number (first *alt-tab-cycle*)))
> -      (
> +      (t
>         (push (window-number (current-window)) *alt-tab-cycle*)
>             (select-window-by-number (second *alt-tab-cycle*))))))
> 
> The first form in a `cond' is evaluated and if it evaluates to a
> generalized true, it runs the body.
> 
> So:
> 
> (defvar *foo*)
> 
> (cond ((setf *foo* nil) 4)
>       (t 2))
> ; => 2
> 
> (cond ((setf *foo* 42) 4)
>       (t 2))
> ; => 4

As far as I understood it, cond is the most general if - elsif - else
construct lisp knows, thus

(defvar *foo*)

(cond ((setf *foo* nil) 4)
      ( 2 ))
=> 2

At least this works for me using archlinux and the clisp of this
distribution. But adding the `T' in the last cond - clause might be more
portable?

Regards,

Ruthard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]