ray@MAXWELL.PHYSICS.PURDUE.EDU (Ray Moody) (08/15/89)
I would like to suggest a change to man.el. The current version is not able to nuke the page footers on ISI systems because the footer does not match any of the patterns man.el looks for. I don't think adding a pattern for each and every version of UNIX available is a good idea. I think I have a more general approach. I look for a page footer just before a page header and also at the end of the manpage. It works everywhere I have tested it. It does depend on the top and bottom page margin being the same everywhere, but I think that is a safe bet. Also, you won't get any more random blank lines. The current version inserts a blank line at every page break -- even if this blank line is in the middle of a sentence. Ray ------------------------------------------------------------------------------- RCS file: RCS/man.el,v retrieving revision 18.54 diff -c -r18.54 man.el *** /tmp/,RCSt1010515 Mon Aug 14 18:29:41 1989 --- man.el Mon Aug 14 18:00:45 1989 *************** *** 93,98 ;; Hint: BS stands form more things than "back space" (defun nuke-nroff-bs () (interactive "*") ;; Nuke underlining and overstriking (only by the same letter) (goto-char (point-min)) (while (search-forward "\b" nil t) --- 93,110 ----- ;; Hint: BS stands form more things than "back space" (defun nuke-nroff-bs () (interactive "*") + ;; Nuke headers: "MORE(1) UNIX Programmer's Manual MORE(1)" + ;; We expext to find a footer just before the header except at the beginning. + (goto-char (point-min)) + (while (re-search-forward "^ *\\([A-Za-z][-_A-Za-z0-9]*([0-9A-Z]+)\\).*\\1$" nil t) + (let (start end) + (setq start (save-excursion (forward-line -10) (point))) + (setq end (save-excursion (forward-line 4) (point))) + (delete-region start end))) + ;; Catch the final footer. + (goto-char (point-max)) + (delete-region (point) (save-excursion (forward-line -7) (point))) + ;; Nuke underlining and overstriking (only by the same letter) (goto-char (point-min)) (while (search-forward "\b" nil t) *************** *** 107,136 ((= following ?\_) ;; \b_ (delete-region (1- (point)) (1+ (point))))))) - - ;; Nuke headers: "MORE(1) UNIX Programmer's Manual MORE(1)" - (goto-char (point-min)) - (while (re-search-forward "^ *\\([A-Za-z][-_A-Za-z0-9]*([0-9A-Z]+)\\).*\\1$" nil t) - (replace-match "")) - - ;; Nuke footers: "Printed 12/3/85 27 April 1981 1" - ;; Sun appear to be on drugz: - ;; "Sun Release 3.0B Last change: 1 February 1985 1" - ;; HP are even worse! - ;; " Hewlett-Packard -1- (printed 12/31/99)" FMHWA12ID!! - ;; System V (well WICATs anyway): - ;; "Page 1 (printed 7/24/85)" - ;; Who is administering PCP to these corporate bozos? - (goto-char (point-min)) - (while (re-search-forward - (cond ((eq system-type 'hpux) - "^[ \t]*Hewlett-Packard\\(\\| Company\\)[ \t]*- [0-9]* -.*$") - ((eq system-type 'usg-unix-v) - "^ *Page [0-9]*.*(printed [0-9/]*)$") - (t - "^\\(Printed\\|Sun Release\\) [0-9].*[0-9]$")) - nil t) - (replace-match "")) ;; Crunch blank lines (goto-char (point-min)) --- 119,124 ----- ((= following ?\_) ;; \b_ (delete-region (1- (point)) (1+ (point))))))) ;; Crunch blank lines (goto-char (point-min))