Function: yaml-narrow-to-block-literal
yaml-narrow-to-block-literal is an interactive and natively compiled
function defined in yaml-mode.el.
Signature
(yaml-narrow-to-block-literal)
Documentation
Narrow the buffer to block literal if the point is in it, otherwise do nothing.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/fxfawcfn8g3mqnf4q0lmvgvy0vp3nxrx-emacs-packages-deps/share/emacs/site-lisp/elpa/yaml-mode-20260830.2340/yaml-mode.el
(defun yaml-narrow-to-block-literal ()
"Narrow the buffer to block literal if the point is in it,
otherwise do nothing."
(interactive)
(save-excursion
(goto-char (line-beginning-position))
(while (and (looking-at-p yaml-blank-line-re) (not (bobp)))
(forward-line -1))
(let ((nlines yaml-block-literal-search-lines)
(min-level (current-indentation))
beg)
(forward-line -1)
(while (and (/= nlines 0)
(/= min-level 0)
(not (looking-at-p yaml-block-literal-re))
(not (bobp)))
(setq nlines (1- nlines))
(unless (looking-at-p yaml-blank-line-re)
(setq min-level (min min-level (current-indentation))))
(forward-line -1))
(when (and (< (current-indentation) min-level)
(looking-at-p yaml-block-literal-re))
(setq min-level (current-indentation))
(forward-line)
(setq beg (point))
(while (and (not (eobp))
(or (looking-at-p yaml-blank-line-re)
(> (current-indentation) min-level)))
(forward-line))
(narrow-to-region beg (point))))))