Function: hyrolo-funcall-match

hyrolo-funcall-match is a byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-funcall-match FUNC &optional NARROW-FLAG BACKWARD-FLAG)

Documentation

Apply FUNC with no arguments to the entry at point.

If on a display match entry or file header, set the appropriate major mode based on its source location prior to applying FUNC.

With point in the HyRolo display matches buffer and optional NARROW-FLAG non-nil, narrow to the current file of matches prior to applying FUNC.

With optional BACKWARD-FLAG, FUNC is moving point backwards; when on a file boundary, move point back a character to select the proper major mode.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo-funcall-match (func &optional narrow-flag backward-flag)
  "Apply FUNC with no arguments to the entry at point.
If on a display match entry or file header, set the appropriate
major mode based on its source location prior to applying FUNC.

With point in the HyRolo display matches buffer and optional
NARROW-FLAG non-nil, narrow to the current file of matches
prior to applying FUNC.

With optional BACKWARD-FLAG, FUNC is moving point backwards; when
on a file boundary, move point back a character to select the
proper major mode."
  (let ((display-buf (get-buffer hyrolo-display-buffer)))
    (if (eq (current-buffer) display-buf)
	(progn
	  (when (< (length hyrolo--cache-loc-match-bounds) 1)
	    (error "(hryolo-funcall-match): No HyRolo matches in display buffer"))
	  (let ((ofont-lock font-lock-mode)
		(omode major-mode)
		(ostart (point-min))
		(oend (point-max)))
	    (unwind-protect
		(cl-destructuring-bind (start end)
		    (hyrolo-cache-location-start-and-end)
		  (setq end (1- (or end (point-max))))
		  (when narrow-flag
		    (narrow-to-region start end))
		  ;; (message "%s" (hyrolo-cache-get-major-mode-from-pos
		  ;;	              (funcall (if backward-flag '1- '1+) start)))
		  (let ((font-lock-mode)
                        (pos (if (and backward-flag (looking-at hyrolo-hdr-regexp))
                                  (max (1- start) 1)
                                (min (1+ start) (point-max)))))
                    (save-excursion
                      (goto-char pos)
		      (hyrolo--pre-display-buffer))

		    ;; Prevent Org and Outline minor modes from font-locking
		    (setq font-lock-mode nil)
		    (hyrolo--funcall-with-outline-regexp func)))
	      (with-current-buffer display-buf
		;; func may have changed the current buffer
		(when narrow-flag
		  ;; Restore original restriction
		  (narrow-to-region ostart oend))
		;; Restore original mode and font-locking
                (delay-mode-hooks
		  (funcall omode))
		(font-lock-mode (if ofont-lock 1 0))
		(when (and (fboundp 'orgtbl-mode) orgtbl-mode)
		  ;; Disable as overrides single letter keys
		  (orgtbl-mode 0))
		;; !! TODO: Need to leave point on a visible character or
		;; since hyrolo uses reveal-mode, redisplay will re-expand
		;; hidden entries to make point visible.
		;; (hyrolo-back-to-visible-point) This pause forces a window
		;; redisplay that maximizes the entries displayed for any
		;; final location of point.  Comment it out for now and see
		;; how well movement cmds work.  (sit-for 0.0001)
		))))
      (hyrolo--funcall-with-outline-regexp func))))