Function: hbdata:to-entry-in-file

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

Signature

(hbdata:to-entry-in-file KEY-SRC &optional DIRECTORY CREATE)

Documentation

Move point to end of line in but data buffer matching KEY-SRC.

Use hbdata file in KEY-SRC's directory, or optional DIRECTORY or if nil, use default-directory. With optional CREATE, if no such line exists, insert a new file entry at the beginning of the hbdata file (which is created if necessary). Return non-nil if KEY-SRC is found or created, else nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbdata.el
(defun hbdata:to-entry-in-file (key-src &optional directory create)
  "Move point to end of line in but data buffer matching KEY-SRC.
Use hbdata file in KEY-SRC's directory, or optional DIRECTORY or if nil, use
`default-directory'.
With optional CREATE, if no such line exists, insert a new file entry at the
beginning of the hbdata file (which is created if necessary).
Return non-nil if KEY-SRC is found or created, else nil."
  (let (rtn
	ln-dir)
    (setq directory (or (file-name-directory key-src) directory))
    (let ((ln-file) (link-p key-src))
      (while (setq link-p (file-symlink-p link-p))
	(setq ln-file link-p))
      (if ln-file
	  (setq ln-dir (file-name-directory ln-file)
		key-src (file-name-nondirectory ln-file))
	(setq key-src (file-name-nondirectory key-src))))
    (when (or (hbdata:to-hbdata-buffer directory create)
	      (and ln-dir (hbdata:to-hbdata-buffer ln-dir nil)
		   (setq create nil
			 directory ln-dir)))
      (goto-char 1)
      (cond ((search-forward (concat "\^L\n\"" key-src "\"")
			     nil t)
	     (setq rtn t))
	    (create
	     (setq rtn t)
	     (insert "\^L\n\"" key-src "\"\n")
	     (backward-char 1))))
    rtn))