Emacs: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
(Undo revision 217042 by 58.19.24.173 (Talk))
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Linux software}}
This page collects information on working with Emacs specifically on the XO.
*This page collects information on working with Emacs specifically on the XO.
*Emacs is an extensible text-editor, customizable through Emacs [[Lisp]]
*It runs from the terminal, not from within the Sugar desktop, so is mainly of use to developers.
*For general Emacs information, please see http://www.gnu.org/software/emacs/, http://en.wikipedia.org/wiki/Emacs or http://www.emacswiki.org/


== What is Emacs? ==
= How do I install Emacs? =
== Easy ==
Emacs is a text-editor and development environment, most likely of interest to developers.
enter the [[Terminal Activity]] and type

For general Emacs information, please see http://www.gnu.org/software/emacs/ or http://en.wikipedia.org/wiki/Emacs

== How do I install Emacs? ==
enter the Terminal activity and type
su
su
yum install emacs
yum install emacs
as found [http://bc.tech.coop/blog/080128.html here]
as found [http://bc.tech.coop/blog/080128.html here]


== What about alternatives? ==
== XFT Emacs ==

* ''vi'' should already be available through the Terminal activity.
This provices nice readable fonts, with an emacs that runs in its own window.
* Install [http://www.mtxia.com/fancyIndex/Tools/Editors/MicroEMACS/ MicroEMACS] by copying [http://www.mtxia.com/fancyIndex/Tools/Editors/MicroEMACS/me404linux.bin this file] to the laptop.

* [http://zile.sourceforge.net/ Zile] may be closer to what you expect from Emacs. Install [ftp://rpmfind.net/linux/fedora/extras/6/i386/zile-2.2.19-1.fc6.i386.rpm this rpm file] to get it.
=== Easy install from rpm packages ===

You can install the YUM repository hosted by Chip Coldwell, Redhat’s Emacs maintainer, and then update from there.

rpm -ivh http://people.redhat.com/coldwell/emacs/repo/fedora/emacs-release-23-1.fc8.noarch.rpm
yum update emacs

=== Install from latest CVS sources ===

You need about 400 MB free for this; if you use SD/USB memory card/stick, you only need about 60MB free. NOTE: USB key must be Ext NOT Fat because Fat doesn't support the long filenames used in emacs cvs source dir.

sudo yum install texinfo gcc make cvs gtk2-devel libXpm-devel libjpeg-devel libpng-devel libungif-devel libtiff-devel librsvg2-devel dbus-devel
#cd to SD or USB key and do su if you are using external storage.
sudo cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs
cd emacs
./configure --with-x-toolkit --with-xft
make bootstrap
make
sudo make install

#Edit .Xresources:
sudo nano ~/.Xresources
#add to end of file:
#emacs.FontBackend: xft
#save

=== Using the XFT emacs ===

The default font sizes are fairly small on the XO screen. You can start emacs with a font name and size:

emacs --font 'Dejavu Sans Mono-8'

Or put in your .emacs:

(set-default-font "Dejavu Sans Mono-8")

More notes on this version are available at the [http://www.emacswiki.org/emacs-en/XftGnuEmacs EmacsWiki].

And some more alternative at http://www.emacswiki.org/emacs-en/EmacsCvsAndFedora

= Running Emacs =
== If installed with yum ==

Since Emacs was installed from the terminal, and not as an activity, it must be started from the terminal.

emacs -nw

will start Emacs in text mode. You can skip the <tt>-nw</tt> parameter to start in windowed mode, but the bit-map fonts are difficult to read on the native XO screen.

=== "Font is not defined" error ===

If you can't start Emacs in windowed mode and get an error saying "Font `-adobe-courier-medium-r-*-*-12-120-75-75-*-*-*-*' is not defined" you can fix that by editing the file /usr/share/X11/app-defaults/Emacs. Remove the line with the font name.

== If installed with CVS ==
You can run emacs normally with the

emacs

command.

= Keybindings =
Certain key-combinations are reserved by Sugar. Almost all of the function keys, and others. See [[Keyboard_Shortcuts]] for more.

Instructions for re-mapping, or alternatives can be found at http://olpcnews.com/forum/index.php?topic=1449.0

If a <Ctrl-key> combination is reserved, pressing <Esc-Esc key> (not a key-chord, but Escape twice, followed by the key) should work.


= Info and other documentation =
If you installed via [[Yum]], Info pages are [[Yum#Documentation|excluded by default]].

For any packages or utilities you install, you may need to manually add their info files to the [http://www.gnu.org/software/hello/manual/texinfo/Other-Info-Directories.html Infopath].

This may also extend to the "raw" elisp files in the basic package -- there are no .el files in /usr/share/emacs/22.1/lisp/ -- all I can find are .elc files -- [[User:OtherMichael|OtherMichael]] 01:46, 20 July 2008 (UTC)

= Python mode =
*http://www.emacswiki.org/cgi-bin/wiki/PythonMode
*http://sourceforge.net/projects/python-mode/
*http://thegrout.blogspot.com/2008/03/emacs-python-cheatsheet.html


= Alternatives =
* see [[TextEditor]]



== See Also ==
= See Also =
:''[[LISP]]''
*[[LISP]]
*http://www.timthelion.com/cgi-bin/blosxom.cgi/emacs-olpc.writeback - basic installation notes, plus configuration files to use Emacs in the ebook mode

Latest revision as of 19:55, 17 September 2009

This command is run in the standard Linux environment via the Terminal Activity. The GUI will probably not integrate comfortably with the XO Laptop's Sugar environment. Your user experience may vary considerably depending on the established environment and the other programs running on the laptop, may need re-installation after an OS Update. See the Linux software category for other commands.

How do I install Emacs?

Easy

enter the Terminal Activity and type

su
yum install emacs

as found here

XFT Emacs

This provices nice readable fonts, with an emacs that runs in its own window.

Easy install from rpm packages

You can install the YUM repository hosted by Chip Coldwell, Redhat’s Emacs maintainer, and then update from there.

 rpm -ivh http://people.redhat.com/coldwell/emacs/repo/fedora/emacs-release-23-1.fc8.noarch.rpm
 yum update emacs

Install from latest CVS sources

You need about 400 MB free for this; if you use SD/USB memory card/stick, you only need about 60MB free. NOTE: USB key must be Ext NOT Fat because Fat doesn't support the long filenames used in emacs cvs source dir.

 sudo yum install texinfo gcc make cvs gtk2-devel libXpm-devel libjpeg-devel libpng-devel libungif-devel libtiff-devel librsvg2-devel dbus-devel
 #cd to SD or USB key and do su if you are using external storage.
 sudo cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs
 cd emacs
 ./configure --with-x-toolkit --with-xft
 make bootstrap
 make
 sudo make install
 #Edit .Xresources:
 sudo nano ~/.Xresources
 #add to end of file:
 #emacs.FontBackend: xft
 #save

Using the XFT emacs

The default font sizes are fairly small on the XO screen. You can start emacs with a font name and size:

  emacs --font 'Dejavu Sans Mono-8'

Or put in your .emacs:

  (set-default-font "Dejavu Sans Mono-8")

More notes on this version are available at the EmacsWiki.

And some more alternative at http://www.emacswiki.org/emacs-en/EmacsCvsAndFedora

Running Emacs

If installed with yum

Since Emacs was installed from the terminal, and not as an activity, it must be started from the terminal.

emacs -nw

will start Emacs in text mode. You can skip the -nw parameter to start in windowed mode, but the bit-map fonts are difficult to read on the native XO screen.

"Font is not defined" error

If you can't start Emacs in windowed mode and get an error saying "Font `-adobe-courier-medium-r-*-*-12-120-75-75-*-*-*-*' is not defined" you can fix that by editing the file /usr/share/X11/app-defaults/Emacs. Remove the line with the font name.

If installed with CVS

You can run emacs normally with the

 emacs

command.

Keybindings

Certain key-combinations are reserved by Sugar. Almost all of the function keys, and others. See Keyboard_Shortcuts for more.

Instructions for re-mapping, or alternatives can be found at http://olpcnews.com/forum/index.php?topic=1449.0

If a <Ctrl-key> combination is reserved, pressing <Esc-Esc key> (not a key-chord, but Escape twice, followed by the key) should work.


Info and other documentation

If you installed via Yum, Info pages are excluded by default.

For any packages or utilities you install, you may need to manually add their info files to the Infopath.

This may also extend to the "raw" elisp files in the basic package -- there are no .el files in /usr/share/emacs/22.1/lisp/ -- all I can find are .elc files -- OtherMichael 01:46, 20 July 2008 (UTC)

Python mode


Alternatives


See Also