Function: cider-stacktrace--insert-named-group

cider-stacktrace--insert-named-group is a byte-compiled function defined in cider-stacktrace.el.

Signature

(cider-stacktrace--insert-named-group INDENT NAME &rest VALS)

Documentation

Insert named group with the ability to toggle visibility.

NAME is a string naming the group. VALS are strings to be inserted after the NAME. The whole group is prefixed by string INDENT.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-stacktrace.el
(defun cider-stacktrace--insert-named-group (indent name &rest vals)
  "Insert named group with the ability to toggle visibility.
NAME is a string naming the group.  VALS are strings to be inserted after
the NAME.  The whole group is prefixed by string INDENT."
  (let* ((str (and vals (replace-regexp-in-string "\n+\\'" "" (apply #'concat vals))))
         (id (and str
                  (string-match "\n" str)
                  (gensym name))))
    (insert indent)
    (if id
        (let* ((beg-link (string-match "[^ :]" name))
               (end-link (string-match "[ :]" name (1+ beg-link))))
          (insert (substring name 0 beg-link))
          (insert-text-button (substring name beg-link end-link)
                              :id id
                              'face '((:weight bold) (:underline t))
                              'follow-link t
                              'help-echo "Toggle visibility"
                              'action #'cider-stacktrace--toggle-visibility)
          (insert (substring name end-link)))
      (insert (propertize name 'face '((:weight bold)))))
    (let ((pos (point)))
      (when str
        (cider-stacktrace-emit-indented (concat str "\n") nil nil t)
        (when id
          (remove-from-invisibility-spec (cons id t))
          (let ((hide-beg (save-excursion (goto-char pos) (line-end-position)))
                (hide-end (1- (line-beginning-position))))
            (overlay-put (make-overlay hide-beg hide-end) 'invisible id)))))))