Function: hbdata:apply-entry
hbdata:apply-entry is a byte-compiled function defined in hbdata.el.
Signature
(hbdata:apply-entry FUNC LBL-KEY KEY-SRC &optional DIRECTORY CREATE-FLAG INSTANCE-FLAG)
Documentation
Invoke FUNC with point at hbdata entry.
Hbdata is given by LBL-KEY, KEY-SRC and optional DIRECTORY. With optional CREATE-FLAG, if no such line exists, insert a new file entry at the beginning of the hbdata file (which is created if necessary). INSTANCE-FLAG non-nil means search for any button instance matching LBL-KEY and call FUNC with point right after any hbut:instance-sep in match. Return value of evaluation when a matching entry is found or nil.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbdata.el
;;; ************************************************************************
;;; Private functions
;;; ************************************************************************
(defun hbdata:apply-entry (func lbl-key key-src &optional directory
create-flag instance-flag)
"Invoke FUNC with point at hbdata entry.
Hbdata is given by LBL-KEY, KEY-SRC and optional DIRECTORY.
With optional CREATE-FLAG, if no such line exists, insert a new file entry at
the beginning of the hbdata file (which is created if necessary).
INSTANCE-FLAG non-nil means search for any button instance matching LBL-KEY and
call FUNC with point right after any `hbut:instance-sep' in match.
Return value of evaluation when a matching entry is found or nil."
(let (found
rtn
opoint
end-func)
(save-excursion
(save-restriction
(unwind-protect
(progn
(when (get-buffer key-src)
(set-buffer key-src)
(unless (hypb:buffer-file-name)
(cond ((hmail:editor-p)
(setq end-func (lambda ()
(hmail:msg-narrow))))
((and (hmail:lister-p)
(progn (rmail:summ-msg-to) (rmail:to)))
(setq opoint (point)
key-src (current-buffer)
end-func (lambda ()
(hmail:msg-narrow)
(goto-char opoint)
(lmail:to))))
((and (hnews:lister-p)
(progn (rnews:summ-msg-to) (rnews:to)))
(setq opoint (point)
key-src (current-buffer)
end-func (lambda ()
(hmail:msg-narrow)
(goto-char opoint)
(lnews:to))))
;; Any non-file buffer
(t
(setq opoint (point)
key-src (current-buffer)
end-func (lambda ()
(widen)
(goto-char opoint)
(narrow-to-region (point-min)
(hmail:hbdata-start))))))))
(setq found (hbdata:to-entry-buf key-src directory create-flag)))
(when found
(unless (hypb:buffer-file-name)
;; Point must be left after hbdata separator or the logic
;; below could fail. Buffer should be widened already.
(goto-char (point-min))
(search-forward hmail:hbdata-sep nil t))
(let ((case-fold-search t)
(qkey (regexp-quote lbl-key))
(end (save-excursion (if (search-forward "\n\^L" nil t)
(point) (point-max)))))
(if (if instance-flag
(re-search-forward
(concat "\n(\"" qkey "["
hbut:instance-sep "\"]") end t)
(search-forward (concat "\n(\"" lbl-key "\"") end t))
(progn
(unless instance-flag
(beginning-of-line))
(let (buffer-read-only)
(setq rtn (funcall func)))))))
(when end-func (funcall end-func)))))
rtn))