[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
next-line + recenter (- redraw frame)?
From: |
Peter Tury |
Subject: |
next-line + recenter (- redraw frame)? |
Date: |
Fri, 03 Mar 2006 16:54:14 GMT |
User-agent: |
40tude_Dialog/2.0.15.1 |
Hi,
I've created a tiny function for ease reading:
(defun down-center ()
"Moves point down by one line and then moves the line to the
center of the screen.
Keeps columns as next-line does.
Created for ease reading (of program source codes) (since this
way the user always can see the most lines around)."
(interactive)
(if (eq last-command 'down-center)
(setq last-command 'next-line))
(next-line)
(recenter))
(define-key global-map [M-down] 'down-center)
Please comment it!
I am especially interested in these:
- do you know some builtin function what does the same (=so this function
is totally unnecessary) in emacs 22?
- how could I get rid of setting last-command (it seems to be a quite ugly
solution for me...) (it is necessary if you go through e.g. an empty or too
short line: then, without this last-command setting, the original column is
lost (since next-line (more exactly: line-move-1) uses last-command :-((
- how could I get rid of redrawing the frame? recenter's doc writes: "Just
C-u as prefix means put point in the center of the window
and redisplay normally--don't erase and redraw the frame." -- I would like
to use this. But how to call recenter from elisp "just uing C-u as prefix"?
It seems for me that if I put "(universal-argument)" (what is bound to C-u)
before "(recenter)" it doesn't help.
Thanks,
P