head	2.6;
access;
symbols
	fourth_edition:2.6;
locks
	grog:2.6; strict;
comment	@# @;


2.6
date	2003.03.20.06.55.57;	author grog;	state Exp;
branches;
next	2.5;

2.5
date	2003.03.10.06.53.07;	author grog;	state Exp;
branches;
next	2.4;

2.4
date	2003.01.10.03.20.42;	author grog;	state Exp;
branches;
next	2.3;

2.3
date	2002.10.19.04.27.47;	author grog;	state Exp;
branches;
next	2.2;

2.2
date	2002.10.11.04.23.42;	author grog;	state Exp;
branches;
next	2.1;

2.1
date	97.12.07.08.34.53;	author grog;	state Exp;
branches;
next	1.10;

1.10
date	97.11.27.07.22.05;	author grog;	state Exp;
branches;
next	1.9;

1.9
date	97.11.24.01.25.25;	author grog;	state Exp;
branches;
next	1.8;

1.8
date	97.10.03.03.30.44;	author grog;	state Exp;
branches;
next	1.7;

1.7
date	96.05.23.12.00.47;	author grog;	state Exp;
branches;
next	1.6;

1.6
date	96.05.06.10.12.04;	author grog;	state Exp;
branches;
next	1.5;

1.5
date	95.12.21.11.14.59;	author grog;	state Exp;
branches;
next	1.4;

1.4
date	95.12.09.12.14.18;	author grog;	state Exp;
branches;
next	1.3;

1.3
date	95.11.14.17.12.27;	author grog;	state Exp;
branches;
next	1.2;

1.2
date	95.11.14.13.14.26;	author grog;	state Exp;
branches;
next	1.1;

1.1
date	95.11.10.16.27.40;	author grog;	state Exp;
branches;
next	;


desc
@How to tidy up a manuscript
@


2.6
log
@Add odds and ends from O'Reilly.
@
text
@How to tidy up a source file:

Separate table and figure numbering
- look at toc.

Tables: bold headings.
.TB -> .Table-heading

Bad words:
- adapt[eo]r? -> adapter
- no future: will
- no passive: are, be, is, been, by
- normally no however, generally
- maybe no might, probably, get active, necessarily (thanks, JHC)
  just
  the fact
  gets

- justify C comments (c-mode) to col 30
- justify shell script comments to column 42.
- fewer "Note that"
- 'only' after verb
- which->that
- no dangling references: check this, these
- opposite->converse
- replace -- with ".  "?
- remove ... which defines
- \\ -> \e
- control characters CTRL-M, not ^M
- Less first person (-> you)
- suffices->suffixes

- 2 spaces after periods:
(query-replace-regexp "\\. \\([^ 
]\\)" ".  \\1" nil)

- don't run __ together:
(query-replace-regexp "__" "_\\\\/_" nil)

- untabify

Check indented quotations

-- Indices for authors: search for " ["

check for tabu words:
- source program
- compiler option (->flag)
- portation
- configurability
- pid->Process ID
- i.e, e.g.
- super-user -> superuser
- file name extension->suffix
- Microsoft operating system

Tables: .sp .4v between items
 .ne 10 before
 remove center, 

Remove initial letter highlights (?)

Second level lists; .Ls B "" "\-"

Make sure we have a summary.

-- correct sequence in CW
(query-replace-regexp "\\\\f(CW\\\\s10" "\\\\s10\\\\f(CW" nil)
(query-replace-regexp "\\\\s0\\\\fR" "\\\\fR\\\\s0" nil)


Index stuff:

- F6 indexes all \fI stuff
- check tables
- text in lower case unless good reason
-- repeat section header as index hit
(query-replace-regexp "\\(\\.H. \"\\)\\(.*\\)\"" "\\1\\2\"
.X \"\\2\"" nil)
-- function call from section header.  This may not do what it should.
(query-replace-regexp "H\\(.\\) \"\\(.*\\)\"" "\\1h \"\\2\"
.X \"\\2, function call\"
.X \"function call, \\2\"" nil)
-- Xref for first column of a table
(query-replace-regexp "^\\([^ #\\{}
]+\\)#" ".X \"\\1\"
\\1#" nil)
-- Xref for second column of a table
(query-replace-regexp "\\(^\\.[^#]+#\\)\\([^
#]+\\)#" ".X \"\\2\"
\\1\\2#" nil)

-- add .X "foo, bar" to .X "bar, foo"
(query-replace-regexp "X \"\\(.*\\), \\(.*\\)\"$" "X \"\\1, \\2\"
.X \"\\2, \\1\"" nil)
-- add .X "foo, bar" to .X "bar foo"
(query-replace-regexp "X \"\\([^
,\\]+\\) \\([^
,\\]+\\)\"$" "X \"\\1 \\2\"
.X \"\\2, \\1\"" nil)
-- same without commas, 'command'
(query-replace-regexp "^.X \"\\([^ ,
]+\\) command\"" ".X \"\\1 command\"
.X \"command, \\1\"" nil)
-- remove plurals from index hits
(query-replace-regexp "\\(.X \".*\\)s\"" "\\1\"" nil)

-- refs for well-known structs
(query-replace-regexp "^struct +\\([^ 	;
]+\\)" ".X \"struct, \\1\"
".X \"\\1, struct\"
struct \\1" nil)

Version 1.11:

Put in C shell equivalents to Bourne shell scripts

Version 1.13:

ise -> ize
Xenix -> XENIX

Version 2.0:

Get fonts in tables right for big macros

Version 2.2:

Replace .RS/.RE with .QS/.QE
Get file names for CD-ROM files into appcdrom.

V 2.4

Change .QQE to .QE when new macros become available
check comma  after page number and chapter refs

Change ^' to ^\&'
----------------------------------------

Put mail IDs in CW:
  (query-replace-regexp "(\\(.*@@.*\\))" "(\\\\f(CW\\1\\\\fP)" nil)

Change heading lines:
  (query-replace-regexp "\\.ds h \\(.*\\)$" ".H2 \"\\1\"" nil)

Remove some of the heading junk:
  (replace-string "\\*h
.XS \\n%
\\*(SN \\*h
.XE
.nr h 1
.P
" "" nil)

Remove excess .Ps:

(defun tidy ()
  (interactive)
  (beginning-of-buffer)
  (query-replace-regexp "^\\.NH.*
" "" nil)
  (beginning-of-buffer)
  (query-replace-regexp "\\.P
\\.P" ".P" nil)
  (beginning-of-buffer)
  (query-replace-regexp "\\.P
.H" ".H" nil)
  (beginning-of-buffer)
  (query-replace-regexp ".br
.po 0.75i
.ll 6.0i
.ft C
.LP
.DS L
.ft R
.eo
" ".Ds
" nil)
  (beginning-of-buffer)
  (query-replace-regexp ".ft P
.LP
.br
.po 0.25i
.ll 7.0i
.ft R
" "" nil)
  (beginning-of-buffer)
  (query-replace-regexp "^\\.nr.*
" "" nil) )

Replace "foo"  with

.H4 "foo"
.Pn config-foo
\f(CWfoo\fP

  (query-replace-regexp "^\\(.*\\)$" ".H4 \"\\1\"
.Pn config-\\1
\\\\f(CW\\1\\\\fP" nil)


Change file names to .File:

(defun fixit ()
  (interactive)
  (save-excursion
    (beginning-of-buffer)
    (query-replace-regexp "\\\\fI\\([/~][^\\]+\\)\\\\fP\\([^\\]\\) *" "
.File \\1 \\2
" nil nil nil)
    
    (beginning-of-buffer)
    (query-replace-regexp "\\\\fI\\([/~][^\\]+\\)\\\\fP\\\\. *" "
.File \\1
" nil nil nil)
    
    (beginning-of-buffer)
    (query-replace-regexp "\\\\fI\\([^\\]+\\)\\\\fP\\([^\\]\\) *" "
.Command \\1 \\2
" nil nil nil)
    
    (beginning-of-buffer)
    (query-replace-regexp "\\\\fI\\([^\\]+\\)\\\\fP\\\\. *" "
.Command \\1
" nil nil nil) 
    (beginning-of-buffer)
    (query-replace-regexp "^\\.X \"/.*
" "" nil nil nil)
    ) )

Remove index hits for file names:

(query-replace-regexp "\\.De
\\.L" ".De
.SPUP
.L" nil nil nil)

Put an .Sref round strings.

(query-replace-regexp "\\\\\\*\\[\\([^]]+\\)\\]" "
.Sref \\\\*[\\1] \\\\&
" nil nil nil)

CW widths:

7 pt: 84 chars
8 pt: 74 chars

$Id: totidy,v 2.4 2003/01/10 03:20:42 grog Exp grog $

From CFBSDIV proofread
----------------------

\rg as smaller superscript (done)
\| -> \/:
(query-replace-regexp "\\\\|" "\\\\/" nil nil nil)
filename ->file name (done)
Driver names: \fI
(query-replace-regexp "''\\([.,]\\)" "\\1''" nil nil nil)
In order ->

Don't include chapter titles in xrefs (look for [ch)
Consider changing "since" -> as, because, ...
which->that
(query-replace-regexp "[Vv]ersion" "Release" nil nil nil)
.Tn -> .Fn?
F6: index hits.
; Remove white space at EOL:
(query-replace-regexp "[ 	]+$" "" nil nil nil)
@


2.5
log
@First phase of final draft, stragglers.
@
text
@d264 6
a269 1
which->that@


2.4
log
@Checkpoint 12 January.
@
text
@d6 3
d10 1
a10 1
- adapt[eo]r?
d20 1
a232 53

$Id: totidy,v 2.3 2002/10/19 04:27:47 grog Exp grog $

$Log: totidy,v $
Revision 2.3  2002/10/19 04:27:47  grog
Checkpoint 27 October 2002

Revision 2.1  1997/12/07 08:34:53  grog
Base second edition

Revision 1.10  1997/11/27 07:22:05  grog
Checkin 27 November 1997

Revision 1.9  1997/11/24 01:25:25  grog
Checkin 24 November, first stab at release version

Revision 1.8  1997/10/03 03:30:44  grog
Checkin 3 October

Revision 1.7  1996/05/23 12:00:47  grog
Checkpoint 26 June

# Revision 1.6  1996/05/06  10:12:04  grog
# Minor mods
#
# Revision 1.5  1995/12/21  11:14:59  grog
# Third final draft
#
# Revision 1.4  1995/12/09  12:14:18  grog
# Checkpoint 12 December
#
# Revision 1.3  1995/11/14  17:12:27  grog
# Minor mods
#
# Revision 1.1  1995/11/10  16:27:40  grog
# Initial revision
#
# Revision 2.5  1995/06/03  04:52:38  grog
# Major mods after Andy's review
#
# Revision 2.4  1995/02/03  13:21:06  grog
# Minor mods
#
# Revision 2.3  1995/01/26  16:55:38  grog
# Minor mods
#
# Revision 2.2  1995/01/26  10:43:17  grog
# Minor mods
#
# Revision 2.1  1995/01/09  14:20:45  grog
# Minor mods
#

d249 16
@


2.3
log
@Checkpoint 27 October 2002
@
text
@d3 3
d230 1
a230 1
$Id: totidy,v 2.1 1997/12/07 08:34:53 grog Exp grog $
d233 3
d281 17
@


2.2
log
@Checkpoint 13 October 2002
@
text
@d197 5
a201 1
 (query-replace-regexp "\\\\fI\\(/[^\\]+\\)\\\\fP\\([^\\]\\) *" "
d204 3
a206 2

(query-replace-regexp "\\\\fI\\(/[^\\]+\\)\\\\fP\\\\. *" "
d209 14
a225 2
(query-replace-regexp "^\\.X \"/.*
" "" nil nil nil)
@


2.1
log
@Base second edition
@
text
@d195 16
a210 1
$Id: totidy,v 1.10 1997/11/27 07:22:05 grog Exp grog $
d213 3
@


1.10
log
@Checkin 27 November 1997
@
text
@d195 1
a195 1
$Id: totidy,v 1.9 1997/11/24 01:25:25 grog Exp grog $
d198 3
@


1.9
log
@Checkin 24 November, first stab at release version
@
text
@d90 3
a92 1
(query-replace-regexp "X \"\\(.*\\) \\(.*\\)\"$" "X \"\\1 \\2\"
d98 2
d195 1
a195 1
$Id: totidy,v 1.8 1997/10/03 03:30:44 grog Exp grog $
d198 3
@


1.8
log
@Checkin 3 October
@
text
@d48 1
d191 1
a191 1
$Id: totidy,v 1.7 1996/05/23 12:00:47 grog Exp grog $
d194 3
@


1.7
log
@Checkpoint 26 June
@
text
@d124 2
d190 1
a190 1
$Id: totidy,v 1.6 1996/05/06 10:12:04 grog Exp grog $
d193 3
@


1.6
log
@Minor mods
@
text
@d4 1
d188 1
a188 1
$Id: totidy,v 1.5 1995/12/21 11:14:59 grog Exp grog $
d191 3
@


1.5
log
@Third final draft
@
text
@d87 3
d187 1
a187 1
$Id: totidy,v 1.4 1995/12/09 12:14:18 grog Exp grog $
d190 3
@


1.4
log
@Checkpoint 12 December
@
text
@d79 5
d87 5
d184 1
a184 1
$Id: totidy,v 1.3 1995/11/14 17:12:27 grog Exp grog $
d187 3
@


1.3
log
@Minor mods
@
text
@d80 1
a80 1
(query-replace-regexp "XX \"\\(.*\\), \\(.*\\)\"$" "XX \"\\1, \\2\"
d174 1
a174 1
$Id: totidy,v 1.1 1995/11/10 16:27:40 grog Exp grog $
d177 3
@


1.2
log
@Minor mods
@
text
@@


1.1
log
@Initial revision
@
text
@d69 6
a74 6
(query-replace-regexp "\\(\\.[ABC]h \"\\)\\(.*\\)\"" "\\1\\2\"
.XX \"\\2\"" nil)
-- function call from section header
(query-replace-regexp "\\([ABC]\\)h \"\\(.*\\)\"" "\\1h \"\\2\"
.XX \"\\2, function call\"
.XX \"function call, \\2\"" nil)
d77 1
a77 1
]+\\)#" ".XX \"\\1\"
d79 1
a79 1
-- add .XX "foo, bar" to .XX "bar, foo"
d81 1
a81 1
.XX \"\\2, \\1\"" nil)
d84 2
a85 2
]+\\)" ".XX \"struct, \\1\"
".XX \"\\1, struct\"
d112 2
a113 1
$Id: totidy,v 2.5 1995/06/03 04:52:38 grog Exp grog $
d115 61
d177 3
@
