[comp.sys.amiga] memacs question

arxt@sphinx.uchicago.edu (patrick palmer) (12/22/88)

Is there a way to force MEMACS to search for an arbritray ascii character -
like a form feed or a carriage return?  I tried making it search for characters
like \013 or \010 but it does not seem to understand.  I tried \044 (comma),
which displays - so I know what is going on - and it does not find this either.
I tried control-M , but this results in no search.  (I did not surround the 
character numbers or names with any marks, because I did not think it 
necessary. ? )

I would be very appreciative of any advice.

Pat Palmer  email: ppalmer@oddjob.uchicago.edu

steveb@cbmvax.UUCP (Steve Beats) (12/22/88)

In article <1218@tank.uchicago.edu> arxt@sphinx.uchicago.edu (patrick  palmer) writes:
>
>Is there a way to force MEMACS to search for an arbritray ascii character -
>like a form feed or a carriage return?  I tried making it search for characters
>like \013 or \010 but it does not seem to understand.  I tried \044 (comma),
>which displays - so I know what is going on - and it does not find this either.
>
When you are entering your search string, type CTRL-q before the non-printing
character you wish to include in the search string.  For instance, the
sequence to search for carriage returns would be:-

	CTRL-s CTRL-q <return> <return>

CTRL-q turns on the quoted character mode for the next character typed.

	Steve

arxt@tank.uchicago.edu (patrick palmer) (05/25/89)

I have been creating files in a wordprocessor (Scribble!), and when the 
file is satisfactory - spelling right, etc, - I  use
memacs to edit in the command lines for amigaTEX.  This might sound
like a perverse way to make files for TEX but I am used to it.  The
problem is that Scribble! (and most wordprocessors) make output so
that each paragraph looks like one long line to the outside
world.  I want to be able to make things look like paragraphs again in memacs.
This is not just to facilitate further editing of the file; sometimes
the long lines end up leaving a space in the text.

On a unix machine, I could use the function fmt to make everything have 
sensible line lenghts again.  Has anyone written such a function for the Amiga?

Or, I could make emacs fill paragraphs (with escape-q in gnu-emacs, I forgot
what in emacs).  I cannot find any way to do this in memacs.  (I even looked at
the manual - well, for a minute or two)  Is there a way to fill paragraphs in
memacs?

Pat Palmer (email: ppalmer@oddjob.uchicago.edu)

thad@cup.portal.com (Thad P Floryan) (05/26/89)

Re: Patrick Palmer's dilemma ...

1) to fill/justify paragraphs in "emacs", use M-Q, which will fill/fold to
   the line length setup by C-X F  (e.g. "C-U number C-X F"  will set the
   fill column to the value represented by "number").

2) back when I was the Technical Editor of Robo City News (RCN), you wouldn't
   believe the bizarre file formats that were presented for review.  I wrote
   the following short program to convert EVERYTHING that came in, and this
   program converted all files just fine for (my and others') review using
   Scribble and for later import into PageSetter for output to the Linotronics.

   Do NOT ask me about why RCN hasn't published for awhile; that, among other
   problems, is why I disassociated myself from them last year; I still "chair"
   the Technical Q&A session at the FAUG meetings and, at least, that real-time
   interaction appears to be a satisfactory compromise for all; among the
   co-moderators are Leo Schwab, Rob Peck, Chuck McManis, and even Jay Miner
   will step in occasionally and help with the answers to some questions.

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

/* FixLF.c
 *
 * This program removes bare 0x0A ('\n' or linefeeds) from a file replacing
 * them with spaces unless the following char is a space or tab.  A pair or
 * more of consecutive linefeeds are left alone.
 *
 * The intent of this program is to "fix" article files for RCN submission
 * that have been prepared with OTHER than PageSetter or Scribble.
 *
 * Syntax:  CLI> FixLF  source.file  destination.file
 *
 * Author: Thad Floryan, 28-Jul-1987
 *
 * Build with Manx 3.4b2 per:
 *
 *	cc FixLF
 *	ln FixLF -lc
 */

#include <stdio.h>

main(argc,argv)
   int argc;
   char *argv[];
{
   int	a;
   int	consec = 0;		/* count of consecutive linefeeds */
   FILE	*input, *output;

   if ( argc != 3 ) exit();	/* exit if command line screwed up */

   if ((output = fopen(argv[2], "w")) == NULL) {                 exit(); }
   if ((input  = fopen(argv[1], "r")) == NULL) { fclose(output); exit(); }

   while ((a = fgetc(input)) != EOF) {
      if (a == '\n') ++consec;
      else {
      	 if (consec > 0) {
	    if (consec == 1)
               if ((a == ' ') || (a == '\t')) fputc('\n', output);
               else fputc(' ', output);
	    else for (; consec > 0; consec--) fputc('\n', output);
	    consec = 0;
	 }
         fputc((char)a, output);
      }
   }
   if (consec > 0) for (; consec > 0; consec--) fputc('\n', output);
   fclose(input);
   fclose(output);
}