(global-set-key "\C-p" 'previous-line) (global-set-key "\C-n" 'next-line) (global-set-key [up] 'previous-window-line) (global-set-key [down] 'next-window-line) (defun previous-window-line (n) "Function which move cursor to previous line like previous-line, but not same. Previous-line move curson on previous line in buffer, but this funciton move kursor to previous line which is show on screen." (interactive "p") (let ((cur-col (- (current-column) (save-excursion (vertical-motion 0) (current-column))))) (vertical-motion (- n)) (move-to-column (+ (current-column) cur-col))) (run-hooks 'auto-line-hook) ) (defun next-window-line (n) "Function which move cursor to next line like next-line, but not same. Next-line move curson on next line in buffer, but this funciton move kursor to next line which is show on screen." (interactive "p") (let ((cur-col (- (current-column) (save-excursion (vertical-motion 0) (current-column))))) (vertical-motion n) (move-to-column (+ (current-column) cur-col))) (run-hooks 'auto-line-hook) )