Function: dcl-back-to-indentation-1

dcl-back-to-indentation-1 is a byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-back-to-indentation-1 &optional LIMIT)

Documentation

Helper function for dcl-back-to-indentation.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
(defun dcl-back-to-indentation-1 (&optional limit)
  "Helper function for `dcl-back-to-indentation'."

  ;; "Indentation points" that we will travel to
  ;;  $  l:  !  comment
  ;;  4  3   2  1
  ;;
  ;;  $  !  text
  ;;  3  2  1
  ;;
  ;;  $  l:  command  !
  ;;  3  2   1
  ;;
  ;;  text
  ;;  1

  (let* ((default-limit (1+ (line-end-position)))
	 (limit (or limit default-limit))
	 (last-good-point (point))
	 (opoint (point)))
    ;; Move over blanks
    (back-to-indentation)

    ;; If we already were at the outermost indentation point then we
    ;; start searching for the innermost point again.
    (if (= (point) opoint)
	(setq limit default-limit))

    (if (< (point) limit)
	(setq last-good-point (point)))

    (cond
     ;; Special treatment for comment lines.  We are trying to allow
     ;; things like "$ !*" as comment lines.
     ((looking-at dcl-comment-line-regexp)
      (re-search-forward (concat dcl-comment-line-regexp "[ \t]*") limit t)
      (if (< (point) limit)
	  (setq last-good-point (point))))

     ;; Normal command line
     ((looking-at "^\\$[ \t]*")
      ;; Move over leading "$" and blanks
      (re-search-forward "^\\$[ \t]*" limit t)
      (if (< (point) limit)
	  (setq last-good-point (point)))

      ;; Move over a label (if it isn't a block begin/end)
      ;; We must treat block begin/end labels as commands because
      ;; dcl-set-option relies on it.
      (if (and (looking-at dcl-label-r)
	       (not (or (and dcl-block-begin-regexp
			     (looking-at dcl-block-begin-regexp))
			(and dcl-block-end-regexp
			     (looking-at dcl-block-end-regexp)))))
	  (re-search-forward (concat dcl-label-r "[ \t]*") limit t))
      (if (< (point) limit)
	  (setq last-good-point (point)))

      ;; Move over the beginning of a comment
      (if (looking-at "![ \t]*")
	  (re-search-forward "![ \t]*" limit t))
      (if (< (point) limit)
	  (setq last-good-point (point)))))
    (goto-char last-good-point)))