Function: hyrolo-find-file

hyrolo-find-file is an autoloaded, interactive and byte-compiled function defined in hyrolo.el.

Signature

(hyrolo-find-file &optional FILE FIND-FUNCTION &rest ARGS)

Documentation

Find an optional FILE with FIND-FUNCTION and rest of ARGS.

When called interactively, select from the list of files referenced by hyrolo-file-list unless given a prefix argument, in which case use the first file generated by the list.

FIND-FUNCTION must return the buffer of the file found but need not select it.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
;;;###autoload
(defun hyrolo-find-file (&optional file find-function &rest args)
  "Find an optional FILE with FIND-FUNCTION and rest of ARGS.
When called interactively, select from the list of files referenced
by `hyrolo-file-list' unless given a prefix argument, in which case
use the first file generated by the list.

FIND-FUNCTION must return the buffer of the file found but need not
select it."
  (interactive "P")
  (let ((all-files (hyrolo-get-file-list)))
    (when (or (called-interactively-p 'interactive)
	      (null file))
      (if (or (not (cadr all-files)) ;; length <= 1
	      current-prefix-arg)
	  (setq file (car all-files))
	(setq file (completing-read "Edit HyRolo file: "
				    (mapcar #'list all-files)))))
    (when (stringp file)
      (let (buf)
	(condition-case-unless-debug err
	    (prog1 (setq buf (apply (or find-function hyrolo-find-file-function) file args))
	      (when buf
		(with-current-buffer buf
		  (when (equal outline-regexp (default-value 'outline-regexp))
		    ;; Prevent matching to *word* at the beginning of
		    ;; lines and hanging hyrolo search functions.  Note this
		    ;; change adds one to the default `outline-level' function,
		    ;; so `hyrolo-outline-level' overrides that as well
		    ;; to get the correct calculation.  -- rsw, 2023-11-17
		    (setq-local outline-regexp "\\([*\^L]+\\)\\([ \t\n\r]\\)"
				outline-level #'hyrolo-outline-level))
		  (setq buffer-read-only nil))))
	  (error (progn (message "(hyrolo-find-file): Error reading \"%s\": %s" file err)
			nil)))))))