Function: evil-initial-state-for-buffer-name

evil-initial-state-for-buffer-name is a byte-compiled function defined in evil-core.el.

Signature

(evil-initial-state-for-buffer-name &optional NAME DEFAULT)

Documentation

Return the initial Evil state to use for a buffer with name NAME.

Matches the name against the regular expressions in evil-buffer-regexps. If none matches, returns DEFAULT.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-core.el
(defun evil-initial-state-for-buffer-name (&optional name default)
  "Return the initial Evil state to use for a buffer with name NAME.
Matches the name against the regular expressions in
`evil-buffer-regexps'. If none matches, returns DEFAULT."
  (let ((name (if (stringp name) name (buffer-name name))))
    (when name
      (catch 'done
        (dolist (entry evil-buffer-regexps default)
          (let ((regexp (car entry))
                (state (cdr entry)))
            (when (string-match-p regexp name)
              (throw 'done state))))))))