Emacs

From PrattWiki
Revision as of 00:21, 10 January 2018 by DukeEgr93 (talk | contribs)
Jump to navigation Jump to search
Emacs
"Text editor for Linux"
Emacs 512.png
Version GNU Emacs 23.1.1
Vers. Date 2/19/2015
Cost free
Pundit Updated 1/9/2018


Emacs is a text-editing package, and it is available for free on the public computing systems running Linux.

Running emacs

To run emacs, simply type

emacs &

at the command prompt. The & will allow emacs to run in the background, keeping the command line available for future commands. You can also type

emacs FILENAME &

where FILENAME is either the name of an existing file or the name of a new file you want to create.

FAQ

How can I check spelling?

You can use the Spell-Check Buffer command in the Spell Checking part of the Tools menu in emacs.

Important: the spell checker in emacs does not like really really long lines of text - it will in fact skip over them. To solve this, you either need to hit return in long lines or set emacs up to do word wrap. The easiest way to do this is, once the file is open, see if the word "Fill" is in the gutter of emacs. If not, you need to turn auto word wrap on in one of the following ways:

  • go to the Options menu and select Word Wrap in Text Modes (Auto Fill)
  • hit "ESC-x" then type auto-fill-mode in the gutter and hit return

from there on out, any long lines you type will wrap. If you already have long lines, go to the end of that line and type a space - the whole line should auto-wrap. Re-save the work and spell check it from there.

How can I change font sizes of the text I am reading?

Hold the shift button then click the left mouse button; a font menu will come up and you can change the buffer text size. Note: you should not change the window size before changing the font size; change the font size first, then resize the window if need be. Also note that this does not change the font in LaTeX at all, just the font you are viewing while editing the .tex file.

Highlighting Commands and Parentheses

Two of the most useful features in Emacs are Options:Syntax Highlighting and Options:Paren Highlighting. The former will alter the appearance of commands in LaTeX to set them off from regular text. The latter will show you the matching delimiter when the cursor is next to a bracket or parenthesis. If you want to make the change permanent, be sure to go to Options->Save Options before closing emacs. In newer Emacs installations, the Syntax Highlighting is there by default and is no longer selectable.

The editor says my file is locked

If editor says your file is locked by Teer23 (or some other machine) and you can't save, that generally means you either left the file open somewhere or a computer crashed while you were editing. Emacs will automatically "lock" the file when you are editing it to make sure you don't edit it two places at once.

  • The easiest solution is to click in the small window at the bottom where emacs is telling you the file is locked and type s for steal. You will now be able to edit the file.
  • If that doesn't work, list the files with ls. There is probably a version of your FILE called #FILE# (that is, the filename surrounded by hash tags). Close emacs, then in Unix carefully type
rm -i #FILE#
and if you are asked if you want to delete #FILE#, answer in the affirmative. Now try to open the file again.
  • If that doesn't work, make a new copy of the file adding some letter to the end; for instance:
cp blah.tex blahA.tex
and edit and use blahA.tex from that point forward.

What are the keyboard shortcuts?

There is a list at https://shortcutworld.com/en/Emacs/23.2.1/linux/all.

Questions

Post your questions by editing the discussion page of this article. Edit the page, then scroll to the bottom and add a question by putting in the characters *{{Q}}, followed by your question and finally your signature (with four tildes, i.e. ~~~~). Using the {{Q}} will automatically put the page in the category of pages with questions - other editors hoping to help out can then go to that category page to see where the questions are. See the page for Template:Q for details and examples.

External Links

References