Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!hplabs!pesnta!amdcad!decwrl!sun!wmb From: wmb@sun.uucp (Mitch Bradley) Newsgroups: net.emacs Subject: Re: what-line-number command in Gosling's Emacs Message-ID: <1858@sun.uucp> Date: Sun, 9-Dec-84 21:39:22 EST Article-I.D.: sun.1858 Posted: Sun Dec 9 21:39:22 1984 Date-Received: Tue, 11-Dec-84 07:34:02 EST References: <2043@uw-june> Organization: Sun Microsystems, Inc. Lines: 35 > Does anyone have a macro for Gosling's Emacs that will tell me > the line number of the line the cursor is on? Probably displaying > it on the message line at the bottom of the screen. Here's one. Maybe there's a better way to do it, but this one works, albeit somewhat slowly. It also tells you the line number in the window. I think Craig Taylor wrote it, but my memory is hazy. (declare-buffer-specific line place-in-window) (defun (line-number (save-excursion (setq line 1) (beginning-of-line) (while (! (bobp)) (previous-line) (setq line (+ line 1)) ) ) (message "Line Number " line) ) (line-number-in-window (save-excursion (setq line 1) (beginning-of-line) (setq place-in-window (dot)) (beginning-of-window) (while (< (dot) place-in-window) (next-line) (setq line (+ line 1)) ) ) (message "Line Number in Window " line) ) )