Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;;; Allow undo of scrolling
;;;
;;; Code taken from "Writing GNU Emacs Extensions" by Bob Glickstein,
;;; (O'Reilly & Assoc., 1997)
(defvar unscroll-point (make-marker)
"Cursor position for next call to \\[unscroll].")
(defvar unscroll-window-start (make-marker)
"Window start for next call to \\[unscroll].")
(defvar unscroll-hscroll nil
"Horizontal scroll for next call to \\[unscroll].")
(defun unscroll ()
"Revert to last position before the start of scrolling."
(interactive)
(goto-char unscroll-point)
(set-window-start nil unscroll-window-start)
(set-window-hscroll nil unscroll-hscroll))
(put 'scroll-up 'unscrollable t)
(put 'scroll-down 'unscrollable t)
(put 'scroll-left 'unscrollable t)
(put 'scroll-right 'unscrollable t)
(defun unscroll-maybe-remember ()
(if (not (get last-command 'unscrollable))
(progn
(set-marker unscroll-point (point))
(set-marker unscroll-window-start (window-start))
(setq unscroll-hscroll (window-hscroll)))))
(defadvice scroll-up (before remember-for-unscroll activate compile)
"Remember where we started from, for `unscroll'."
(unscroll-maybe-remember))
(defadvice scroll-down (before remember-for-unscroll activate compile)
"Remember where we started from, for `unscroll'."
(unscroll-maybe-remember))
(defadvice scroll-left (before remember-for-unscroll activate compile)
"Remember where we started from, for `unscroll'."
(unscroll-maybe-remember))
(defadvice scroll-right (before remember-for-unscroll activate compile)
"Remember where we started from, for `unscroll'."
(unscroll-maybe-remember))