Function: hywiki-create-referent-and-display

hywiki-create-referent-and-display is an interactive and byte-compiled function defined in hywiki.el.

Signature

(hywiki-create-referent-and-display WIKIWORD &optional PROMPT-FLAG)

Documentation

Display the HyWiki referent for WIKIWORD if not in an ert test; return it.

If there is no existing WIKIWORD referent and PROMPT-FLAG is non-nil, prompt for and choose a referent type; see hywiki-referent-menu for valid referent types. Otherwise, if there is no existing HyWiki page for WIKIWORD, add a page for it.

Use hywiki-get-referent to determine whether a HyWikiWord referent or page exists.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-create-referent-and-display (wikiword &optional prompt-flag)
  "Display the HyWiki referent for WIKIWORD if not in an ert test; return it.

If there is no existing WIKIWORD referent and PROMPT-FLAG is non-nil,
prompt for and choose a referent type; see `hywiki-referent-menu' for
valid referent types.  Otherwise, if there is no existing HyWiki page
for WIKIWORD, add a page for it.

Use `hywiki-get-referent' to determine whether a HyWikiWord referent
or page exists."
  (interactive (list (or (hywiki-word-at)
			 (hywiki-word-read-new
			  (format "Add/Edit and display HyWiki %s: "
				  (if current-prefix-arg "referent" "page"))))
		     current-prefix-arg))
  (when (and (not prompt-flag) hywiki-referent-prompt-flag
	     (called-interactively-p 'interactive))
    (setq prompt-flag t))
  (let* ((normalized-word (hywiki-get-singular-wikiword wikiword))
	 (referent (hywiki-find-referent wikiword prompt-flag)))
    (cond (referent)
	  ((hywiki-word-is-p normalized-word)
	   (when (hywiki-add-page normalized-word)
	     (hywiki-display-page normalized-word)))
	  (t (user-error "(hywiki-create-referent-and-display): Invalid HyWikiWord: '%s'; must be capitalized, all alpha" wikiword)))))