Function: meta-indent-calculate

meta-indent-calculate is a byte-compiled function defined in meta-mode.el.gz.

Signature

(meta-indent-calculate)

Documentation

Return the indentation of current line of Metafont or MetaPost source.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/meta-mode.el.gz
(defun meta-indent-calculate ()
  "Return the indentation of current line of Metafont or MetaPost source."
  ;; Indentation within strings is not considered as Meta* don't allow multi
  ;; line strings.
  (save-excursion
    (back-to-indentation)
    (cond
     ;; Comments to the left margin.
     ((and meta-left-comment-regexp
           (looking-at meta-left-comment-regexp))
      0)
     ;; Comments to the right margin.
     ((and meta-right-comment-regexp
           (looking-at meta-right-comment-regexp))
      comment-column)
     ;; Comments best left alone.
     ((and meta-ignore-comment-regexp
           (looking-at meta-ignore-comment-regexp))
      (current-indentation))
     ;; Beginning of buffer.
     ((eq (line-beginning-position) (point-min))
      0)
     ;; Backindent at end of environments.
     ((meta-indent-looking-at-code
       (concat "\\<" meta-end-environment-regexp "\\>"))
      (- (meta-indent-current-indentation) meta-indent-level))
     ;; Backindent at keywords within environments.
     ((meta-indent-looking-at-code
       (concat "\\<" meta-within-environment-regexp "\\>"))
      (- (meta-indent-current-indentation) meta-indent-level))
     (t (meta-indent-current-indentation)))))