Function: elisp-demos-find-demo

elisp-demos-find-demo is an interactive and byte-compiled function defined in elisp-demos.el.

Signature

(elisp-demos-find-demo SYMBOL)

Documentation

Find the demo of the SYMBOL.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/elisp-demos-20260826.1326/elisp-demos.el
(defun elisp-demos-find-demo (symbol)
  "Find the demo of the SYMBOL."
  (interactive
   (let* ((sym-here (symbol-at-point))
          (symbols (elisp-demos--symbols))
          (default-val (and sym-here
                            (memq sym-here symbols)
                            (symbol-name sym-here)))
          (prompt (if default-val
                      (format "Find demo (default: %s): " default-val)
                    "Find demo: ")))
     (list (read (completing-read prompt
                                  (mapcar #'symbol-name symbols)
                                  nil t nil nil default-val)))))
  (cl-assert symbol)
  (catch 'found
    (dolist (file (append elisp-demos-user-files (list elisp-demos--elisp-demos.org)))
      (with-current-buffer (find-file-noselect file)
        (let ((pos (org-find-exact-headline-in-buffer (symbol-name symbol))))
          (when pos
            (goto-char pos)
            (funcall (if (fboundp 'org-fold-show-entry)
                         'org-fold-show-entry
                       'org-show-entry))
            (if (fboundp 'pop-to-buffer-same-window)
                (pop-to-buffer-same-window (current-buffer))
              (pop-to-buffer (current-buffer)))
            (throw 'found (point)))))))
  t)