home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / emacs / 2890 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.0 KB  |  65 lines

  1. Path: sparky!uunet!news.univie.ac.at!blekul11!cc11.kuleuven.ac.be!stud01
  2. Nntp-Posting-Host: 134.58.8.17
  3. Newsgroups: comp.emacs
  4. From: stud01@cc4.kuleuven.ac.be (Barbe Albert)
  5. Distribution: world
  6. Date: Tuesday, 18 Aug 1992 11:37:36 +02
  7. Message-ID: <1992Aug18.112949@cc4.kuleuven.ac.be>
  8. Organization: K.U.Leuven - Academic Computing Center
  9. Subject: all.el missing function (Oops)
  10. Lines: 53
  11.  
  12. I forgot to include the function unfold-all.
  13. Here is the complete version (hope it works now)
  14. ----------------Cut Here-------------------------
  15. ;;
  16. ;; all.el v1.01   Bert Barbe   (stud01@cc4.kuleuven.ac.be)
  17. ;; use : type          M-x all
  18. ;;       then type the pattern ( or just enter to show all lines again)
  19. ;;
  20. ;; This function uses selective-display and hides lines by changing
  21. ;;  the end of the line in control-M
  22. ;;
  23. ;; comments are allways welcome !
  24. ;; all
  25. ;;
  26. (defun all ( patern )
  27.   (interactive "sPattern: ")
  28.   (setq selective-display t)
  29.   (if (string-equal patern "")
  30.       (unfold-all)
  31.     (setq selective-display t)
  32.     (let ((modp (buffer-modified-p)))
  33.       (unwind-protect
  34.       (save-excursion
  35.         (subst-char-in-region (point-min) (point-max)
  36.                   ?\n ?\^m  t)
  37.         (goto-char 0)
  38.         (or (char-equal ?\^m (char-after 1)) (insert-char ?\^m 1))
  39.         (while  (re-search-forward patern (point-max) t)
  40.           (save-excursion
  41.         (if (search-backward "\^m" (point-min) t)
  42.             (progn
  43.               (delete-char 1 )
  44.               (insert-char ?\n 1))
  45.           (message "Something went wrong.Pity.")))
  46.         )
  47.       )
  48.     
  49.     (set-buffer-modified-p modp)))))
  50. ;;  unfold-all
  51. ;; this function was missing in v1.00
  52. ;;
  53. (defun unfold-all ()
  54.   (interactive)
  55.   (let ((modp (buffer-modified-p)))
  56.     (unwind-protect
  57.         (subst-char-in-region (point-min) (point-max) ?\^M ?\n  t)
  58.      (set-buffer-modified-p modp))))
  59. ----------------Cut Here-------------------------
  60. --
  61. ------------------------------------------------------------------------
  62. Barbe Albert       stud01@cc4.kuleuven.ac.be   (AIX/370)
  63.                    FHGAA98@cc1.kuleuven.ac.be  (VM/CMS)
  64.