Function: hui-select-preprocessor-def

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

Signature

(hui-select-preprocessor-def POS)

Documentation

Return (start . end) of a preprocessor #definition starting at POS, if any.

The major mode for each language that uses # preprocessor notation must be included in the list, hui-select-brace-modes.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-select.el
(defun hui-select-preprocessor-def (pos)
  "Return (start . end) of a preprocessor #definition starting at POS, if any.
The major mode for each language that uses # preprocessor notation must be
included in the list, hui-select-brace-modes."
  ;; Only applies in brace modes (strictly, this should apply in a subset
  ;; of brace modes, but doing it this way permits for configurability.  In
  ;; other modes, one doesn't have to use the function on a # symbol.
  (when (memq major-mode hui-select-brace-modes)
    (setq hui-select-previous 'preprocessor-def)
    (save-excursion
      (goto-char pos)
      (when (and (= (following-char) ?#)
		 ;; Must be at the first non-whitespace character in the line.
		 (= (point) (save-excursion (hui-select-back-to-indentation))))
	;; Skip past continuation lines that end with a backslash.
	(while (and (looking-at ".*\\\\\\s-*$")
		    (zerop (forward-line 1))))
	(forward-line 1)
	;; Include one trailing blank line, if any.
	(if (looking-at "^[ \t\n\r]*$") (forward-line 1))
	(hui-select-set-region pos (point))))))