Source string Read only

(itstool) path: sect2/para
540/5400
Context English State
Pull-down menus and online help.
Language-dependent syntax highlighting and indentation.
Completely customizable.
You can compile and debug programs within Emacs.
On a compilation error, you can jump to the offending line of source code.
Friendly-ish front-end to the <command>info</command> program used for reading GNU hypertext documentation, including the documentation on Emacs itself.
Friendly front-end to <command>gdb</command>, allowing you to look at the source code as you step through your program.
And doubtless many more that have been overlooked.
Emacs can be installed on FreeBSD using the <package>editors/emacs</package> port.
Once it is installed, start it up and do <literal>C-h t</literal> to read an Emacs tutorial—that means hold down <keycap>control</keycap>, press <keycap>h</keycap>, let go of <keycap>control</keycap>, and then press <keycap>t</keycap>. (Alternatively, you can use the mouse to select <guimenuitem>Emacs Tutorial</guimenuitem> from the <guimenu>Help</guimenu> menu.)
Although Emacs does have menus, it is well worth learning the key bindings, as it is much quicker when you are editing something to press a couple of keys than to try to find the mouse and then click on the right place. And, when you are talking to seasoned Emacs users, you will find they often casually throw around expressions like <quote><literal>M-x replace-s RET foo RET bar RET</literal></quote> so it is useful to know what they mean. And in any case, Emacs has far too many useful functions for them to all fit on the menu bars.
Fortunately, it is quite easy to pick up the key-bindings, as they are displayed next to the menu item. My advice is to use the menu item for, say, opening a file until you understand how it works and feel confident with it, then try doing C-x C-f. When you are happy with that, move on to another menu command.
If you cannot remember what a particular combination of keys does, select <guimenuitem>Describe Key</guimenuitem> from the <guimenu>Help</guimenu> menu and type it in—Emacs will tell you what it does. You can also use the <guimenuitem>Command Apropos</guimenuitem> menu item to find out all the commands which contain a particular word in them, with the key binding next to it.
By the way, the expression above means hold down the <keysym>Meta</keysym> key, press <keysym>x</keysym>, release the <keysym>Meta</keysym> key, type <userinput>replace-s</userinput> (short for <literal>replace-string</literal>—another feature of Emacs is that you can abbreviate commands), press the <keysym>return</keysym> key, type <userinput>foo</userinput> (the string you want replaced), press the <keysym>return</keysym> key, type bar (the string you want to replace <literal>foo</literal> with) and press <keysym>return</keysym> again. Emacs will then do the search-and-replace operation you have just requested.
If you are wondering what on earth <keysym>Meta</keysym> is, it is a special key that many <trademark class="registered">UNIX</trademark> workstations have. Unfortunately, PC's do not have one, so it is usually <keycap>alt</keycap> (or if you are unlucky, the <keysym>escape</keysym> key).
Oh, and to get out of Emacs, do <command>C-x C-c</command> (that means hold down the <keysym>control</keysym> key, press <keysym>x</keysym>, press <keysym>c</keysym> and release the <keysym>control</keysym> key). If you have any unsaved files open, Emacs will ask you if you want to save them. (Ignore the bit in the documentation where it says <command>C-z</command> is the usual way to leave Emacs—that leaves Emacs hanging around in the background, and is only really useful if you are on a system which does not have virtual terminals).
Configuring Emacs
Emacs does many wonderful things; some of them are built in, some of them need to be configured.
Instead of using a proprietary macro language for configuration, Emacs uses a version of Lisp specially adapted for editors, known as Emacs Lisp. Working with Emacs Lisp can be quite helpful if you want to go on and learn something like Common Lisp. Emacs Lisp has many features of Common Lisp, although it is considerably smaller (and thus easier to master).
The best way to learn Emacs Lisp is to download the <link xlink:href="ftp://ftp.gnu.org/old-gnu/emacs/elisp-manual-19-2.4.tar.gz">Emacs Tutorial</link>
However, there is no need to actually know any Lisp to get started with configuring Emacs, as I have included a sample <filename>.emacs</filename>, which should be enough to get you started. Just copy it into your home directory and restart Emacs if it is already running; it will read the commands from the file and (hopefully) give you a useful basic setup.
A Sample <filename>.emacs</filename>
Unfortunately, there is far too much here to explain it in detail; however there are one or two points worth mentioning.
Everything beginning with a <literal>;</literal> is a comment and is ignored by Emacs.
In the first line, the <literal>-*- Emacs-Lisp -*-</literal> is so that we can edit <filename>.emacs</filename> itself within Emacs and get all the fancy features for editing Emacs Lisp. Emacs usually tries to guess this based on the filename, and may not get it right for <filename>.emacs</filename>.
The <keysym>tab</keysym> key is bound to an indentation function in some modes, so when you press the tab key, it will indent the current line of code. If you want to put a <token>tab</token> character in whatever you are writing, hold the <keysym>control</keysym> key down while you are pressing the <keysym>tab</keysym> key.
This file supports syntax highlighting for C, C++, Perl, Lisp and Scheme, by guessing the language from the filename.
Emacs already has a pre-defined function called <function>next-error</function>. In a compilation output window, this allows you to move from one compilation error to the next by doing <command>M-n</command>; we define a complementary function, <function>previous-error</function>, that allows you to go to a previous error by doing <command>M-p</command>. The nicest feature of all is that <command>C-c C-c</command> will open up the source file in which the error occurred and jump to the appropriate line.
We enable Emacs's ability to act as a server, so that if you are doing something outside Emacs and you want to edit a file, you can just type in
<prompt>%</prompt> <userinput>emacsclient <replaceable>filename</replaceable></userinput>
Many Emacs users set their <envar>EDITOR</envar> environment to <literal>emacsclient</literal> so this happens every time they need to edit a file.

Loading…

No matching activity found.

Browse all component changes

Things to check

Multiple failing checks

The translations in several languages have failing checks

Reset

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect2/para
Flags
read-only
Source string location
book.translate.xml:2410
String age
a year ago
Source string age
a year ago
Translation file
books/developers-handbook.pot, string 422