Function: hui:selectable-thing-and-bounds

hui:selectable-thing-and-bounds is a byte-compiled function defined in hui.el.

Signature

(hui:selectable-thing-and-bounds)

Documentation

Return a list of any selectable thing at point.

The list returned is (<thing-type> <thing-string> <thing-start> <thing-end>) or nil if none or if hui:selectable-thing-priority-list is nil. Start and end may be nil if the thing was generated rather than extracted from a region.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:selectable-thing-and-bounds ()
  "Return a list of any selectable thing at point.
The list returned is (<thing-type> <thing-string> <thing-start> <thing-end>)
or nil if none or if `hui:selectable-thing-priority-list' is nil.
Start and end may be nil if the thing was generated rather than
extracted from a region."
  (let* (thing-and-bounds type thing start end)
    (when (setq thing-and-bounds
		(or (hui:delimited-selectable-thing-and-bounds)
		    (hui:non-delimited-selectable-thing-and-bounds)))
      (setq type (nth 0 thing-and-bounds)
	    thing (nth 1 thing-and-bounds)
	    start (nth 2 thing-and-bounds)
	    end (nth 3 thing-and-bounds))
      (unless
	  ;; Already enclosed in delimiters
	  (or (and (= (char-syntax (char-after start)) ?\()
		   (= (char-syntax (char-before end)) ?\)))
	      (and (= (char-syntax (char-after start)) ?\")
		   (= (char-syntax (char-before end)) ?\")))
	    ;; Surrounded by delimiters to add to the thing
	(when (or (and (= (if (char-before start) (char-syntax (char-before start)) 0) ?\()
		       (= (if (char-after end) (char-syntax (char-after end)) 0) ?\)))
		  (and (= (if (char-before start) (char-syntax (char-before start)) 0) ?\")
		       (= (if (char-after end) (char-syntax (char-after end)) 0) ?\")))
	  ;; Include delimiters in return value
	  (setq start (1- start)
		end (1+ end)
		thing (buffer-substring-no-properties start end)))))
	(when thing (list type thing start end))))