Function: hbdata:ibut-instance-last

hbdata:ibut-instance-last is a byte-compiled function defined in hbdata.el.

Signature

(hbdata:ibut-instance-last NAME-KEY)

Documentation

Return highest instance number for implicit button NAME-KEY in current buffer.

Instance number is returned as an integer. Return 1 if NAME-KEY exists in the buffer but no other instances do; nil if no instance.

With no match, return nil. With only name found, return 1. With name and name:2 found, return 2.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbdata.el
(defun hbdata:ibut-instance-last (name-key)
  "Return highest instance number for implicit button NAME-KEY in current buffer.
Instance number is returned as an integer.  Return 1 if NAME-KEY exists
in the buffer but no other instances do; nil if no instance.

With no match, return nil.
With only `name' found, return 1.
With `name' and `name:2' found, return 2."
  (let ((key (car (ibut:label-sort-keys (ibut:label-key-match name-key)))))
    (cond ((null key) nil)
	  ((string-match (concat (regexp-quote hbut:instance-sep)
				 "\\([0-9]+\\)\\'")
			 key)
	   (string-to-number (match-string 1 key)))
	  (t 1))))