(defmacro edt-with-position (&rest body)
"Execute BODY with some position-related variables bound."
- `(let* ((left nil)
- (beg (edt-current-line))
+ `(let* ((beg (edt-current-line))
(height (window-height))
(top-percent
(if (zerop edt-top-scroll-margin) 10 edt-top-scroll-margin))
(far (save-excursion
(goto-char bottom)
(point-at-bol (1- height)))))
- (ignore top left far)
+ (ignore top far)
,@body))
;;;
(search-backward edt-find-last-text)
(edt-set-match)
(if (> (point) far)
- (if (zerop (setq left (save-excursion (forward-line height))))
- (recenter top-margin)
- (recenter (- left bottom-up-margin)))
+ (let ((left (save-excursion (forward-line height))))
+ (recenter (if (zerop left)
+ top-margin
+ (- left bottom-up-margin))))
(and (> (point) bottom) (recenter bottom-margin))))))
(defun edt-find-backward (&optional find)
(search-backward edt-find-last-text)
(edt-set-match)
(if (> (point) far)
- (if (zerop (setq left (save-excursion (forward-line height))))
- (recenter top-margin)
- (recenter (- left bottom-up-margin)))
+ (let ((left (save-excursion (forward-line height))))
+ (recenter (if (zerop left) top-margin
+ (- left bottom-up-margin))))
(and (> (point) bottom) (recenter bottom-margin))))
(backward-char 1)
(error "Search failed: \"%s\"" edt-find-last-text))))
(forward-word 1)
(backward-sentence))
(if (> (point) far)
- (if (zerop (setq left (save-excursion (forward-line height))))
- (recenter top-margin)
- (recenter (- left bottom-up-margin)))
+ (let ((left (save-excursion (forward-line height))))
+ (recenter (if (zerop left) top-margin (- left bottom-up-margin))))
(and (> (point) bottom) (recenter bottom-margin)))))
(defun edt-sentence-backward (num)
(forward-line 1))
(setq num (1- num)))
(if (> (point) far)
- (if (zerop (setq left (save-excursion (forward-line height))))
- (recenter top-margin)
- (recenter (- left bottom-up-margin)))
+ (let ((left (save-excursion (forward-line height))))
+ (recenter (if (zerop left) top-margin (- left bottom-up-margin))))
(and (> (point) bottom) (recenter bottom-margin)))))
(defun edt-paragraph-backward (num)