summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-08-06 16:21:33 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-08-06 16:21:33 +0000
commit036f2966c3247692ee79a800b2f40f0778da19c7 (patch)
tree4d4d0fb1ec0e77062b233ce0df5a233d12f8971c /lisp
parentf2b189796cf660c7cc06a6fb8b9f59295594b77b (diff)
downloademacs-036f2966c3247692ee79a800b2f40f0778da19c7.tar.gz
(tpu-current-line): Use posn-at-point and count-screen-lines.
(tpu-edt-off): Disable relevant pieces of advice.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emulation/tpu-edt.el8
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 079f60d281c..f5319ac3ce9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2007-08-06 Stefan Monnier <monnier@iro.umontreal.ca>
+ * 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 --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el
index 414ae7bf14e..9220090df25 100644
--- a/lisp/emulation/tpu-edt.el
+++ b/lisp/emulation/tpu-edt.el
@@ -826,10 +826,13 @@ Create the key map if necessary."
(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 FILE is nil, try to load a default file. The default file names are
(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)