Function: dcl-backward-command

dcl-backward-command is an interactive and byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-backward-command &optional INCL-COMMENT-COMMANDS)

Documentation

Move backward to a command.

Move point to the preceding command line that is not a comment line, a command line with only a comment, only contains a $ or only contains a label.

Returns point of the found command line or nil if not able to move.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
;;;-------------------------------------------------------------------------
(defun dcl-backward-command (&optional incl-comment-commands)
  "Move backward to a command.
Move point to the preceding command line that is not a comment line,
a command line with only a comment, only contains a `$' or only
contains a label.

Returns point of the found command line or nil if not able to move."
  (interactive)
  (let ((start (point))
	done
	retval)
    ;; Find first non-empty command line
    (while (not done)
      ;; back up one statement and look at the command
      (if (dcl-beginning-of-statement)
	  (cond
	   ((and dcl-block-begin-regexp ; might be nil
		 (looking-at (concat "^\\$" dcl-ws-r
				     dcl-block-begin-regexp)))
	    (setq done t retval (point)))
	   ((and dcl-block-end-regexp	; might be nil
		 (looking-at (concat "^\\$" dcl-ws-r
				     dcl-block-end-regexp)))
	    (setq done t retval (point)))
	   ((looking-at dcl-comment-line-regexp)
	    t)				; comment line, one more loop
	   ((and (not incl-comment-commands)
		 (looking-at "\\$[ \t]*!"))
	    t)				; comment only command, loop...
	   ((looking-at "^\\$[ \t]*$")
	    t)				; empty line, one more loop
	   ((not (looking-at
		  (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
	    (setq done t)		; not a label-only line, exit the loop
	    (setq retval (point))))
	;; We couldn't go further back, and we haven't found a command yet.
	;; Return to the start position.
	(goto-char start)
	(setq done t)
	(setq retval nil)))
    retval))