Re: window-matcher avoid . nil



Christopher Roy Bratusek <zanghar freenet de> writes:

> Good catch. Another thing I've found: SawfishConfig does not write
> (avoid . nil) ,or whatever, it writes (avoid . #f) to .sawfish/custom,
> so I guess that's why it can't be set from the UI. #f in
> scheme-boolean.jl seems fine, it just needs to be "translated" before
> writing, just as #t is.

Ah, so the problem is when the matcher is set via SawfishConfig?  I
don't have time now, but I may have a chance later today to take a
look.
 
>> This was a bit of a surprise.  I'm not a lisp expert by any means, but
>> in the only other lisp variant I'm much familiar with (emacs lisp) this
>> evaluates to true:
>> 
>> (eq nil 'nil)
>> 
>> But in rep it's false. 
>
> I expect it to be false, nil is boolean false, and 'nil is the symbol nil.

Well, this comes out true in rep:

(eq t 't)

In rep nil isn't (only) boolean false, it's the empty list.  So this is
also true:

(eq '() nil)

>> I was wondering if I was going crazy tracing
>> through the window-avoided-p definition until I realized that sometimes
>> (window-get w 'avoid) returned "nil" and sometimes "()".
>
> So… with a timer, nil is just fine. rep is sometimes a bit strange. ;)

>From what I can tell the version with a timer turned the avoid matcher
into a toggle.  There's no else clause to a when:

(define-match-window-setter 'avoid
  (lambda (w prop value)
    (declare (unused prop))
    (when value
      (make-timer (lambda () (window-put w 'avoid t)) 1)
      (when (window-get w 'avoid)
        (make-timer (lambda () (window-remprop w 'avoid)) 1)))))

So the remprop timer would be set whenever the window has the avoid
property when the matcher is run and value is non-nil (including when
it's 'nil).

-- 
Jeremy Hankins <nowan nowan org>


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