# HG changeset patch # User Richard M. Stallman # Date 809360186 0 # Node ID 1fc5a2981547b66b3855afa1ed2094ea9db1c651 # Parent 123200a483aea0ed9295e6a0948df0adb42332b2 (what-line): Print narrowed linenum with full buffer num. diff -r 123200a483ae -r 1fc5a2981547 lisp/simple.el --- a/lisp/simple.el Thu Aug 24 20:18:58 1995 +0000 +++ b/lisp/simple.el Fri Aug 25 14:16:26 1995 +0000 @@ -372,14 +372,23 @@ (count-lines start end) (- end start))) (defun what-line () - "Print the current line number (in the buffer) of point." + "Print the current buffer line number and narrowed line number of point." (interactive) - (save-restriction - (widen) + (let ((opoint (point)) start) (save-excursion - (beginning-of-line) - (message "Line %d" - (1+ (count-lines 1 (point))))))) + (save-restriction + (goto-char (point-min)) + (widen) + (beginning-of-line) + (setq start (point)) + (goto-char opoint) + (beginning-of-line) + (if (/= start 1) + (message "line %d (narrowed line %d)" + (1+ (count-lines 1 (point))) + (1+ (count-lines start (point)))) + (message "Line %d" (1+ (count-lines 1 (point))))))))) + (defun count-lines (start end) "Return number of lines between START and END.