Function: dcl-calc-continuation-indent

dcl-calc-continuation-indent is a byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-calc-continuation-indent)

Documentation

Calculate how much the current line shall be indented.

The line is known to be a continuation line.

Go to the previous command line. Find out how much it is indented.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
;;;---------------------------------------------------------------------------
(defun dcl-calc-continuation-indent ()
  "Calculate how much the current line shall be indented.
The line is known to be a continuation line.

Go to the previous command line.
Find out how much it is indented."
;; This was copied without much thought from dcl-calc-command-indent, so
;; it's a bit clumsy.
  ()
  (save-excursion
    (beginning-of-line)
    (if (bobp)
	;; Huh? a continuation line first in the buffer??
        dcl-margin-offset
      (let ((is-block nil)
            (indent))
        (save-excursion
          ;; Find first non-empty command line
          (let ((done))
            (while (not done)
              (if (dcl-beginning-of-statement)
                  (cond
                   ((and dcl-block-begin-regexp
                         (looking-at (concat "^\\$" dcl-ws-r
                                             dcl-block-begin-regexp)))
                    (setq done t) (setq is-block t))
                   ((and dcl-block-end-regexp
                         (looking-at (concat "^\\$" dcl-ws-r
                                             dcl-block-end-regexp)))
                    (setq done t) (setq is-block t))
                   ((looking-at dcl-comment-line-regexp)
                    t)
                   ((looking-at "^\\$[ \t]*$")
                    t)
                   ((not (looking-at
                          (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
                    (setq done t)))
                ;; This must have been the first line.
                (setq indent dcl-margin-offset)
                (setq done t)))
            (if indent
                ()
              ;; Find out how much this line is indented.
              ;; Look at comment, continuation character, command but not label
              ;; unless it's a block.
              (if is-block
                  (re-search-forward "^\\$[ \t]*")
                (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
                                           "\\)*[ \t]*")))
              (setq indent (current-column))
              )))
          ;; We're back at the beginning of the original line.
	  (or (and dcl-calc-cont-indent-function
		   (funcall dcl-calc-cont-indent-function indent
			    dcl-continuation-offset))
	      (+ indent dcl-continuation-offset))
        ))))