Function: lisp--el-funcall-position-p
lisp--el-funcall-position-p is a byte-compiled function defined in
lisp-mode.el.gz.
Signature
(lisp--el-funcall-position-p POS)
Documentation
Heuristically determine whether POS is an evaluated position.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp-mode.el.gz
(defun lisp--el-funcall-position-p (pos)
"Heuristically determine whether POS is an evaluated position."
(save-match-data
(save-excursion
(ignore-errors
(goto-char pos)
;; '(lambda ..) is not a funcall position, but #'(lambda ...) is.
(if (eql (char-before) ?\')
(eql (char-before (1- (point))) ?#)
(let* ((ppss (syntax-ppss))
(paren-posns (nth 9 ppss))
(parent
(when paren-posns
(goto-char (car (last paren-posns))) ;(up-list -1)
(cond
((ignore-errors
(and (eql (char-after) ?\()
(when (cdr paren-posns)
(goto-char (car (last paren-posns 2)))
(looking-at "(\\_<let\\*?\\_>"))))
(goto-char (match-end 0))
'let)
((looking-at
(rx "("
(group-n 1 (+ (or (syntax w) (syntax _))))
symbol-end))
(prog1 (intern-soft (match-string-no-properties 1))
(goto-char (match-end 1))))))))
(pcase parent
('declare nil)
('let
(forward-sexp 1)
(>= pos (point)))
((or 'defun 'defmacro 'cl-defmethod 'cl-defun)
(forward-sexp 2)
(>= pos (point)))
('condition-case
;; If (cdr paren-posns), then we're in the BODY
;; of HANDLERS.
(or (cdr paren-posns)
(progn
(forward-sexp 1)
;; If we're in the second form, then we're in
;; a funcall position.
(< (point) pos (progn (forward-sexp 1)
(point))))))
(_ t))))))))