[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: email@example.com
- Subject: with-fore-color problem?
- From: Andrew L. M. Shalit <alms>
- Date: Thu, 1 Nov 90 14:59:41 -0500
- Cc: info-macl, firstname.lastname@example.org
- In-reply-to: David Neves's message of Thu, 1 Nov 90 12:07:32 CST <9011011807.AA10041@aristotle.ils.nwu.edu>
From: email@example.com (David Neves)
I looked at the macro expansion. It doesn't do set-fore-color. Instead
it calls rgb-color. When I replace rgb-color with set-fore-color it
You're right, it calls the rgbforecolor trap directly, instead of
calling the set-fore-color function. This is a very simple
optimization. There's no reason to introduce the overhead of
the object lisp function call when it's no harder to call the trap.
[the set-fore-color obfun just does some bookkeeping and then calls
The bug/misfeature/misdocumentation in with-fore-color is that you
have to surround it with a call to with-port. You have to make sure
the port is set before you call with-fore-color, otherwise the color
won't necessarily be set in the right window.
So, you would say
One could easily argue that with-fore-color should do this
automatically. At the very least, it should documented that it
[example sent by another user]
(defmacro with-fore-color (color &rest form)
(let ((old-color (gensym)))
`(let ((,old-color (get-fore-color)))
This is a version of the with-fore-color that calls the functions
instead of calling the traps directly. I just ran some timings, and
it's just under twice as slow as calling with-port and the built in
version of with-fore-color.