Function: dcl-forward-command

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

Signature

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

Documentation

Move forward to a command.

Move point to the end of the next 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-forward-command (&optional incl-comment-commands)
  "Move forward to a command.
Move point to the end of the next 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)
      ;; go forward one statement and look at the command
      (if (dcl-end-of-statement)
	  (save-excursion
	    (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)
	      (setq retval (point)))
	     ((and dcl-block-end-regexp	; might be nil
		   (looking-at (concat "^\\$" dcl-ws-r
				       dcl-block-end-regexp)))
	      (setq done t)
	      (setq 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))