Function: simula-forward-down-level

simula-forward-down-level is an interactive and byte-compiled function defined in simula.el.gz.

Signature

(simula-forward-down-level COUNT)

Documentation

Move forward down COUNT block levels.

If COUNT is negative, move backward down block level instead.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/simula.el.gz
(defun simula-forward-down-level (count)
  "Move forward down COUNT block levels.
If COUNT is negative, move backward down block level instead."
  (interactive "p")
  ;; When we search for a deeper block level, we must never
  ;; get out of the block where we started -> count >= start-count
  (let ((start-count count)
	(origin (point))
	(case-fold-search t))
    (condition-case ()
	(if (< count 0)
	    (while (< count 0)
	      (re-search-backward "\\<begin\\>\\|\\<end\\>")
	      (if (not (simula-context))
		  (setq count (if (memq (following-char) '(?e ?E))
				  (1+ count)
				(1- count))))
	      (if (< count start-count) (signal 'error nil)))
	  (while (> count 0)
	    (re-search-forward "\\<begin\\>\\|\\<end\\>")
	    (backward-word-strictly 1)
	    (if (not (simula-context))
		(setq count (if (memq (following-char) '(?b ?B))
				(1- count)
			      (1+ count))))
	    (backward-word-strictly -1)
	    ;; deeper level has to be found within starting block
	    (if (> count start-count) (signal 'error nil))))
      ;; If block level not found, jump back to origin and signal an error
      (error (progn
	       (goto-char origin)
	       (error "No containing block level")))
      (quit (progn
	      (goto-char origin)
	      (signal 'quit nil))))))