# HG changeset patch # User Stefan Monnier # Date 1186417293 0 # Node ID 753756c6e4ec354c0b92b08350640495d241a17c # Parent 439c49b198b0e0247a7882d7e6b3333158884b30 (tpu-current-line): Use posn-at-point and count-screen-lines. (tpu-edt-off): Disable relevant pieces of advice. diff -r 439c49b198b0 -r 753756c6e4ec lisp/ChangeLog --- a/lisp/ChangeLog Mon Aug 06 16:20:10 2007 +0000 +++ b/lisp/ChangeLog Mon Aug 06 16:21:33 2007 +0000 @@ -1,5 +1,9 @@ 2007-08-06 Stefan Monnier + * emulation/tpu-edt.el (tpu-current-line): Use posn-at-point and + count-screen-lines. + (tpu-edt-off): Disable relevant pieces of advice. + * emulation/tpu-extras.el (tpu-before-save-hook): Rename from tpu-write-file-hook. Activate it with add-hook on buffer-save-hook. (newline, newline-and-indent, do-auto-fill): Use advice instead of diff -r 439c49b198b0 -r 753756c6e4ec lisp/emulation/tpu-edt.el --- a/lisp/emulation/tpu-edt.el Mon Aug 06 16:20:10 2007 +0000 +++ b/lisp/emulation/tpu-edt.el Mon Aug 06 16:21:33 2007 +0000 @@ -826,10 +826,13 @@ (use-local-map tpu-buffer-local-map))) (local-set-key key func)) -(defun tpu-current-line nil +(defun tpu-current-line () "Return the vertical position of point in the selected window. Top line is 0. Counts each text line only once, even if it wraps." - (+ (count-lines (window-start) (point)) (if (= (current-column) 0) 1 0) -1)) + (or + (cdr (nth 6 (posn-at-point))) + (if (eq (window-start) (point)) 0 + (1- (count-screen-lines (window-start) (point) 'count-final-newline))))) ;;; @@ -2479,6 +2482,7 @@ (if (eq tpu-global-map parent) (set-keymap-parent map (keymap-parent parent)) (setq map parent))))) + (ad-disable-regexp "\\`tpu-") (setq tpu-edt-mode nil)) (provide 'tpu-edt)