Function: hbdata:to-hbdata-buffer

hbdata:to-hbdata-buffer is a byte-compiled function defined in hbdata.el.

Signature

(hbdata:to-hbdata-buffer DIR &optional CREATE)

Documentation

Read in the file containing DIR's button data, if any, and return buffer.

If it does not exist and optional CREATE is non-nil, create a new one and return buffer, otherwise return nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbdata.el
(defun hbdata:to-hbdata-buffer (dir &optional create)
  "Read in the file containing DIR's button data, if any, and return buffer.
If it does not exist and optional CREATE is non-nil, create a new
one and return buffer, otherwise return nil."
  (let* ((file (expand-file-name hattr:filename (or dir default-directory)))
	 (existing-file (or (file-exists-p file) (get-file-buffer file)))
	 (buf (or (get-file-buffer file)
		  (and (or create existing-file)
		       (find-file-noselect file)))))
    (when buf
      (set-buffer buf)
      (unless (verify-visited-file-modtime (get-file-buffer file))
	(cond ((yes-or-no-p
		"Hyperbole button data file has changed, read new contents? ")
	       (revert-buffer t t))))
      (or (= (point-max) 1) (eq (char-after 1) ?\^L)
	  (error "File %s is not a valid Hyperbole button data table" file))
      (unless (equal (buffer-name) file)
	(rename-buffer file))
      (setq buffer-read-only nil)
      (unless existing-file
	(hbmap:dir-add (file-name-directory file)))
      buf)))