Function: hui:non-delimited-selectable-thing-and-bounds

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

Signature

(hui:non-delimited-selectable-thing-and-bounds)

Documentation

Return a list of properties for any non-delimited thing at point.

The list returned is (<thing-type> <thing-string> <thing-start> <thing-end>) or nil if none.

The prioritized types of things tested is 'url plus the list of types in hui:selectable-thing-priority-list if that variable is non-nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:non-delimited-selectable-thing-and-bounds ()
  "Return a list of properties for any non-delimited thing at point.
The list returned is (<thing-type> <thing-string> <thing-start> <thing-end>)
or nil if none.

The prioritized types of things tested is \\='url plus the list of types
in `hui:selectable-thing-priority-list' if that variable is non-nil."
  (when hui:selectable-thing-priority-list
    (with-syntax-table
	(if (memq major-mode hui-select-ignore-quoted-sexp-modes)
	    (syntax-table)
	  hui-select-syntax-table)
      (let* ((types hui:selectable-thing-priority-list)
	     thing-and-bounds type thing start-end start end)
	;; Can't use thing-at-point here since it won't recognize URLs
	;; without a protocol prefix, e.g. www.google.com.
	(when types
	  (setq thing-and-bounds (hpath:www-at-p t)))
	(if thing-and-bounds
	    (cons 'url thing-and-bounds)
	  (while (and (not thing) types)
	    (setq type (car types)
		  types (cdr types)
		  thing (thing-at-point type t))
	    (when thing
	      (cond ((eq type 'filename)
		     (unless (file-exists-p thing)
		       (setq thing nil)))
		    ((eq type 'email)
		     (unless (string-match "@.+\\." thing)
		       (setq thing nil)))
		    ((eq type 'whitespace)
		     (if (looking-at "[ \t\n\r\f]")
			 (setq start (point)
			       end (save-excursion (forward-word
						    (prefix-numeric-value
						     current-prefix-arg))
						   (point))
			       thing (buffer-substring start end))
		       (setq thing nil)))))
	    (when thing
	      (setq start-end (or start-end (bounds-of-thing-at-point type))
		    start (or start (car start-end))
		    end   (or end (cdr start-end)))))
	  (when thing (list type thing start end)))))))