Function: ibtypes::org-id

ibtypes::org-id is a byte-compiled function defined in hibtypes.el.

Signature

(ibtypes::org-id)

Documentation

Display Org roam or Org node referenced by uuid at point, if any.

If on the :ID: definition line, display a message about how to copy the uuid. If the referenced location is found, return non-nil. Match to uuids only to prevent false matches.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hibtypes.el
;;; ========================================================================
;;; Displays Org Roam and Org IDs.
;;; ========================================================================

(defib org-id ()
  "Display Org roam or Org node referenced by uuid at point, if any.
If on the :ID: definition line, display a message about how to copy the uuid.
If the referenced location is found, return non-nil.  Match to uuids
only to prevent false matches."
  (when (featurep 'org-id)
    (let* ((id (thing-at-point 'symbol t)) ;; Could be a uuid or some other form of id
           (bounds (when id (bounds-of-thing-at-point 'symbol)))
	   (start (when bounds (car bounds)))
	   (end   (when bounds (cdr bounds)))
	   m)
      ;; Remove any "ID:" or "id:" prefix
      (when (and id (string-prefix-p "id:" id t))
        (setq id (substring id 3)
              start (+ start 3)))
      ;; Ignore ID definitions or when not on a possible ID
      (when (hsys-org-uuid-is-p id)
	(when (and start end)
	  (ibut:label-set id start end))
	(if (and (not assist-flag)
		 (save-excursion (beginning-of-line)
				 (re-search-forward ":\\(CUSTOM_\\)?ID:[ \t]+"
						    (line-end-position) t)))
	    (hact 'message "On Org ID definition; use {C-u M-RET} to copy a link to an ID.")
	  (when (let ((inhibit-message t) ;; Inhibit `org-id-find' status msgs
		      (obuf (current-buffer))
		      (omode major-mode))
		  (prog1 (setq m (org-id-find id 'marker))
		    ;; org-find-id sets current buffer mode to Org
		    ;; mode even if ID is not found; switch it back
		    ;; when necessary.
		    (when (and (eq obuf (current-buffer))
			       (not (eq omode major-mode)))
		      (funcall omode))))
	    (hact 'link-to-org-id-marker m)))))))