Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site rochester.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rochester!koomen
From: koomen@rochester.UUCP (Hans Koomen)
Newsgroups: net.emacs
Subject: Re: what-line-number command in Gosling's Emacs
Message-ID: <4559@rochester.UUCP>
Date: Mon, 10-Dec-84 15:57:00 EST
Article-I.D.: rocheste.4559
Posted: Mon Dec 10 15:57:00 1984
Date-Received: Wed, 12-Dec-84 04:21:54 EST
References: <2043@uw-june>
Organization: U. of Rochester, CS Dept.
Lines: 35
Cc: koomen

Here are three functions I have used for quite some time:

"current-line"		(fast)
"where-am-i"		(bound to "\ew")
"position-dot-at-line"	(bound to "\ep")

Enjoy!

-- Hans

(defun
    (current-line lcnt incr
	(save-excursion
	    (setq lcnt 1)
	    (setq incr (/ (dot) 80))
	    (while (> incr 1)
		   (while (! (error-occured
				 (provide-prefix-argument incr
				     (search-reverse "\^J"))))
			  (setq lcnt (+ lcnt incr)))
		   (setq incr (/ incr 4)))
	    (while (! (error-occured (search-reverse "\^J")))
		   (setq lcnt (+ lcnt 1)))
	lcnt)
    )

    (where-am-i
	(message "line " (current-line) ", column " (current-column))
	(novalue))
    
    (position-dot-at-line n
	(setq n (get-tty-string ": position-dot-at-line "))
	(beginning-of-file)
	(provide-prefix-argument (- n 1) (next-line)))