Function: hbdata:delete-entry

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

Signature

(hbdata:delete-entry LBL-KEY KEY-SRC &optional DIRECTORY)

Documentation

Delete button data entry given by LBL-KEY, KEY-SRC and optional DIRECTORY.

Return entry deleted (a list of attribute values) or nil. Use methods from class hbdata to operate on the entry. If the hbdata buffer is blank/empty, kill it and remove the associated file.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbdata.el
;;; ------------------------------------------------------------------------
;;; Button data operators
;;; ------------------------------------------------------------------------

(defun hbdata:delete-entry (lbl-key key-src &optional directory)
  "Delete button data entry given by LBL-KEY, KEY-SRC and optional DIRECTORY.
Return entry deleted (a list of attribute values) or nil.
Use methods from class `hbdata' to operate on the entry.
If the hbdata buffer is blank/empty, kill it and remove the associated file."
  (hbdata:apply-entry
   (lambda ()
     (prog1 (read (current-buffer))
       (let ((empty-file-entry "[ \t\n\r]*\\(\^L\\|\\'\\)")
	     (kill))
	 (beginning-of-line)
	 (hbdata:delete-entry-at-point)
	 (when (looking-at empty-file-entry)
	   (let ((end (point))
		 (empty-hbdata-file "[ \t\n\r]*\\'"))
	     (forward-line -1)
	     (when (eq (following-char) ?\")
		 ;; Last button entry for filename, so del filename.
		 (forward-line -1)
		 (delete-region (point) end))
	     (save-excursion
	       (goto-char (point-min))
	       (when (looking-at empty-hbdata-file)
		 (setq kill t)))
	     (when kill
	       (let ((fname (hypb:buffer-file-name)))
		 (erase-buffer) (save-buffer) (kill-buffer nil)
		 (hbmap:dir-remove (file-name-directory fname))
		 (delete-file fname))))))))
   lbl-key key-src directory))