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, also annotate the symbol with cursor-sensor-functions.

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, also annotate the symbol with `cursor-sensor-functions'."
  (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 (1+ end) 'cursor-sensor-functions
                           ;; Get a fresh list with SYM hardcoded,
                           ;; so that the value is distinguishable
                           ;; from the value in adjacent regions.
                           (elisp-cursor-sensor beg))))))