Function: eca-completion--fontify-as-mode

eca-completion--fontify-as-mode is a natively compiled function defined in eca-completion.el.

Signature

(eca-completion--fontify-as-mode TEXT MODE)

Documentation

Return a fresh copy of TEXT fontified in a temp buffer using MODE.

MODE is a major-mode symbol. Returns a copy of TEXT unmodified when MODE is nil, unbound, or signals an error during activation or fontification.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-completion.el
(defun eca-completion--fontify-as-mode (text mode)
  "Return a fresh copy of TEXT fontified in a temp buffer using MODE.
MODE is a major-mode symbol.  Returns a copy of TEXT unmodified
when MODE is nil, unbound, or signals an error during activation
or fontification."
  (if (and mode (fboundp mode))
      (condition-case nil
          (with-temp-buffer
            (let ((inhibit-modification-hooks t))
              (insert text)
              (delay-mode-hooks (funcall mode))
              (font-lock-ensure))
            (buffer-substring (point-min) (point-max)))
        (error (copy-sequence text)))
    (copy-sequence text)))