4 Editing files and Emacs
out of 20
Post on 03-Jan-2016
DESCRIPTION4 Editing files and Emacs. Editing files The Emacs editor. Editors. Editors are used to create files of text and to modify their contents You need an editor for sending email, writing programs and many other tasks - PowerPoint PPT Presentation
<ul><li><p>4 Editing files and EmacsEditing filesThe Emacs editor</p></li><li><p>EditorsEditors are used to create files of text and to modify their contentsYou need an editor for sending email, writing programs and many other tasksThere are many different editors - vi, ed and emacs are common UNIX examplesThere are different styles of editor - e.g. line editors and text editorsThey are not the same as word processors which are concerned with printed documents (fonts, sizes, etc.)</p></li><li><p>The Emacs EditorA powerful editor, available on most UNIX systemsIts a text editorComplex and extensible - we will only explore a fraction - see tutorial and on-line help facilities for more</p></li><li><p>Emacs conventionsFrequent use of the control and meta keyscontrol key usually marked control or ctrlthe meta key is usually marked altThe notation C-x means hold down the control key and simultaneously press the x key (was ^X in previous lectures)M-y means hold down the meta (alt) key and simultaneously press the y keyIf the alt-y combination is taken by the host operating system (for example Windows), you can press the escape (esc) key, release it, and then press the y key</p></li><li><p>Mini-bufferStatus lineEdit window</p></li><li><p>Starting and quittingFrom the UNIX prompt type emacs or emacs filenameThe emacs screen is divided into three partsedit window - large part where the contents of the file are displayedstatus line - name of file, how far through you are and whether it needs savingminibuffer - where commands are enteredC-x C-c to quit (of course). You may be prompted to save files</p></li><li><p>Moving around the fileYour current position in the file is shown by the cursorMost basic movement is one character or line at a timeuse the arrow keys orC-bbackward (left) one characterC-fforward (right) one characterC-pprevious line (up one character)C-nnext line (down one character)Scrolling happens as necessary</p></li><li><p>Can also move in steps of a word, sentence, paragraphs and screenM-fforwards one wordM-bbackwards one wordC-astart of current lineC-eend of current lineM-astart of current sentenceM-eend of current sentenceC-v scroll down one screenM-vscroll up one screenM-move to end of fileC-l refreshes the screen and centers the cursor.</p></li><li><p>Inserting and deleting textTo insert text, position the cursor and typeType RETURN to enter a new line, otherwise the line will wrap aroundDEL deletes the character before the cursor and C-d the character after the cursor. Hold down for repeated operationM-del and M-d deletes whole words</p></li><li><p>C-k deletes from cursor to end of line. A further C-k deletes the new line characterMark and then delete a whole area:C-SPACE at start and move cursor to end. Make sure you have Active Region Highlighting ticked to see the marked region in color!C-w to delete the marked out regionM-w copies the area without deleting it.Commands that remove more than one character at a time save the text. It can be yanked back with C-yAnother C-y to yank back another copyM-y to yank back next previously deleted textCan use C-w and C-y to move text around</p></li><li><p>File handlingNeed to be able to load and save filesC-x C-f finds and loads a filePrompts for the pathname in the minibufferType the name and press RETURNUse TAB for filename completionFile is either loaded or created</p></li><li><p>Changes made on screen are not immediately made to the file, they are made to a copy called the bufferHave to explicitly write them back by saving, C-x s (all files) C-x C-s (current file) (answer y and n to prompts)Can have more than one file open at a time. C-x C-f also switches between buffers if we give the name of an open buffer.C-x b swaps to the previous bufferSave frequently - work will be lost if emacs or the system crashesPrevious version may be backed up in filename~</p></li><li><p>Undoing mistakesC-x u, C-_, and C-/ undo the previous commandRepeating the undo command takes you further back through the editing history</p></li><li><p>SearchingNeed to search for text in a large fileIncremental searchtype C-s to search forward. Type C-r to search backwardsOr enter command M-x isearch-forward or M-x isearch-backwards in the minibuffer (use TAB for command completion)you can delete the last character in the search stringC-g to quit at any time (this works for any command!)</p></li><li><p>Replacing stringsChange all occurrences of one string of text with anothertype M-x and enter query-replaceOr type M-%enter search and target stringstype y or n at each prompt. ! to replace alluse replace-string to avoid the promptingM-x then spell-buffer for the spell checker</p></li><li><p>WindowsCan divide the edit window into smaller sub-windows, each with a different documentC-x 2 split horizontallyC-x 3split verticallyC-x 1make current window the full windowC-x omove cursor to the next window</p></li><li><p>ModesModes configure emacs for different kinds of editing, controlling wrap-around and indentingM-x then mode namefundamental-modetext-mode (gives automatic text wrapping)c++-modeMay guess mode from the filename suffixUse TAB for autocompletion</p></li><li><p>Help and the tutorialC-h for top level help menuC-h C-h to find out what each menu option meansC-h t for the on-line tutorialA cheatsheet with most of the key combinations in this lecture is in the module folder</p></li><li><p>Coursework 1Deadline: 10th April 4PM.Covers the first three lectures (and the revision lecture)It mentions one simple command we havent seen. Youll have to find out how it works.</p></li><li><p>Next LectureUNIX processesHow to list themHow to prioritise themHow to schedule themParent and Child processesSignalsWhat are they for?Types of signal</p></li></ul>
View more >
ESS – Emacs Speaks Statisticsess.r- 7 Editing objects and functions::::: 39 7.1 Creating or modifying S objects ::::: 39 7.2 Loading source files into the ESS process ...
1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.
Programming with GNU Emacs ?· Running Emacs Lisp GNU Emacs is usually named emacs. This material is…
Emacs editing environment, Part 2: Learn the essential ... editing environment, Part 2: Learn the essential modes and editing features of ... Other major modes are defined by comparison with this one. Type C
Introduction to the Emacs Editor - Wellesley CScs. anderson/writing/emacs/emacs-intro.pdf · Introduction…
Learning GNU Emacs - ?· Preface xvi Why Read This Book? xvi Which Emacs is Which? xviii GNU Emacs and…
Graphics Devices gnuplot Quick Reference Starting Editing The UNIX, MS-DOS and VMS versions of gnuplot support command-line editing and a command history. EMACS style editing is supported.
GNU Emacs Reference Card Motion Multiple Emacs Reference Card (for version 25) Starting Emacs To enter GNU Emacs 25, just type its name: emacs Leaving Emacs suspend Emacs (or iconify it under X) C-z exit Emacs permanently C-x C-c Files read a le into ...
Advanced Linux Programming - ?· with Linux 1 1 Getting Started 3 1.1 Editing with Emacs 4 1.2 Compiling…
Emacs Lisp—Introduction between dates and sunrise/sunset information. Additionally, GNU Emacs has modes that support editing source files for a variety of languages. ... version in C with Mock Lisp as the embedded language. Stallman wrote GNU Emacs as the first step in the GNU project. CSc 372, Fall 2001 Emacs Lisp, Slide 3 ... Comparison operations
Emacs editing environment, Part 5: Shape your Emacs view ?· Emacs editing environment, Part 5: Shape…