Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.emacs Subject: Re: line number display Message-ID: <1897@umcp-cs.UUCP> Date: Thu, 17-Oct-85 19:44:09 EDT Article-I.D.: umcp-cs.1897 Posted: Thu Oct 17 19:44:09 1985 Date-Received: Sat, 19-Oct-85 07:22:02 EDT References: <110@mit-eddie.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 46 In article <110@mit-eddie.UUCP> Richard M. Stallman writes: > The way the buffer is stored, it is not easy to do this. The only > way to tell what line number anything is is to count all the > newlines. To make this work fast enough, it would have to remember > the line number of the first line from the previous redisplay and > detect the usual case in which the text above the window start has > not changed since then. Most of the mechanism for this exists > already. I wrote line number display code for Gosling Emacs once (and it still exists in our local Emacs); the mechanism proposed above is exactly the one I used. It works passably well for small buffers, but bogs down terribly over about 20K of text. This could conceivably be alleviated by creating a linked list of markers---these are the objects that can tell when text above them has been changed, with the addition of a few lines of code in buffer.c---and line numbers, with the new markers being sprinkled throughout the buffer at every K lines, K being a #define constant which has yet to be determined based on time vs. space tradeoffs. However, I have observed very little use of my line number display facility, so there is no incentive for me to work on it. When I use line numbers in vi it is almost invariably to find compiler errors, and the compile-it facility in Emacs does this better anyway. > I don't think I will write this; I think M-x what-line is good > enough for finding a line number, and I think it is more important > to keep the size of Emacs down. ?! % size /usr/local/bin/gnumacs text data bss dec hex 379904 163840 0 543744 84c00 % I dare say no one would notice the difference. Yet your first reason is after all reason enough, I think. Consider well why you think you need line numbers: there is probably a better solution, well within the present capabilites of Gnu Emacs. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu