home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / sources / 960 < prev    next >
Encoding:
Text File  |  1993-01-24  |  2.5 KB  |  60 lines

  1. Newsgroups: gnu.emacs.sources
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!sol.ctr.columbia.edu!kfogel
  3. From: kfogel@occs.cs.oberlin.edu (Karl Fogel)
  4. Subject: summarize-ls-lR.el, for sorting through large ls-lR's
  5. Sender: nobody@ctr.columbia.edu
  6. Organization: Oberlin College Computer Science
  7. Date: Sun, 24 Jan 1993 00:19:38 GMT
  8. Message-ID: <KFOGEL.93Jan23191938@occs.cs.oberlin.edu>
  9. X-Posted-From: occs.cs.oberlin.edu
  10. NNTP-Posting-Host: sol.ctr.columbia.edu
  11. Lines: 47
  12.  
  13.  
  14.     Here is the least useful elisp program I know of, written to
  15. prove that no task, no matter how trivial, is too minor to warrant a
  16. special elisp function. I needed it to sort through a large (10000+
  17. line) ls-lR file of my hard drive. I wanted a way to sort out all
  18. those things that were in directories named "bin" or subdirs thereof
  19. (say, /usr/bin/X11 or something) and list just them, and then do dirs
  20. named "etc" and subdirs, then "lib", and so on, so that I could have a
  21. more or less complete listing of all the executable binaries on my
  22. system, and all the libs, etc. But I didn't want to do it by hand, no
  23. sir, I wanted the machine to do it for me. So here it is, and if
  24. anyone out there actually uses it, I will be shocked. But, SOMEDAY,
  25. you will be sorting through an ls-lR file, and then you'll be glad you
  26. downloaded this. Enjoy!
  27.  
  28. -karl
  29.  
  30.  
  31. (defun summarize-ls-lR (lsr-search-pat lsr-summary-buffer)
  32.   "Copies specified directories from an ls-lR file and pastes them 
  33. into specified buffer. Directories may be specified by any criterion, 
  34. but \"foo:^J\" is recommended, since ls-lR format uses that for the 
  35. basename of directories. To get dirs named \"foo\" and subdirs
  36. thereof, search for regexp \"foo\\(:\\|/.*:\\)\"."
  37.   (interactive "sEnter summary criterion: \nsEnter buffer to paste to: ")
  38.   (save-excursion
  39.     (re-search-forward lsr-search-pat)
  40.     (beginning-of-line)
  41.     (let ((lsr-pos1 (point)))
  42.       (search-forward "\C-j\C-j")
  43.       (let ((lsr-pos2 (point)))
  44.     (let ((lsr-string (buffer-substring lsr-pos1 lsr-pos2))
  45.           (lsr-orig-buffer (current-buffer)))
  46.       (set-buffer (get-buffer-create lsr-summary-buffer))
  47.       (insert lsr-string)
  48.       (set-buffer lsr-orig-buffer))))
  49.     (summarize-ls-lR lsr-search-pat lsr-summary-buffer)))
  50.  
  51.  
  52.  
  53.  
  54. --
  55.  Karl Fogel ("Leg of Lark") <>         My institutions are not 
  56.    kfogel@cs.oberlin.edu    <>    necessarily those of my opinions.
  57.  fogel@antares.mcs.anl.gov  <> 
  58.  <> Linux, the copylefted Unix for the 386/486 PC!!! <>  Ask me more!!!  <>
  59.   <> Linux FAQ: tsx-11.mit.edu:/pub/linux or sunsite.unc.edu:/pub/Linux <>
  60.