Function: lisp-indent-259
lisp-indent-259 is a byte-compiled function defined in
cl-indent.el.gz.
Signature
(lisp-indent-259 METHOD PATH STATE INDENT-POINT SEXP-COLUMN NORMAL-INDENT)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-indent.el.gz
;; Blame the crufty control structure on dynamic scoping
;; -- not on me!
(defun lisp-indent-259
(method path state indent-point sexp-column normal-indent)
(catch 'exit
(let ((p path)
(containing-form-start (elt state 1))
n tem tail)
;; Isn't tail-recursion wonderful?
(while p
;; This while loop is for destructuring.
;; p is set to (cdr p) each iteration.
(if (not (consp method)) (lisp-indent-report-bad-format method))
(setq n (1- (car p))
p (cdr p)
tail nil)
(while n
;; This while loop is for advancing along a method
;; until the relevant (possibly &rest/&body) pattern
;; is reached.
;; n is set to (1- n) and method to (cdr method)
;; each iteration.
(setq tem (car method))
(or (eq tem 'nil) ;default indentation
(eq tem '&lambda) ;lambda list
(and (eq tem '&body) (null (cdr method)))
(and (eq tem '&rest)
(consp (cdr method))
(null (cddr method)))
(integerp tem) ;explicit indentation specified
(and (consp tem) ;destructuring
(eq (car tem) '&whole)
(or (symbolp (cadr tem))
(integerp (cadr tem))))
(and (symbolp tem) ;a function to call to do the work.
(null (cdr method)))
(lisp-indent-report-bad-format method))
(cond ((and tail (not (or (consp tem) (symbolp tem))))
;; indent tail of &rest in same way as first elt of rest
(throw 'exit normal-indent))
((eq tem '&body)
;; &body means (&rest <lisp-body-indent>)
(throw 'exit
(if (and (= n 0) ;first body form
(null p)) ;not in subforms
(+ sexp-column
lisp-body-indent)
normal-indent)))
((eq tem '&rest)
;; this pattern holds for all remaining forms
(setq tail (> n 0)
n 0
method (cdr method)))
((> n 0)
;; try next element of pattern
(setq n (1- n)
method (cdr method))
(if (< n 0)
;; Too few elements in pattern.
(throw 'exit normal-indent)))
((eq tem 'nil)
(throw 'exit (if (consp normal-indent)
normal-indent
(list normal-indent containing-form-start))))
((eq tem '&lambda)
(throw 'exit
(cond ((null p)
(list (+ sexp-column 4) containing-form-start))
((null (cdr p))
;; Indentation within a lambda-list. -- dvl
(list (lisp-indent-lambda-list
indent-point
sexp-column
containing-form-start)
containing-form-start))
(t
normal-indent))))
((integerp tem)
(throw 'exit
(if (null p) ;not in subforms
(list (+ sexp-column tem) containing-form-start)
normal-indent)))
((symbolp tem) ;a function to call
(throw 'exit
(funcall tem path state indent-point
sexp-column normal-indent)))
(t
;; must be a destructing frob
(if (not (null p))
;; descend
(setq method (cddr tem)
n nil)
(setq tem (cadr tem))
(throw 'exit
(cond (tail
normal-indent)
((eq tem 'nil)
(list normal-indent
containing-form-start))
((integerp tem)
(list (+ sexp-column tem)
containing-form-start))
(t
(funcall tem path state indent-point
sexp-column normal-indent))))))))))))