Function: shorthands-font-lock-shorthands

shorthands-font-lock-shorthands is a byte-compiled function defined in shorthands.el.gz.

Signature

(shorthands-font-lock-shorthands LIMIT)

Documentation

Font lock until LIMIT considering read-symbol-shorthands.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/shorthands.el.gz
(defun shorthands-font-lock-shorthands (limit)
  "Font lock until LIMIT considering `read-symbol-shorthands'."
  (when read-symbol-shorthands
    (while (re-search-forward
            (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>")
            limit t)
      (let* ((existing (get-text-property (match-beginning 1) 'face))
             (print-name (match-string 1))
             (probe (and (not (memq existing '(font-lock-comment-face
                                               font-lock-string-face)))
                         (intern-soft print-name)))
             (symbol-name (and probe (symbol-name probe)))
             (prefix (and symbol-name
                          (not (string-equal print-name symbol-name))
                          (car (assoc print-name
                                      read-symbol-shorthands
                                      #'string-prefix-p)))))
        (when prefix
          (add-face-text-property (match-beginning 1)
                                  (+ (match-beginning 1) (length prefix))
                                  'elisp-shorthand-font-lock-face))))))