Function: forms-jump-record

forms-jump-record is an interactive and byte-compiled function defined in forms.el.gz.

Signature

(forms-jump-record ARG &optional RELATIVE)

Documentation

Jump to a random record.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/forms.el.gz
(defun forms-jump-record (arg &optional relative)
  "Jump to a random record."
  (interactive "NRecord number: ")

  ;; Verify that the record number is within range.
  (if (or (> arg forms--total-records)
	  (<= arg 0))
    (error
      ;; Don't give the message if just paging.
      (if (not relative)
	  (message "Record number %d out of range 1..%d"
		   arg forms--total-records)
	"")))

  ;; Flush.
  (forms--checkmod)

  ;; Calculate displacement.
  (let ((cur forms--current-record))

    ;; `forms--show-record' needs it now.
    (setq forms--current-record arg)

    ;; Get the record and show it.
    (forms--show-record
     (with-current-buffer forms--file-buffer
       (beginning-of-line)

       ;; Move, and adjust the amount if needed (shouldn't happen).
       (setq cur (- arg (forms--goto-record arg (if relative cur))))

       (forms--get-record)))

    ;; This shouldn't happen.
    (if (/= forms--current-record cur)
	(progn
	  (setq forms--current-record cur)
	  (error "Stuck at record %d" cur)))))