Function: hydra--format-1
hydra--format-1 is a byte-compiled function defined in hydra.el.
Signature
(hydra--format-1 DOCSTRING REST VARLIST)
Source Code
;; Defined in ~/.emacs.d/elpa/hydra-20250316.1254/hydra.el
(defun hydra--format-1 (docstring rest varlist)
(cond
((string= docstring "")
rest)
((listp rest)
(unless (string-match-p "[:\n]" docstring)
(setq docstring (concat docstring ":\n")))
(unless (or (string-match-p "\n\\'" docstring)
(equal (cadr rest) "\n"))
(setq docstring (concat docstring "\n")))
`(concat (format ,(replace-regexp-in-string "\\`\n" "" docstring) ,@(nreverse varlist))
,@(cdr rest)))
((eq ?\n (aref docstring 0))
`(format ,(concat (substring docstring 1) rest) ,@(nreverse varlist)))
(t
(let ((r `(replace-regexp-in-string
" +$" ""
(concat ,docstring
,(cond ((string-match-p "\\`\n" rest)
":")
((string-match-p "\n" rest)
":\n")
(t
": "))
(replace-regexp-in-string
"\\(%\\)" "\\1\\1" ,rest)))))
(if (stringp rest)
`(format ,(eval r))
`(format ,r))))))