Re: Some stuff to discuss about



Timo Korvola <Timo Korvola iki fi> writes:

> On Monday 21 September 2009 05:21:48 Matthew Love wrote:
>>     (rplacd (assoc 'foreground (assoc 'title override-frame-part-
> classes) nil))
>>      (rplaca (assoc 'foreground (assoc 'title override-frame-part-
> classes) nil))))
>
> It is true that removing stuff from alists is kind of tricky, but the 
> above is just awful.  We should probably have better library routines 
> for alists.

Yes, this is true, the main problem I see with the above is that it will
leave behind a bunch of (())'s all over 'override-frame-part-classes, 
which is not good.

Perhaps adding a new function in frames.jl similar to
'set-frame-part-value that would remove a frame-part key would 
be a nice route.  Something like the following should work:

  (define (remove-frame-part-key class key #!optional override)
    (let* ((var (if override 'override-frame-part-classes 'frame-part-classes))
	   (item (assq class (symbol-value var)))
	   tem)
      (if item
	  (if (setq tem (assq key (cdr item)))
	      (delete tem item)))))

Then the above code could be reduced to something like:

  (define (update-frame-font-color)
    (if use-custom-font-color
	(mapc (lambda (fc)
		(set-frame-part-value fc 'foreground (list frame-font-inactive-color frame-font-active-color) 't)) (list 'title 'tab))
      (mapc (lambda (fc)
	      (remove-frame-part-key fc 'foreground 't)) (list 'title 'tab)))
    (mapc (lambda (x) (rebuild-frame x)) (managed-windows)))

What do you think?

-- 
Matthew Love



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