Function: moccur-noselect

moccur-noselect is a byte-compiled function defined in hmoccur.el.

Signature

(moccur-noselect)

Documentation

Return match data for the current moccur buffer line.

Match data is returned as a list (destination-buffer line-number occur-match-text). Signal an error if not on a valid occurrence line.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmoccur.el
(defun moccur-noselect ()
  "Return match data for the current moccur buffer line.
Match data is returned as a list (destination-buffer line-number
occur-match-text).  Signal an error if not on a valid occurrence
line."
  (if (not (eq major-mode 'moccur-mode))
      (error "'moccur-to' must be called within a moccur buffer")
    (let (beg file-path lineno dstbuf occur-match)
      (save-excursion
	(beginning-of-line)
	(setq beg (point))
	(end-of-line)
	(setq occur-match (buffer-substring beg (point)))
	(if (string-match "^[ ]*[0-9]+:" occur-match)
	    (progn
	      (setq lineno (string-to-number (substring
					      occur-match 0 (match-end 0))))
	      (if (re-search-backward
		   (concat "^" moccur-source-prefix
			   "\"?\\([^\" \n\r]+\\)\"?") nil t)
		  (progn
		    (setq file-path (buffer-substring
				     (match-beginning 1) (match-end 1))
			  dstbuf (find-file-noselect file-path))
		    (if (not dstbuf)
			(message
			 "moccur-to: file '%s' is not readable" file-path)))
		(error "No moccur header line for file")))
	  (error "Not an moccur occurrence line")))
      (if (and dstbuf lineno)
	  (list dstbuf lineno occur-match)))))