Function: hargs:sexpression-p
hargs:sexpression-p is a byte-compiled function defined in hargs.el.
Signature
(hargs:sexpression-p &optional NO-RECURSE)
Documentation
Return an sexpression at point as a string.
If point follows an sexpression end character, the preceding sexpression is returned. If point precedes an sexpression start character, the following sexpression is returned. Otherwise, the innermost sexpression that point is within is returned or nil if none.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hargs.el
(defun hargs:sexpression-p (&optional no-recurse)
"Return an sexpression at point as a string.
If point follows an sexpression end character, the preceding sexpression
is returned. If point precedes an sexpression start character, the
following sexpression is returned. Otherwise, the innermost sexpression
that point is within is returned or nil if none."
(let ((not-quoted
'(condition-case ()
(not (and (= (if (char-after (- (point) 2))
(char-syntax (char-after (- (point) 2)))
0)
?\\)
(not (= (if (char-after (- (point) 3))
(char-syntax (char-after (- (point) 3)))
0)
?\\))))
(error t))))
(save-excursion
(ignore-errors
(cond ((and (eq (char-syntax (preceding-char)) ?\))
;; Ignore quoted end chars.
(eval not-quoted))
(buffer-substring (point)
(progn (forward-sexp -1) (point))))
((and (eq (char-syntax (following-char)) ?\()
;; Ignore quoted begin chars.
(eval not-quoted))
(buffer-substring (point)
(progn (forward-sexp) (point))))
(no-recurse nil)
(t (save-excursion (up-list 1) (hargs:sexpression-p t))))))))