Function: edt-with-position

edt-with-position is a macro defined in edt.el.gz.

Signature

(edt-with-position &rest BODY)

Documentation

Execute BODY with some position-related variables bound.

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/edt.el.gz
(defmacro edt-with-position (&rest body)
  "Execute BODY with some position-related variables bound."
  `(let* ((beg (edt-current-line))
          (height (window-height))
          (top-percent
           (if (zerop edt-top-scroll-margin) 10 edt-top-scroll-margin))
          (bottom-percent
           (if (zerop edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin))
          (top-margin (/ (* height top-percent) 100))
          (bottom-up-margin (1+ (/ (* height bottom-percent) 100)))
          (bottom-margin (max beg (- height bottom-up-margin 1)))
          (top (save-excursion (move-to-window-line top-margin) (point)))
          (bottom (save-excursion (move-to-window-line bottom-margin) (point)))
          (far (save-excursion
                 (goto-char bottom)
                 (line-beginning-position (1- height)))))
     (ignore top far)
     ,@body))