[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] Alt-Tab
From: |
Dirk Sondermann |
Subject: |
Re: [STUMP] Alt-Tab |
Date: |
Fri, 26 Oct 2012 07:29:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:10.0.7) Gecko/20120922 Thunderbird/10.0.7 |
On 10/25/12 22:19, Ruthard Baudach wrote:
>> == Auszüge aus der Nachricht von diogofsr vom 2012-10-25 17:52:
>> Ruthard Baudach <address@hidden> writes:
...
>> 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?
Omitting T as the test in the last clause works and is portable,
but, as CLTL expresses it, "is in questionable taste":
http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node84.html
--
Dirk