[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C equivalent for: (face-attribute 'region :background (selected-fram
Keith David Bershatsky
Re: C equivalent for: (face-attribute 'region :background (selected-frame) 'default)
Tue, 26 Sep 2017 11:38:03 -0700
I have begun porting the two relevant Lisp functions to C and will submit them
(when finished) in conjunction with the next draft of implementing my feature
requests for crosshairs (#17684) and multiple fake cursors (#22873). I may end
up needing some help with some portions of the conversion, but it does not look
as difficult as I had initially thought.
DEFUN ("mc-face-attribute", Fmc_face_attribute, Smc_face_attribute, 2, 4, 0,
doc: /* Return the value of FACE's ATTRIBUTE on FRAME.
If the optional argument FRAME is given, report on face FACE in that frame.
If FRAME is t, report on the defaults for face FACE (for new frames).
If FRAME is omitted or nil, use the selected frame.
If INHERIT is nil, only attributes directly defined by FACE are considered,
so the return value may be `unspecified', or a relative value.
If INHERIT is non-nil, FACE's definition of ATTRIBUTE is merged with the
faces specified by its `:inherit' attribute; however the return value
may still be `unspecified' or relative.
If INHERIT is a face or a list of faces, then the result is further merged
with that face (or faces), until it becomes specified and absolute.
To ensure that the return value is always specified and absolute, use a
value of `default' for INHERIT; this will resolve any unspecified or
relative values by merging with the `default' face (which is always
completely specified). */)
(Lisp_Object face, Lisp_Object attribute, Lisp_Object frame, Lisp_Object
(let ((value (internal-get-lisp-face-attribute face attribute frame)))
(when (and inherit (face-attribute-relative-p attribute value))
(let ((inh-from (mc-face-attribute face :inherit frame)))
(unless (or (null inh-from) (eq inh-from 'unspecified))
(mc-face-attribute-merged-with attribute value inh-from
(when (and inherit
(not (eq inherit t))
(face-attribute-relative-p attribute value))
(setq value (mc-face-attribute-merged-with attribute value inherit
DEFUN ("mc-face-attribute-merged-with", Fmc_face_attribute_merged_with,
Smc_face_attribute_merged_with, 3, 4, 0,
doc: /* Merges ATTRIBUTE, initially VALUE, with faces from FACES until
FACES may be either a single face or a list of faces.
[This is an internal function.] */)
(Lisp_Object attribute, Lisp_Object value, Lisp_Object faces, Lisp_Object
((not (face-attribute-relative-p attribute value))
(mc-face-attribute-merged-with attribute value (car faces) frame)
(merge-face-attribute attribute value (mc-face-attribute faces attribute