aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-08-25 14:16:26 +0000
committerRichard M. Stallman1995-08-25 14:16:26 +0000
commit2578be761919506dd52833833f58b2c5b35d7f48 (patch)
tree1a33e2ab71f2a504a92c7ce7bd5a32662ade1b6e
parent6a99a3eade8aa01a10cfdbed06f6c4995476cd53 (diff)
downloademacs-2578be761919506dd52833833f58b2c5b35d7f48.tar.gz
emacs-2578be761919506dd52833833f58b2c5b35d7f48.zip
(what-line): Print narrowed linenum with full buffer num.
-rw-r--r--lisp/simple.el21
1 files changed, 15 insertions, 6 deletions
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."
372 (count-lines start end) (- end start))) 372 (count-lines start end) (- end start)))
373 373
374(defun what-line () 374(defun what-line ()
375 "Print the current line number (in the buffer) of point." 375 "Print the current buffer line number and narrowed line number of point."
376 (interactive) 376 (interactive)
377 (save-restriction 377 (let ((opoint (point)) start)
378 (widen)
379 (save-excursion 378 (save-excursion
380 (beginning-of-line) 379 (save-restriction
381 (message "Line %d" 380 (goto-char (point-min))
382 (1+ (count-lines 1 (point))))))) 381 (widen)
382 (beginning-of-line)
383 (setq start (point))
384 (goto-char opoint)
385 (beginning-of-line)
386 (if (/= start 1)
387 (message "line %d (narrowed line %d)"
388 (1+ (count-lines 1 (point)))
389 (1+ (count-lines start (point))))
390 (message "Line %d" (1+ (count-lines 1 (point)))))))))
391
383 392
384(defun count-lines (start end) 393(defun count-lines (start end)
385 "Return number of lines between START and END. 394 "Return number of lines between START and END.