Function: easy-mmode-define-navigation

easy-mmode-define-navigation is a macro defined in easy-mmode.el.gz.

Signature

(easy-mmode-define-navigation BASE RE &optional NAME ENDFUN NARROWFUN &rest BODY)

Documentation

Define BASE-next and BASE-prev to navigate in the buffer.

RE determines the places the commands should move point to. NAME should describe the entities matched by RE. It is used to build
  the docstrings of the two functions.
BASE-next also tries to make sure that the whole entry is visible by
  searching for its end (by calling ENDFUN if provided or by looking for
  the next entry) and recentering if necessary.
ENDFUN should return the end position (with or without moving point). NARROWFUN non-nil means to check for narrowing before moving, and if found, do widen first and then call NARROWFUN with no args after moving. BODY is executed after moving to the destination location.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/easy-mmode.el.gz
(defmacro easy-mmode-define-navigation (base re &optional name endfun narrowfun
                                             &rest body)
  "Define BASE-next and BASE-prev to navigate in the buffer.
RE determines the places the commands should move point to.
NAME should describe the entities matched by RE.  It is used to build
  the docstrings of the two functions.
BASE-next also tries to make sure that the whole entry is visible by
  searching for its end (by calling ENDFUN if provided or by looking for
  the next entry) and recentering if necessary.
ENDFUN should return the end position (with or without moving point).
NARROWFUN non-nil means to check for narrowing before moving, and if
found, do `widen' first and then call NARROWFUN with no args after moving.
BODY is executed after moving to the destination location."
  (declare (indent 5) (debug (exp exp exp def-form def-form def-body)))
  (let* ((base-name (symbol-name base))
	 (prev-sym (intern (concat base-name "-prev")))
	 (next-sym (intern (concat base-name "-next")))
         (endfun (when endfun `#',endfun))
         (narrowfun (when narrowfun `#',narrowfun)))
    (unless name (setq name base-name))
    `(progn
       (defun ,next-sym (&optional count)
	 ,(format "Go to the next COUNT'th %s.
Interactively, COUNT is the prefix numeric argument, and defaults to 1." name)
	 (interactive "p")
         (easy-mmode--next ,re ,name count ,endfun ,narrowfun)
         ,@body)
       (put ',next-sym 'definition-name ',base)
       (defun ,prev-sym (&optional count)
	 ,(format "Go to the previous COUNT'th %s.
Interactively, COUNT is the prefix numeric argument, and defaults to 1." name)
	 (interactive "p")
         (easy-mmode--prev ,re ,name count ,endfun ,narrowfun)
         ,@body)
       (put ',prev-sym 'definition-name ',base))))