Mercurial > emacs
changeset 12939:1fc5a2981547
(what-line): Print narrowed linenum with full buffer num.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 25 Aug 1995 14:16:26 +0000 |
parents | 123200a483ae |
children | f7d26ee5ea26 |
files | lisp/simple.el |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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.