Function: lua-add-indentation-info-pair
lua-add-indentation-info-pair is a byte-compiled function defined in
lua-mode.el.gz.
Signature
(lua-add-indentation-info-pair PAIR INFO-LIST)
Documentation
Add the indentation info PAIR to the list of indentation INFO-LIST.
This function has special case handling for two tokens: remove-matching, and replace-matching. These two tokens are cleanup tokens that remove or alter the effect of a previously recorded indentation info.
When a remove-matching token is encountered, the last recorded info, i.e. the car of the list is removed. This is used to roll-back an indentation of a block opening statement when it is closed.
When a replace-matching token is seen, the last recorded info is
removed, and the cdr of the replace-matching info is added in its place.
This is used when a middle-of the block (the only case is else) is
seen on the same line the block is opened.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-add-indentation-info-pair (pair info-list)
"Add the indentation info PAIR to the list of indentation INFO-LIST.
This function has special case handling for two tokens: remove-matching,
and replace-matching. These two tokens are cleanup tokens that remove
or alter the effect of a previously recorded indentation info.
When a remove-matching token is encountered, the last recorded info,
i.e. the car of the list is removed. This is used to roll-back an
indentation of a block opening statement when it is closed.
When a replace-matching token is seen, the last recorded info is
removed, and the cdr of the replace-matching info is added in its place.
This is used when a middle-of the block (the only case is `else') is
seen on the same line the block is opened."
(cond
((eq 'multiple (car pair))
(let ((info-pair-elts (cdr pair)))
(while info-pair-elts
(setq info-list (lua-add-indentation-info-pair
(car info-pair-elts) info-list)
info-pair-elts (cdr info-pair-elts)))
info-list))
((eq 'cancel-continued-line (car pair))
(if (eq (caar info-list) 'continued-line)
(cdr info-list)
info-list))
((eq 'remove-matching (car pair))
;; Remove head of list
(cdr info-list))
((eq 'replace-matching (car pair))
;; Remove head of list, and add the cdr of pair instead
(cons (cdr pair) (cdr info-list)))
((listp (cdr-safe pair))
(nconc pair info-list))
(t
;; Just add the pair
(cons pair info-list))))