[gnu.emacs] M-X manual-entry

mrd@sun.soe.clarkson.edu (Mike DeCorte) (09/29/88)

M-X manual-entry does not work all of the time.  It often leave control
characters in the text.  A quick fix is

M-! man _____ | col -b

but this shouldn't really be necessary or am I missing something.

thankyou


--

Michael DeCorte // (315)268-2292 // P.O. Box 652, Potsdam, NY 13676
Internet mrd@sun.soe.clarkson.edu  // Bitnet   mrd@clutx.bitnet        
------------------------------------------------------------
Clarkson Archiver Server
archiver-server@sun.soe.clarkson.edu
archive-server%sun.soe.clarkson.edu@omnigate.bitnet
dumb1!dumb2!dumb3!smart!sun.soe.clarkson.edu!archive-server
------------------------------------------------------------

mdb@silvlis.com (Mark D. Baushke) (09/30/88)

>  Date: 29 Sep 88 15:14:20 GMT
>  From: mrd@sun.soe.clarkson.edu  (Mike DeCorte)
>  To: info-gnu-emacs@prep.ai.mit.edu
>  
>  M-X manual-entry does not work all of the time.  It often leave control
>  characters in the text.  A quick fix is
>  
>  M-! man _____ | col -b
>  
>  but this shouldn't really be necessary or am I missing something.

Well, you did not mention which version of GNU Emacs you are running
or which hardware and OS you are using, or which man pages you found
the problem in...you also sent your "bug report" to the "info" list
instead of the bug-gnu-emacs@prep.ai.mit.edu list (or gnu.emacs.bug
news group).

Since the original was sent to the info-gnu-emacs list, I am replying
to that list. Apologies in advance to those who do not care about
this. Please direct any follow-up to bug-gnu-emacs.

I have observed the problem you describe. This behavior is present in
GNU Emacs 18.49, 18.51, and 18.52 (and probably earlier versions as
well). 

Under SunOS 3.{3,4,5} (Sun 3/{50,60,160,260} hardware), if a "man csh"
is done, the "control characters left" are ESC followed by one of 7,
8, or 9.

Your solution works since the "col -b" handles the ESC (033) followed
by one of 7, 8, 9, SI (016), SO (017), and VT (013). However, I have
not found any occurences of ESC SI, ESC SO, or ESC VT, in the man
pages...so I have not bothered about them.

The below patches get rid of the ESC 7, ESC 8, and ESC 9 characters,
as well as adding a new bit of functionality to allow a manual entry
buffer to be named "*TOPIC Manual Entry*" (where TOPIC is the topic
passed to manual entry) instead of "*Manual Entry*".  This means that
you can have more than one man page buffer laying around at a time (I
have found this very handy).

The following patch should work (with some lines offset) on any
version of man.el since 18.49.

*** dist-18.52/lisp/man.el	Sun May  8 12:23:13 1988
--- gnuemacs/lisp/man.el	Fri Sep 16 16:40:49 1988
***************
*** 18,23 ****
--- 18,28 ----
  ;; file named COPYING.  Among other things, the copyright notice
  ;; and this notice must be preserved on all copies.
  
+ (defconst manual-entry-prefix-topic t "\
+ *Non-nil means M-x manual-entry should output the manual entry for TOPIC into
+  a buffer named *TOPIC Manual Entry*, otherwise, it should name the buffer
+  *Manual Entry*.")
+ 
  (defun manual-entry (topic &optional section)
    "Display the Unix manual entry for TOPIC.
  TOPIC is either the title of the entry, or has the form TITLE(SECTION)
***************
*** 29,35 ****
  				     (match-end 2))
  	    topic (substring topic (match-beginning 1)
  				   (match-end 1))))
!   (with-output-to-temp-buffer "*Manual Entry*"
      (buffer-flush-undo standard-output)
      (save-excursion
        (set-buffer standard-output)
--- 34,44 ----
  				     (match-end 2))
  	    topic (substring topic (match-beginning 1)
  				   (match-end 1))))
! ;; (with-output-to-temp-buffer "*Manual Entry*" ;; original line
!   (with-output-to-temp-buffer	    	    	;; added by mdb
!       (if manual-entry-prefix-topic 	    	;; added by mdb
! 	  (concat "*" topic " Manual Entry*")	;; added by mdb
! 	"*Manual Entry*")  	    	    	;; added by mdb
      (buffer-flush-undo standard-output)
      (save-excursion
        (set-buffer standard-output)
***************
*** 131,136 ****
--- 140,151 ----
  		  "^\\(Printed\\|Sun Release\\) [0-9].*[0-9]$"))
  	   nil t)
      (replace-match ""))
+ 
+   ;; Zap ESC7,  ESC8, and ESC9
+   ;; This is for Sun man pages like "man 1 csh"
+   (goto-char (point-min))
+   (while (re-search-forward "\e[789]" nil t)
+     (replace-match ""))
  
    ;; Crunch blank lines
    (goto-char (point-min))

Enjoy!
------------------------------------------------------------------------------
Mark D. Baushke                 Internet:    mdb%silvlis.com@sun.com
Silvar-Lisco, Inc.              Nameservers: mdb@silvlis.com
1080 Marsh Road                 Usenet:      {pyramid,sun}!silvlis!mdb
Menlo Park, CA 94025-1053       Telephone:   +1 415 853-6411 / +1 415 969-8328