Function: mh-recenter
mh-recenter is an autoloaded and byte-compiled function defined in
mh-folder.el.gz.
Signature
(mh-recenter ARG)
Documentation
Like recenter but with three improvements:
- At the end of the buffer it tries to show fewer empty lines.
- operates only if the current buffer is in the selected window.
(Commands like save-some-buffers can make this false.)
- nil ARG means recenter as if prefix argument had been given.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;;###mh-autoload
(defun mh-recenter (arg)
"Like recenter but with three improvements:
- At the end of the buffer it tries to show fewer empty lines.
- operates only if the current buffer is in the selected window.
(Commands like `save-some-buffers' can make this false.)
- nil ARG means recenter as if prefix argument had been given."
(cond ((not (eq (get-buffer-window (current-buffer)) (selected-window)))
nil)
((= (point-max) (save-excursion
(forward-line (- (/ (window-height) 2) 2))
(point)))
(let ((lines-from-end 2))
(save-excursion
(while (> (point-max) (progn (forward-line) (point)))
(cl-incf lines-from-end)))
(recenter (- lines-from-end))))
;; '(4) is the same as C-u prefix argument.
(t (recenter (or arg '(4))))))