Function: lua-accumulate-indentation-info

lua-accumulate-indentation-info is a byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-accumulate-indentation-info REVERSED-INDENTATION-INFO)

Documentation

Accumulate indent information from lua-calculate-indentation-info.

Returns either the relative indentation shift, or the absolute column to indent to.

The argument REVERSED-INDENTATION-INFO is an indentation INFO-LIST.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-accumulate-indentation-info (reversed-indentation-info)
  "Accumulate indent information from `lua-calculate-indentation-info'.
Returns either the relative indentation shift, or the absolute column to
indent to.

The argument REVERSED-INDENTATION-INFO is an indentation INFO-LIST."
  (let (indentation-info
        (type 'relative)
        (accu 0))
    ;; Aggregate all neighboring relative offsets, reversing the INFO list.
    (dolist (elt reversed-indentation-info)
      (if (and (eq (car elt) 'relative)
               (eq (caar indentation-info) 'relative))
          (setcdr (car indentation-info) (+ (cdar indentation-info) (cdr elt)))
        (push elt indentation-info)))

    ;; Aggregate indentation info, taking 'absolute modifiers into account.
    (mapc (lambda (x)
            (if-let* ((new-val (cdr x))
                      ((eq 'absolute (car x))))
                (setq type 'absolute
                      accu new-val)
                (setq accu (+ accu new-val))))
          indentation-info)

    (cons type accu)))