Function: meta-indent-current-nesting
meta-indent-current-nesting is a byte-compiled function defined in
meta-mode.el.gz.
Signature
(meta-indent-current-nesting)
Documentation
Return the indentation according to the nearest environment keyword.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/meta-mode.el.gz
(defun meta-indent-current-nesting ()
"Return the indentation according to the nearest environment keyword."
(save-excursion
(save-restriction
(widen)
(back-to-indentation)
(let ((to-add 0))
;; If we found some environment marker backward...
(if (catch 'found
(while (re-search-backward
(concat "(\\|)\\|\\<" meta-end-environment-regexp "\\>"
"\\|\\<" meta-begin-environment-regexp "\\>"
"\\|\\<" meta-within-environment-regexp "\\>")
nil t)
;; If we aren't in a string or in a comment, we've found something.
(unless (or (meta-indent-in-string-p)
(nth 4 (syntax-ppss)))
(cond ((= (char-after) ?\()
(setq to-add (+ to-add meta-indent-level)))
((= (char-after) ?\))
(setq to-add (- to-add meta-indent-level)))
(t (throw 'found t))))))
(progn
;; ... then use it to compute the current indentation.
(back-to-indentation)
(+ to-add (current-indentation) (meta-indent-level-count)
;; Compensate for backindent of end and within keywords.
(if (meta-indent-looking-at-code
(concat "\\<" meta-end-environment-regexp "\\>\\|"
"\\<" meta-within-environment-regexp "\\>"))
meta-indent-level
;; Compensate for unfinished line.
(if (save-excursion
(meta-indent-previous-line)
(meta-indent-unfinished-line))
(- meta-indent-level)
0))))
0)))))