Function: tpu-with-position

tpu-with-position is a macro defined in tpu-extras.el.gz.

Signature

(tpu-with-position &rest BODY)

Documentation

Execute BODY with some position-related variables bound.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/tpu-extras.el.gz
;;;  Movement by paragraph

;; Cf edt-with-position.
(defmacro tpu-with-position (&rest body)
  "Execute BODY with some position-related variables bound."
  `(let* ((left nil)
          (beg (tpu-current-line))
          (height (window-height))
          (top-percent
           (if (zerop tpu-top-scroll-margin) 10 tpu-top-scroll-margin))
          (bottom-percent
           (if (zerop tpu-bottom-scroll-margin) 15 tpu-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)
                 (point-at-bol (1- height)))))
     ,@body))