home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / patches / man.el.patch < prev    next >
Encoding:
Text File  |  1991-03-30  |  4.5 KB  |  140 lines

  1. Path: utkcs2!emory!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!ittc.wec.com!fpb
  2. >From: fpb@ittc.wec.com (Frank P. Bresz)
  3. Newsgroups: gnu.emacs.bug
  4. Subject: man.el patches to 18.55
  5. Date: 17 Aug 90 18:24:53 GMT
  6. Organization: Westinghouse, ITTC, Pgh, PA.
  7.  
  8. In GNU Emacs 18.55.8 of Tue Jul 31 1990 on ittc (berkeley-unix)
  9.  
  10. Here is a patch for man.el
  11.  
  12. It makes the following modifications.
  13.  
  14. 1) The output buffer is named *topic man*.  This was originally sent out on
  15. the net before and I snarfed it up then. Sorry I lost the posters name.  
  16.  
  17. 2) Pops to the appropriate *topic man* buffer if it exists instead of
  18. having to reformat and re-clean the page again.
  19.  
  20. 3) Nukes a little more BS that is created by the Sun man pages.
  21.  
  22. 4) Makes sure the man page is readonly to prevent accidental editing, and
  23. kludges the keymap to do scrolling ala view-mode.
  24.  
  25.  
  26. enjoy
  27.  
  28. +--------------------+
  29. |fbresz@ittc.wec.com |  My opinions are my own, I'm not paid
  30. |uunet!ittc!fbresz   |  enough to make an official statement  
  31. |(412)733-6749       |  +-----------------------------------+
  32. |Fax: (412)733-6444  |  |      THIS SPACE FOR SALE!!!       |
  33. +--------------------+  +-----------------------------------+
  34.  
  35.  
  36. Patch starts here (should be virgin 18.55 I think)
  37.  
  38.  
  39. ------- man.el -------
  40. *** /tmp/da01019    Fri Aug 17 14:23:37 1990
  41. --- man.el    Fri Aug 17 14:23:22 1990
  42. ***************
  43. *** 18,23 ****
  44. --- 18,45 ----
  45.   ;; file named COPYING.  Among other things, the copyright notice
  46.   ;; and this notice must be preserved on all copies.
  47.   
  48. + ;; Added code here to suppress the changes of the man buffers.
  49. + ;;  - fbresz@ittc.wec.com - Aug 17, 1990
  50. + ;; @(#)man.el    1.14
  51. + (defvar man-map nil "Keymap used inside man pages")
  52. + ;; Initialize the keymap if it isn't already
  53. + (if man-map
  54. +     nil
  55. +   (setq man-map (make-keymap))
  56. +   (suppress-keymap man-map)
  57. +   (define-key man-map "?" 'describe-mode)
  58. +   (define-key man-map "." 'beginning-of-buffer)
  59. +   (define-key man-map " " 'scroll-up)
  60. +   (define-key man-map "\177" 'scroll-down)
  61. +   (define-key man-map "\r" '(lambda () (interactive) (scroll-up 1)))
  62. + ;; lambda's in keyboard maps ecchh?!? this is gross but I didn't
  63. + ;; want to create a function because in theory I would want to call it
  64. + ;; man-scroll-up-1 and that would break the fact that I can now type 
  65. + ;; M-x man <CR> and it prompts me for the topic.
  66. + )
  67.   (defun manual-entry (topic &optional section)
  68.     "Display the Unix manual entry for TOPIC.
  69.   TOPIC is either the title of the entry, or has the form TITLE(SECTION)
  70. ***************
  71. *** 29,35 ****
  72.                        (match-end 2))
  73.           topic (substring topic (match-beginning 1)
  74.                      (match-end 1))))
  75. !   (with-output-to-temp-buffer "*Manual Entry*"
  76.       (buffer-flush-undo standard-output)
  77.       (save-excursion
  78.         (set-buffer standard-output)
  79. --- 51,61 ----
  80.                        (match-end 2))
  81.           topic (substring topic (match-beginning 1)
  82.                      (match-end 1))))
  83. !   (if (get-buffer (concat "*" topic (and section (concat " " section)) " man*"))
  84. !       (switch-to-buffer-other-window 
  85. !        (concat "*" topic (and section (concat " " section)) " man*"))
  86. !   (with-output-to-temp-buffer 
  87. !       (concat "*" topic (and section (concat " " section)) " man*")
  88.       (buffer-flush-undo standard-output)
  89.       (save-excursion
  90.         (set-buffer standard-output)
  91. ***************
  92. *** 88,94 ****
  93.         (message "Cleaning manual entry for %s..." topic)
  94.         (nuke-nroff-bs)
  95.         (set-buffer-modified-p nil)
  96. !       (message ""))))
  97.   
  98.   ;; Hint: BS stands form more things than "back space"
  99.   (defun nuke-nroff-bs ()
  100. --- 114,122 ----
  101.         (message "Cleaning manual entry for %s..." topic)
  102.         (nuke-nroff-bs)
  103.         (set-buffer-modified-p nil)
  104. !       (setq buffer-read-only t)
  105. !       (use-local-map man-map)
  106. !       (message "")))))
  107.   
  108.   ;; Hint: BS stands form more things than "back space"
  109.   (defun nuke-nroff-bs ()
  110. ***************
  111. *** 136,141 ****
  112. --- 164,185 ----
  113.     (goto-char (point-min))
  114.     (while (re-search-forward "\n\n\n\n*" nil t)
  115.       (replace-match "\n\n"))
  116. +   ;; Nuke the stupid <ESC>8 <ESC>9 that is generated
  117. +   ;; whereever a ~ appears.  Why does this happen???
  118. +   ;; fpb@ittc.wec.com 1/25/89
  119. +   (if (eq system-type 'berkeley-unix)
  120. +       (progn
  121. +     (goto-char (point-min))
  122. +     (while (re-search-forward "\e[789]" nil t)
  123. +       (replace-match ""))))
  124. +   ;; Nuke the dumb reformatting message
  125. +   (if (eq system-type 'berkeley-unix)
  126. +       (progn
  127. +     (goto-char (point-min))
  128. +     (while (re-search-forward "Reformatting page.  Wait... done\n\n" nil t)
  129. +       (replace-match ""))))
  130.   
  131.     ;; Nuke blanks lines at start.
  132.     (goto-char (point-min))
  133.  
  134.  
  135.