Function: opascal-line-indent-of

opascal-line-indent-of is a byte-compiled function defined in opascal.el.gz.

Signature

(opascal-line-indent-of FROM-TOKEN &optional OFFSET &rest TERMINATORS)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/opascal.el.gz
(defun opascal-line-indent-of (from-token &optional offset &rest terminators)
  ;; Returns the column of first non-space character on the token's line, plus
  ;; any offset. We also stop if one of the terminators or an open ( or [ is
  ;; encountered.
  (let ((token (opascal-previous-token from-token))
        (last-token from-token)
        (kind nil))
    (catch 'done
      ;; FIXME: Can't use opascal--scan-non-whitespace-backward here, because
      ;; we do need to pay attention to `newline'!
      (while token
        (setq kind (opascal-token-kind token))
        (cond
         ;; Skip over ()/[] groups.
         ((eq 'close-group kind) (setq token (opascal-group-start token)))

         ;; Stop at the beginning of the line or an open group.
         ((memq kind '(newline open-group)) (throw 'done nil))

         ;; Stop at one of the specified terminators.
         ((memq kind terminators) (throw 'done nil)))
        (unless (memq kind opascal-whitespace) (setq last-token token))
        (setq token (opascal-previous-token token))))
    (opascal-indent-of last-token offset)))