Function: blink-matching-open
blink-matching-open is an interactive and byte-compiled function
defined in simple.el.gz.
Signature
(blink-matching-open)
Documentation
Momentarily highlight the beginning of the sexp before point.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun blink-matching-open ()
"Momentarily highlight the beginning of the sexp before point."
(interactive)
(when (and (not (bobp))
blink-matching-paren)
(let* ((oldpos (point))
(message-log-max nil) ; Don't log messages about paren matching.
(blinkpos
(save-excursion
(save-restriction
(syntax-propertize (point))
(if blink-matching-paren-distance
(narrow-to-region
(max (minibuffer-prompt-end) ;(point-min) unless minibuf.
(- (point) blink-matching-paren-distance))
oldpos))
(let ((parse-sexp-ignore-comments
(and parse-sexp-ignore-comments
(not blink-matching-paren-dont-ignore-comments))))
(condition-case ()
(progn
(forward-sexp -1)
;; backward-sexp skips backward over prefix chars,
;; so move back to the matching paren.
(while (and (< (point) (1- oldpos))
(let ((code (syntax-after (point))))
(or (eq (syntax-class code) 6)
(eq (logand 1048576 (car code))
1048576))))
(forward-char 1))
(point))
(error nil))))))
(mismatch (funcall blink-matching-check-function blinkpos oldpos)))
(cond
(mismatch
(if blinkpos
(if (minibufferp)
(minibuffer-message "Mismatched parentheses")
(message "Mismatched parentheses"))
(if (minibufferp)
(minibuffer-message "No matching parenthesis found")
(message "No matching parenthesis found"))))
((not blinkpos) nil)
((or
(eq blink-matching-paren 'jump-offscreen)
(pos-visible-in-window-p blinkpos))
;; Matching open within window, temporarily move to or highlight
;; char after blinkpos but only if `blink-matching-paren-on-screen'
;; is non-nil.
(and blink-matching-paren-on-screen
(not show-paren-mode)
(if (memq blink-matching-paren '(jump jump-offscreen))
(save-excursion
(goto-char blinkpos)
(sit-for blink-matching-delay))
(unwind-protect
(progn
(move-overlay blink-matching--overlay blinkpos (1+ blinkpos)
(current-buffer))
(sit-for blink-matching-delay))
(delete-overlay blink-matching--overlay)))))
((not show-paren-context-when-offscreen)
(minibuffer-message
"%s%s"
(propertize "Matches " 'face 'shadow)
(blink-paren-open-paren-line-string blinkpos)))))))