Function: hypb:insert-hyperbole-banner

hypb:insert-hyperbole-banner is a byte-compiled function defined in hypb.el.

Signature

(hypb:insert-hyperbole-banner)

Documentation

Display an optional text FILE with the Hyperbole banner prepended.

Without file, the banner is prepended to the current buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
;;; ************************************************************************
;;; Private functions
;;; ************************************************************************

(defun hypb:insert-hyperbole-banner ()
  "Display an optional text FILE with the Hyperbole banner prepended.
Without file, the banner is prepended to the current buffer."
  (let ((hyperbole-banner-path (expand-file-name "hyperbole-banner.png" hyperb:dir)))
    (unless (file-readable-p hyperbole-banner-path)
      (setq hyperbole-banner-path (expand-file-name "hyperbole-banner.png"
						    data-directory)))
    (if (or (not (fboundp 'create-image))
	    (not (display-graphic-p))
	    (let ((button (next-button (point-min))))
	      (and button (button-has-type-p button 'hyperbole-banner)))
	    (not hyperbole-banner-path)
	    (not (file-readable-p hyperbole-banner-path)))
	;; Either image support is unavailable, the file cannot be read
	;; or the image has already been inserted, so don't reinsert it.
	nil
      (let ((hyperbole-banner (create-image hyperbole-banner-path))
	     (buffer-read-only)
	     button)
	(goto-char (point-min))
	;; Keep any initial line of variable settings, e.g. for Org
	;; mode as the first line.
	(when (looking-at (regexp-quote "-*- "))
	  (forward-line 1))
	(insert "\n")
	(insert-image hyperbole-banner)
	(insert "\n")
	(setq button (make-button (- (point) 2) (- (point) 1) :type 'hyperbole-banner))
	(button-put button 'help-echo (concat "Click to visit " hypb:home-page))
	(button-put button 'action #'hypb:browse-home-page)
	(button-put button 'face 'default)
	(button-put button 'keymap hypb:hyperbole-banner-keymap)))))