Difference between revisions of "Emacs"

From PrattWiki
Jump to navigation Jump to search
(How can I check spelling?)
 
(19 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
|name=Emacs
 
|name=Emacs
 
|byline="Text editor for Linux"
 
|byline="Text editor for Linux"
|image=[[File:Emacs23.png]]
+
|image=[[File:Emacs23.png|200px]]
 
|caption=
 
|caption=
|version=GNU Emacs 21.4.1
+
|version=GNU Emacs 23.1.1
 +
|vdate=2/19/2015
 
|dlocation=
 
|dlocation=
 
|cost = free
 
|cost = free
Line 11: Line 12:
 
|label_color=
 
|label_color=
 
|value_color=
 
|value_color=
|update=8/10/2010
+
|update=8/26/2019
 
|}}
 
|}}
  
Line 29: Line 30:
 
== FAQ ==
 
== FAQ ==
 
=== How can I check spelling? ===
 
=== How can I check spelling? ===
You can use the '''Spell-Check Buffer''' command in the '''Spell Checking''' part of the '''Tools''' menu in emacs.
+
You can use the '''Spell-Check Buffer''' command in the '''Spell Checking''' part of the '''Tools''' menu in emacs.  Once you start spell checking, you have some options for what to do with words that are spelled incorrectly.  The following is an abbreviated version of the instructions from [https://www.gnu.org/software/emacs/manual/html_node/emacs/Spelling.html Spelling] at the GNU web site; items between the lines below are quoted directly from that site.
 
+
<hr>
 +
Here are the valid responses:
 +
; digit
 +
: Replace the word, just this time, with one of the displayed near-misses. Each near-miss is listed with a digit; type that digit to select it.
 +
; <SPC>
 +
: Skip this word—continue to consider it incorrect, but don't change it here.
 +
;r new <RET>
 +
:Replace the word, just this time, with new. (The replacement string will be rescanned for more spelling errors.)
 +
;a
 +
:Accept the incorrect word—treat it as correct, but only in this editing session.
 +
;A
 +
:Accept the incorrect word—treat it as correct, but only in this editing session and for this buffer.
 +
;i
 +
:Insert this word in your private dictionary file so that it will be considered correct from now on, even in future sessions.
 +
;x
 +
:Quit interactive spell-checking and move point back to where it was when you started spell-checking.
 +
;q
 +
:Quit interactive spell-checking and kill the spell-checker subprocess.
 +
;?
 +
:Show the list of options.
 +
<hr>
 
''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:
 
''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)  
 
*go to the Options menu and select Word Wrap in Text Modes (Auto Fill)  
Line 37: Line 58:
  
 
=== How can I change font sizes of the text I am reading? ===
 
=== 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 fonts and sizes.  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 <code>.tex</code> file.
+
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 <code>.tex</code> file.
  
 
=== Highlighting Commands and Parentheses ===
 
=== 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.
+
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 ===
 
=== 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 open the file in emacs, "Save As" a new name, and edit that file insteadJust continue to use the new file.
+
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 <code>ls</code>.  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 <code>#FILE#</code>, answer in the affirmativeNow 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 <code>blahA.tex</code> from that point forward.
 +
 
 +
=== What are the keyboard shortcuts? ===
 +
There is a list at [https://shortcutworld.com/en/Emacs/23.2.1/linux/all https://shortcutworld.com/en/Emacs/23.2.1/linux/all].
  
 
== Questions ==
 
== Questions ==
Line 53: Line 84:
 
<references />
 
<references />
  
[[Category:ECE 141]]
+
[[Category:ECE 382]]
[[Category:EGR 53]]
+
[[Category:EGR 103]]
 +
[[Category:ME 344]]
 
[[Category:Software]]
 
[[Category:Software]]
 
[[Category:Semester Update]]
 
[[Category:Semester Update]]

Latest revision as of 15:47, 3 September 2019

Emacs
"Text editor for Linux"
Emacs 512.png
Version GNU Emacs 23.1.1
Vers. Date 2/19/2015
Cost free
Pundit Updated 8/26/2019


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. Once you start spell checking, you have some options for what to do with words that are spelled incorrectly. The following is an abbreviated version of the instructions from Spelling at the GNU web site; items between the lines below are quoted directly from that site.


Here are the valid responses:

digit
Replace the word, just this time, with one of the displayed near-misses. Each near-miss is listed with a digit; type that digit to select it.
<SPC>
Skip this word—continue to consider it incorrect, but don't change it here.
r new <RET>
Replace the word, just this time, with new. (The replacement string will be rescanned for more spelling errors.)
a
Accept the incorrect word—treat it as correct, but only in this editing session.
A
Accept the incorrect word—treat it as correct, but only in this editing session and for this buffer.
i
Insert this word in your private dictionary file so that it will be considered correct from now on, even in future sessions.
x
Quit interactive spell-checking and move point back to where it was when you started spell-checking.
q
Quit interactive spell-checking and kill the spell-checker subprocess.
?
Show the list of options.

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