Function: hui:ebut-search

hui:ebut-search is an interactive and byte-compiled function defined in hui.el.

Signature

(hui:ebut-search STRING &optional MATCH-PART)

Documentation

Show lines of files/buffers containing an explicit but match for STRING.

Return number of buttons matched and displayed. By default, find only matches for whole button labels; optional MATCH-PART enables partial matches. Show matched lines in a buffer which serves as a menu to find any of the occurrences.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:ebut-search (string &optional match-part)
  "Show lines of files/buffers containing an explicit but match for STRING.
Return number of buttons matched and displayed.
By default, find only matches for whole button labels; optional MATCH-PART
enables partial matches.  Show matched lines in a buffer which serves as
a menu to find any of the occurrences."
  (interactive (list (read-string "Search for button string: ")
		     (y-or-n-p "Enable partial matches? ")))
  (if (not (stringp string))
      (hypb:error "(ebut-search): String to search for is required"))
  (let*  ((prefix (if (> (length string) 14)
		      (substring string 0 13) string))
	  (out-buf (get-buffer-create (concat "*" prefix " Hypb Search*")))
	  (total (ebut:search string out-buf match-part)))
    (if (> total 0)
	(progn
	  (set-buffer out-buf)
	  (moccur-mode)
	  (and (progn (goto-char 1)
		      (search-forward "\C-m" nil t))
	       (outline-minor-mode 1))
	  (when (fboundp 'hproperty:but-create)
	    (hproperty:but-create (regexp-quote
				   (if match-part
				       string
				     (concat ebut:label-start string ebut:label-end)))))
	  (goto-char (point-min))
	  (pop-to-buffer out-buf)
	  (if (called-interactively-p 'interactive)
	      (message "%d match%s." total (if (> total 1) "es" ""))
	    total))
      (if (called-interactively-p 'interactive)
	  (message "No matches.")
	total))))