comparison lisp/emulation/tpu-edt.el @ 78425:753756c6e4ec

(tpu-current-line): Use posn-at-point and count-screen-lines. (tpu-edt-off): Disable relevant pieces of advice.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 06 Aug 2007 16:21:33 +0000
parents 4821c04b4edb
children c6da63ecc892 e5a68f18fcb9
comparison
equal deleted inserted replaced
78424:439c49b198b0 78425:753756c6e4ec
824 (copy-keymap (current-local-map)) 824 (copy-keymap (current-local-map))
825 (make-sparse-keymap))) 825 (make-sparse-keymap)))
826 (use-local-map tpu-buffer-local-map))) 826 (use-local-map tpu-buffer-local-map)))
827 (local-set-key key func)) 827 (local-set-key key func))
828 828
829 (defun tpu-current-line nil 829 (defun tpu-current-line ()
830 "Return the vertical position of point in the selected window. 830 "Return the vertical position of point in the selected window.
831 Top line is 0. Counts each text line only once, even if it wraps." 831 Top line is 0. Counts each text line only once, even if it wraps."
832 (+ (count-lines (window-start) (point)) (if (= (current-column) 0) 1 0) -1)) 832 (or
833 (cdr (nth 6 (posn-at-point)))
834 (if (eq (window-start) (point)) 0
835 (1- (count-screen-lines (window-start) (point) 'count-final-newline)))))
833 836
834 837
835 ;;; 838 ;;;
836 ;;; Breadcrumbs 839 ;;; Breadcrumbs
837 ;;; 840 ;;;
2477 (while map 2480 (while map
2478 (let ((parent (keymap-parent map))) 2481 (let ((parent (keymap-parent map)))
2479 (if (eq tpu-global-map parent) 2482 (if (eq tpu-global-map parent)
2480 (set-keymap-parent map (keymap-parent parent)) 2483 (set-keymap-parent map (keymap-parent parent))
2481 (setq map parent))))) 2484 (setq map parent)))))
2485 (ad-disable-regexp "\\`tpu-")
2482 (setq tpu-edt-mode nil)) 2486 (setq tpu-edt-mode nil))
2483 2487
2484 (provide 'tpu-edt) 2488 (provide 'tpu-edt)
2485 2489
2486 ;; arch-tag: f3dfe61c-2cbd-4f73-b9cc-eb215020b857 2490 ;; arch-tag: f3dfe61c-2cbd-4f73-b9cc-eb215020b857