Function: hui-select-punctuation

hui-select-punctuation is a byte-compiled function defined in hui-select.el.

Signature

(hui-select-punctuation POS)

Documentation

Return (start . end) region when at a punctuation character.

The region includes sexpressions before and after POS

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-select.el
;; Allow punctuation marks not followed by white-space to include
;; the previous and subsequent sexpression.  Useful in contexts such as
;; 'foo.bar'.
(defun hui-select-punctuation (pos)
  "Return (start . end) region when at a punctuation character.
The region includes sexpressions before and after POS"
  (or (hui-select-markup-pair pos)
      (hui-select-delimited-thing-call #'hui-select-thing)
      (and (or (and (= (or (char-after) 0) ?\") (/= (or (char-before) 0) ?\\))
	       (and (= (or (char-before) 0) ?\") (/= (or (char-before (1- (point))) 0) ?\\)))
	   (hui-select-string pos))
      (hui-select-comment pos)
      (hui-select-preprocessor-def pos)
      (hui-select-brace-def-or-declaration pos) ;; Might be on a C++ destructor ~.
      (save-excursion
	(setq hui-select-previous 'punctuation)
	(goto-char (min (1+ pos) (point-max)))
	(cond ((and (char-after pos) (= ?\  (if (char-after pos) (char-syntax (char-after pos)) 0)))
	       (hui-select-set-region pos (1+ pos)))
	      ((and (char-before pos) (= ?\  (if (char-before pos) (char-syntax (char-before pos)) 0)))
	       (hui-select-set-region (1- pos) pos))
	      (t (goto-char pos)
		 (ignore-errors (hui-select-set-region
				 (save-excursion (backward-sexp) (point))
				 (progn (forward-sexp) (point)))))))))