|
From: | Eli Daniel |
Subject: | Re: [h-e-w] page-up, page-down helper mode? |
Date: | Mon, 16 Apr 2007 11:44:24 -0400 |
Yes, I think the thing you're looking for was written by David Biesack (address@hidden). I am not aware of it ever having been packaged into any sort of official package, but I do have the following in my .emacs:
;; Make cursor stay in the same column when scrolling. Thanks to
;; David Biesack (address@hidden ).
(defvar default-column nil
"The column to track in functions registered with `track-column'.
This variable is buffer local")
(make-variable-buffer-local 'default-column)
(defvar default-column-tracking-functions nil
"List of functions which track the current column")
(defun default-column ()
"Return the default column to track in cursor motion functions
which are advised by `track-column'"
(if (memq last-command default-column-tracking-functions)
default-column
(setq default-column (current-column))))
(defmacro track-column(function)
"Advise FUNCTION to keep track of the default column.
All functions so advised will strive to maintain the same column."
(add-to-list 'default-column-tracking-functions function)
`(defadvice ,function (around ,(track-column-advice-name function) first activate)
"Keep cursor in the same column."
(let ((col (default-column)))
ad-do-it
(move-to-column col))))
(defun track-column-advice-name (function)
(make-symbol (format "track-column-in-%s" function)))
;; Make subsequently opened frames offset from the first one
(defvar ewd-frame-offset 25
"*Amount to offset each subsequently created frame")
(defadvice x-create-frame-with-faces (before ewd-create-frame activate)
"Make subsequent frames open at an offset"
(let* ((topelt (assoc 'top default-frame-alist))
(leftelt (assoc 'left default-frame-alist))
(top (if (null topelt)
(car (setq default-frame-alist
(cons '(top . 0) default-frame-alist)))
topelt))
(left (if (null leftelt)
(car (setq default-frame-alist
(cons '(left . 0) default-frame-alist)))
leftelt))
(toppos (cdr top))
(leftpos (cdr left)))
(setcdr top (+ toppos ewd-frame-offset))
(setcdr left (+ leftpos ewd-frame-offset))))
(track-column scroll-up)
(track-column scroll-down)
(track-column previous-line)
(track-column next-line)On 4/16/07, Michael Campbell < address@hidden> wrote:I had a catastrophic machine crash and am trying to rebuild my .el files.
One I can't seem to locate was a little function that somehow
calculated or remembered where your cursor was on a page, so no matter
where you were, you could ctrl-v, m-v as much as you wanted, and the
cursor would always land on the same place on a given page.*
Does anyone know what this is called and/or where to find it?
* The effect I'm trying to avoid can easily be demonstrated by opening
an existing file longer than a screen/page long, going to the top of
the file, Ctrl-v, then M-v. The cursor is on the last line of the
screen, not the first line where it started.
[Prev in Thread] | Current Thread | [Next in Thread] |