Function: smie--matching-block-data
smie--matching-block-data is a byte-compiled function defined in
smie.el.gz.
Signature
(smie--matching-block-data ORIG &rest ARGS)
Documentation
A function suitable for show-paren-data-function (which see).
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie--matching-block-data (orig &rest args)
"A function suitable for `show-paren-data-function' (which see)."
(if (or (null smie-closer-alist)
(equal (cons (point) (buffer-chars-modified-tick))
(car smie--matching-block-data-cache)))
(or (cdr smie--matching-block-data-cache)
(apply orig args))
(setq smie--matching-block-data-cache
(list (cons (point) (buffer-chars-modified-tick))))
(unless (nth 8 (syntax-ppss))
(condition-case nil
(let ((here (smie--opener/closer-at-point)))
(when (and here
(or smie-blink-matching-inners
(not (numberp
(nth (if (nth 0 here) 1 2)
(assoc (nth 1 here) smie-grammar))))))
(let ((there
(cond
((car here) ; Opener.
(let ((data (smie-forward-sexp 'halfsexp))
(tend (point)))
(unless (car data)
(funcall smie-backward-token-function)
(list (member (cons (nth 1 here) (nth 2 data))
smie-closer-alist)
(point) tend))))
(t ;Closer.
(let ((data (smie-backward-sexp 'halfsexp))
(htok (nth 1 here)))
(if (car data)
(let* ((hprec (nth 2 (assoc htok smie-grammar)))
(ttok (nth 2 data))
(tprec (nth 1 (assoc ttok smie-grammar))))
(when (and (numberp hprec) ;Here is an inner.
(eq hprec tprec))
(goto-char (nth 1 data))
(let ((tbeg (point)))
(funcall smie-forward-token-function)
(list t tbeg (point)))))
(let ((tbeg (point)))
(funcall smie-forward-token-function)
(list (member (cons (nth 2 data) htok)
smie-closer-alist)
tbeg (point)))))))))
;; Update the cache.
(setcdr smie--matching-block-data-cache
(list (nth 2 here) (nth 3 here)
(nth 1 there) (nth 2 there)
(not (nth 0 there)))))))
(scan-error nil))
(goto-char (caar smie--matching-block-data-cache)))
(apply #'smie--matching-block-data orig args)))