Function: elisp-fontify-symbol
elisp-fontify-symbol is a byte-compiled function defined in
elisp-mode.el.gz.
Signature
(elisp-fontify-symbol ROLE BEG SYM ID &optional DEF)
Documentation
Fontify symbol SYM starting at position BEG according to its ROLE.
If elisp-add-help-echo is non-nil, also annotate the symbol with the
help-echo text property. If cursor-sensor-mode(var)/cursor-sensor-mode(fun) is enabled and ID is
non-nil (i.e. SYM is local variable), also annotate the symbol with
cursor-sensor-functions that highlight all occurrences of SYM with the
same ID whenever point is on this SYM.
For the precise meaning of the arguments of this function, see the
docstring of elisp-scope-analyze-form. This function is intended for
use with elisp-scope-analyze-form as its CALLBACK argument.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp-fontify-symbol (role beg sym id &optional _def)
"Fontify symbol SYM starting at position BEG according to its ROLE.
If `elisp-add-help-echo' is non-nil, also annotate the symbol with the
`help-echo' text property. If `cursor-sensor-mode' is enabled and ID is
non-nil (i.e. SYM is local variable), also annotate the symbol with
`cursor-sensor-functions' that highlight all occurrences of SYM with the
same ID whenever point is on this SYM.
For the precise meaning of the arguments of this function, see the
docstring of `elisp-scope-analyze-form'. This function is intended for
use with `elisp-scope-analyze-form' as its CALLBACK argument."
(let ((end (progn (goto-char beg) (read (current-buffer)) (point))))
(let ((face (elisp-scope-get-symbol-role-property role :face)))
(add-face-text-property
beg end face
(cl-case elisp-fontify-symbol-precedence-function
(ignore nil)
(always t)
(otherwise (funcall elisp-fontify-symbol-precedence-function beg end))))
(when elisp-add-help-echo
(elisp--annotate-symbol-with-help-echo role beg end sym)
(put-text-property beg end 'mouse-face `(,face elisp-symbol-at-mouse)))
(when (and id (bound-and-true-p cursor-sensor-mode))
(put-text-property
beg end 'cursor-sensor-functions (elisp-cursor-sensor beg))))))