home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 32.9 Unset PWD Before Using Emacs Chapter 32
GNU Emacs
Next: 32.11 Using Word Abbreviation Mode

32.10 Inserting Binary Characters into Files

I remember being driven absolutely crazy by a guy (who hopefully won't read this) who called me every other week and asked me how to stick a page break into some text file he was writing. He was only printing on a garden-variety daisy wheel printer, for which inserting a page break is a simple matter: just add a formfeed character, CTRL-l. But CTRL-l already means something to Emacs ("redraw the screen"). How do you get the character into your file, without Emacs thinking that you're typing a command?

Simple. Precede CTRL-l with the "quoting" command, CTRL-q. CTRL-q tells Emacs that the next character you type is text, not a part of some command. So the sequence CTRL-q CTRL-l inserts the character CTRL-l into your file; you'll see ^L on your screen. (Note that this represents a single character, instead of two characters.) In turn, when you print the file on a daisy wheel printer, the CTRL-l will cause a page eject at the appropriate point.

You can use this technique to get any "control character" into an Emacs file. In fact, under pressure I've done some pretty bizarre binary editing - not a task I'd recommend, but certainly one that's possible.

- ML

Previous: 32.9 Unset PWD Before Using Emacs UNIX Power Tools Next: 32.11 Using Word Abbreviation Mode
32.9 Unset PWD Before Using Emacs Book Index 32.11 Using Word Abbreviation Mode

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System