Function: indent-bars--context-bars

indent-bars--context-bars is a natively compiled function defined in indent-bars.el.

Signature

(indent-bars--context-bars END &optional MIN)

Documentation

Maximum number of bars between point and END.

Point and END are expected to be on different lines. If MIN is non-nil, return the minimum number of bars instead. If bars are skipped on either line, the return value is (DEPTH . SKIP), where SKIP is a list of bar numbers to skip. If the bar depths at point and END are the same, and both include a list of bars to be skipped, the longer of the two SKIP lists is returned.

Moves point.

Source Code

;; Defined in /nix/store/zkcdcnmcj3605fj09x584bf58d85brax-emacs-packages-deps/share/emacs/site-lisp/elpa/indent-bars-1.0.1/indent-bars.el
(defun indent-bars--context-bars (end &optional min)
  "Maximum number of bars between point and END.
Point and END are expected to be on different lines.  If MIN is non-nil,
return the minimum number of bars instead.  If bars are skipped on
either line, the return value is (DEPTH . SKIP), where SKIP is a list of
bar numbers to skip.  If the bar depths at point and END are the same,
and both include a list of bars to be skipped, the longer of the two
SKIP lists is returned.

Moves point."
  (let* ((skip-p (eq indent-bars-no-descend-lists 'skip))
	 (pdepth (indent-bars--current-indentation-depth nil skip-p))
	 (edepth (progn
		   (goto-char (1+ end))	; end is always at eol
		   (indent-bars--current-indentation-depth nil skip-p)))
	 skip eskip)
    (when (consp pdepth)
      (setq skip (cdr pdepth) pdepth (car pdepth)))
    (when (consp edepth)
      (setq eskip (cdr edepth) edepth (car edepth)))
    (when (and skip eskip)  ; unlikely case: two competing skip lists?
      (cond
       ((< edepth pdepth) (when min (setq skip eskip)))
       ((> edepth pdepth) (unless min (setq skip eskip)))
       (t (if (> (length eskip) (length skip)) (setq skip eskip)))))
    (let ((depth (funcall (if min #'min #'max) pdepth edepth)))
      (if skip (cons depth skip) depth))))