Function: expreg--subword
expreg--subword is a natively compiled function defined in expreg.el.
Signature
(expreg--subword)
Documentation
Return a list of regions of the CamelCase subword at point.
Only return something if ‘subword-mode’ is on, to keep consistency.
Source Code
;; Defined in /nix/store/29cdhkmkqv2bgp3p30khhf35kkbgx1ya-emacs-packages-deps/share/emacs/site-lisp/elpa/expreg-1.4.1/expreg.el
;;; Expansion functions
(defun expreg--subword ()
"Return a list of regions of the CamelCase subword at point.
Only return something if ‘subword-mode’ is on, to keep consistency."
(when subword-mode
(let ((orig (point))
beg end result)
;; Go forward then backward.
(subword-forward)
(setq end (point))
(subword-backward)
(setq beg (point))
(skip-syntax-forward "w")
;; Make sure we stay in the word boundary. Because
;; ‘subword-backward/forward’ could go through parenthesis, etc.
(when (>= (point) end)
(push `(subword--forward . ,(cons beg end)) result))
;; Because ‘subword-backward/forward’ could go through
;; parenthesis, etc, we need to run it in reverse to handle the
;; case where point is at the end of a word.
(goto-char orig)
(subword-backward)
(setq beg (point))
(subword-forward)
(setq end (point))
(skip-syntax-backward "w")
(when (<= (point) beg)
(push `(subword--backward . ,(cons beg end)) result))
result)))