help-gnu-emacs
[Top][All Lists]
Advanced

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

Colorize objects by method dispatch type


From: Michael Heerdegen
Subject: Colorize objects by method dispatch type
Date: Wed, 01 Apr 2020 22:25:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi,

Question first: For `cl-defmethod's, is there a way to get a method
dispatch for a given generic name and a set of parameters, e.g. a
reference to the dispatched method?

The background:

On my phone, every contact automatically gets assigned a color.  It's
random but stays always the same for a contact, and in the long run, I
get used to the assigned colors and this is very helpful.

I now want to teach Emacs to automatically colorize objects presented in
some buffer by types in a similar way.  For example, I want to colorize
registers in the register preview by the type of their contents so that
registers containing stuff of the same type all get the same color.  I
don't want to define the colors myself, at least not always.

What I currently do, and this already works very nicely, is to use the
result of `type-of' called on the registers, hash it with `secure-hash'
and use a part of the hash, which is hex code, as color definition.

But in the case of registers, the already existing method
implementations defined by the developers for the different types of
registers provide a better source for an equality relation on registers
than `type-of.'  That's why I would rather use references to the
appropriate method implementations for hashing.


Thanks,

Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]