Function: lua-calculate-indentation

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

Signature

(lua-calculate-indentation)

Documentation

Return appropriate indentation for current line as Lua code.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-calculate-indentation ()
  "Return appropriate indentation for current line as Lua code."
  (save-excursion
    (let ((cur-line-begin-pos (line-beginning-position)))
      (or
       ;; When calculating indentation, do the following:
       ;; 1. check, if the line starts with indentation-modifier
       ;;    (open/close brace) and if it should be indented/unindented
       ;;    in special way
       (lua-calculate-indentation-override)

       (when (lua-forward-line-skip-blanks 'back)
         ;; The order of function calls here is important. block
         ;; modifier call may change the point to another line
         (let* ((modifier
                 (lua-calculate-indentation-block-modifier cur-line-begin-pos)))
           (+ (current-indentation) modifier)))

       ;; 4. if there's no previous line, indentation is 0
       0))))