From: dmcg6174 AT yahoo DOT com (daniel gerard mcgrath) Newsgroups: comp.os.msdos.djgpp,comp.emacs Subject: Re: "shell" command in DJGPP Emacs? Message-ID: <3da36202.44798149@news-server.optonline.net> References: <3da26e84 DOT 3476875 AT news-server DOT optonline DOT net> <3da2bdfe DOT 2802949 AT news-server DOT optonline DOT net> <3da2c999 DOT 5774704 AT news-server DOT optonline DOT net> X-Newsreader: Forte Free Agent 1.21/32.243 Lines: 30 Date: Tue, 08 Oct 2002 23:00:24 GMT NNTP-Posting-Host: 24.190.226.156 X-Trace: news4.srv.hcvlny.cv.net 1034117267 24.190.226.156 (Tue, 08 Oct 2002 18:47:47 EDT) NNTP-Posting-Date: Tue, 08 Oct 2002 18:47:47 EDT Organization: Optimum Online To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On 8 Oct 2002 12:59:28 GMT, Dave Pearson wrote: >* daniel gerard mcgrath : > >> OK! Well, actually, I need a function that works something like this: >> >> (count-lines-in-file FILENAME) >> >> where FILENAME is some sort of path name, like >> "/windows/dansstuf.txt", and the result being that the number of lines >> (i.e. newline characters) in DANSSTUF.TXT (or whatever) is returned >> from the "count-lines-in-file" function. > >(defun count-lines-in-file (file) > "Count lines in FILE. > >If called as an interactive command, also display the count." > (interactive "fFile: ") > (with-temp-buffer > (insert-file-contents-literally file) > (let ((count (count-lines (point-min) (point-max)))) > (when (interactive-p) > (message "%d" count)) > count))) > I don't have a "with-temp-buffer" function. -------------------------------------------------- daniel g. mcgrath (currently going through a depression) http://members.tripod.com/denyore_w0o/