From: Richard M. Stallman Date: Fri, 25 Aug 1995 14:16:26 +0000 (+0000) Subject: (what-line): Print narrowed linenum with full buffer num. X-Git-Tag: emacs-19.34~2921 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2578be761919506dd52833833f58b2c5b35d7f48;p=emacs.git (what-line): Print narrowed linenum with full buffer num. --- diff --git a/lisp/simple.el b/lisp/simple.el index 5699b1d3503..ea27a5bf460 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -372,14 +372,23 @@ that uses or sets the mark." (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.