🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99934

Re: Manual Page

#99934
From: Tad Guy
Date: Fri, 06 Apr 1990 20:56
169 lines
6555 bytes
In article <9004052251.AA19736@zurich.ai.mit.edu> arthur@ZURICH.AI.MIT.EDU (Arthur Gleckler) writes:
> it's nice to see more than one manual page at a time, but to do that
> requires renaming the *Manual Entry* buffer each time before running
> Man again.  ...
> 
> Of course, it would be completely in the Emacs tradition to make a
> flag that determines whether Emacs makes a new buffer each time or
> reuses the old one. ... In the final analysis, though, any change
> along these lines will be trivial but result in Man being nicer.

This patch changes the behavior of M-x manual-entry to reuse (when
possible) a old buffer containing the manual page requested.  It saves
each manual page generated in a different buffer (as you suggested),
selecting an old buffer instead of reformatting a previously-seen
manual page.  

If the old buffer doesn't exist, it works much as before...

	...tad

*** /tmp/,RCSt1a24179	Fri Apr  6 16:48:59 1990
--- man.el	Fri Apr  6 16:48:51 1990
***************
*** 29,94 ****
  				     (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)
!       (message "Looking for formatted entry for %s%s..."
! 	       topic (if section (concat "(" section ")") ""))
!       (let ((dirlist manual-formatted-dirlist)
! 	    (case-fold-search nil)
! 	    name)
! 	(if (and section (or (file-exists-p
! 			       (setq name (concat manual-formatted-dir-prefix
! 						  (substring section 0 1)
! 						  "/"
! 						  topic "." section)))
! 			     (file-exists-p
! 			       (setq name (concat manual-formatted-dir-prefix
! 						  section
! 						  "/"
! 						  topic "." section)))))
! 	    (insert-man-file name)
! 	  (while dirlist
! 	    (let* ((dir (car dirlist))
! 		   (name1 (concat dir "/" topic "."
! 				  (or section
! 				      (substring
! 					dir
! 					(1+ (or (string-match "\\.[^./]*$" dir)
  						-2))))))
! 		   completions)
! 	      (if (file-exists-p name1)
! 		  (insert-man-file name1)
! 		(condition-case ()
  		    (progn
! 		      (setq completions (file-name-all-completions
! 					 (concat topic "." (or section ""))
! 					 dir))
! 		      (while completions
! 			(insert-man-file (concat dir "/" (car completions)))
! 			(setq completions (cdr completions))))
! 		  (file-error nil)))
! 	      (goto-char (point-max)))
! 	    (setq dirlist (cdr dirlist)))))
  
!       (if (= (buffer-size) 0)
! 	  (progn
! 	    (message "No formatted entry, invoking man %s%s..."
! 		     (if section (concat section " ") "") topic)
! 	    (if section
! 		(call-process manual-program nil t nil section topic)
! 	        (call-process manual-program nil t nil topic))
! 	    (if (< (buffer-size) 80)
! 		(progn
! 		  (goto-char (point-min))
! 		  (end-of-line)
! 		  (error (buffer-substring 1 (point)))))))
! 
!       (message "Cleaning manual entry for %s..." topic)
!       (nuke-nroff-bs)
!       (set-buffer-modified-p nil)
!       (message ""))))
  
  ;; Hint: BS stands form more things than "back space"
  (defun nuke-nroff-bs ()
--- 29,106 ----
  				     (match-end 2))
  	    topic (substring topic (match-beginning 1)
  				   (match-end 1))))
!   (let ((bufname (if section
! 		     (format "*%s(%s)-manual*" topic section)
! 		   (format "*%s-manual*" topic))))
!     (set-buffer (get-buffer-create bufname))
!     (if (> (buffer-size) 0)
! 	(save-excursion
! 	  (switch-to-buffer-other-window bufname)
! 	  (other-window 1))
!       (with-output-to-temp-buffer bufname
! 	(buffer-flush-undo standard-output)
! 	(save-excursion
! 	  (set-buffer standard-output)
! 	  (message "Looking for formatted entry for %s%s..."
! 		   topic (if section (concat "(" section ")") ""))
! 	  (let ((dirlist manual-formatted-dirlist)
! 		(case-fold-search nil)
! 		name)
! 	    (if (and section (or (file-exists-p
! 				  (setq name 
! 					(concat manual-formatted-dir-prefix
! 						(substring section 0 1)
! 						"/"
! 						topic "." section)))
! 				 (file-exists-p
! 				  (setq name 
! 					(concat manual-formatted-dir-prefix
! 						section
! 						"/"
! 						topic "." section)))))
! 		(insert-man-file name)
! 	      (while dirlist
! 		(let* ((dir (car dirlist))
! 		       (name1 (concat dir "/" topic "."
! 				      (or section
! 					  (substring
! 					   dir
! 					   (1+ (or 
! 						(string-match "\\.[^./]*$" dir)
  						-2))))))
! 		       completions)
! 		  (if (file-exists-p name1)
! 		      (insert-man-file name1)
! 		    (condition-case ()
! 			(progn
! 			  (setq completions (file-name-all-completions
! 					     (concat topic "." (or section ""))
! 					     dir))
! 			  (while completions
! 			    (insert-man-file 
! 			     (concat dir "/" (car completions)))
! 			    (setq completions (cdr completions))))
! 		      (file-error nil)))
! 		  (goto-char (point-max)))
! 		(setq dirlist (cdr dirlist)))))
! 
! 	  (if (= (buffer-size) 0)
! 	      (progn
! 		(message "No formatted entry, invoking man %s%s..."
! 			 (if section (concat section " ") "") topic)
! 		(if section
! 		    (call-process manual-program nil t nil section topic)
! 		  (call-process manual-program nil t nil topic))
! 		(if (< (buffer-size) 80)
  		    (progn
! 		      (goto-char (point-min))
! 		      (end-of-line)
! 		      (error (buffer-substring 1 (point)))))))
  
! 	  (message "Cleaning manual entry for %s..." topic)
! 	  (nuke-nroff-bs)
! 	  (set-buffer-modified-p nil)
! 	  (message ""))))))
  
  ;; Hint: BS stands form more things than "back space"
  (defun nuke-nroff-bs ()
Technical Details
Message-ID: <TADGUY.90Apr6165629@abcfd20.larc.nasa.gov>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!think!samsung!uakari.primate.wisc.edu!ames!xanth!abcfd01.larc.nasa.gov!tadguy
References: <9004052251.AA19736@zurich.ai.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,f226b7cec9f76426
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-04-06 13:56:29 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!think!samsung!uakari.primate.wisc.edu!ames!xanth!abcfd01.larc.nasa.gov!tadguy
From: tadguy@abcfd01.larc.nasa.gov (Tad Guy)
Newsgroups: gnu.emacs.bug
Subject: Re: Manual Page
Message-ID: <TADGUY.90Apr6165629@abcfd20.larc.nasa.gov>
Date: 6 Apr 90 20:56:29 GMT
References: <9004052251.AA19736@zurich.ai.mit.edu>
Sender: news@cs.odu.edu
Distribution: gnu
Organization: NASA/Langley Research Center, Hampton, VA
Lines: 169
Posted: Fri Apr  6 21:56:29 1990
In-reply-to: arthur@ZURICH.AI.MIT.EDU's message of 5 Apr 90 22:51:08 GMT