I recently ran across a bit of shear in the behavior of custom_color versus custom_variable; I realize after reading the slang source that their behavior is completely consistent, but it isn't exactly what I expected. Let me try to explain. I was trying to set a color used by a particular mode (in this case, mailedit_mode) using set_color, the same as I would for the normal set of jed colors; unfortunately, when mailedit_mode was loaded, the custom_color() calls in mailedit.sl were overriding my selections. This appears to be because set_color sets the colors for an existing color, but does not create a nonexistent color (that is, add_color_object()). Therefore, when custom_color goes to check for a color_number(), it fails. This can be solved by setting the color the user wishes to effect in a mode hook (in which case custom_color has already been invoked), or by using custom_color in their .jedrc. However, as this is not how intrinsic jed colors are set, it is a bit confusing. I'm not entirely sure what a good solution to this might be ... as I said, the functions behave consistently to their definition, it was just somewhat surprising to me as a user that the effect of this set_color for a custom_color object did not behave as the intrinsic jed colors would. Ethan -- The laws that forbid the carrying of arms are laws [that have no remedy for evils]. They disarm only those who are neither inclined nor determined to commit crimes. -- Cesare Beccaria, "On Crimes and Punishments", 1764
Attachment:
pgpwJnxw_IoRW.pgp
Description: PGP signature