Emacs is a text editor, and much more. XEmacs provides a comprehensive environment where you can edit source code, or multiple text files, read mail or news, and even edit files remotely using FTP.
There exist many variants: The most popular ones are Xemacs and GNU emacs
Warning: Emacs is very powerful, but since it was born before Windows (or even MS-DOS), shortcuts are not the same. Also it is geared towards speed. The typical emacs user doesn't not want time-consuming pop dialogs, but you dialog though a little minibuffer window. That's stuff you have to learn. Else forget it. When you install Emacs there is a tutorial (Hit the help button) and do it at least 10 times ;)
See also: Text editor
(Some tips regarding formats discussed in this wiki)
Some essential customization
E.g. setting the default directory, aspell directory, initial buffer properties, etc.
(setq default-directory "c:/") (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(case-fold-search t) '(current-language-environment "UTF-8") '(inhibit-startup-screen t) '(initial-major-mode (quote text-mode)) '(initial-scratch-message nil) '(ispell-alternate-dictionary "c:/Program Files/Aspell/dict") '(ispell-complete-word-dict "c:/Program Files/Aspell/dict") '(ispell-program-name "c:/Program Files/Aspell/bin/aspell.exe") '(longlines-show-hard-newlines t) '(longlines-wrap-follows-window-size t) '(temporary-file-directory "c:/tmp") '(transient-mark-mode (quote identity)))
Can be very difficult for a beginner.
However, for older emacsen try ELPA, a friendly package manager
- Installing it requires copy/paste a few lines of code into the *scratch* buffer, then hit CTRL-X CTRL-E
- The Package Manager is available in the Options menu. Type 'h' for help.
Try to install emacs-24 (2012). It does have an integrated package manager.
Back in time, we used to have fairly useful and productive HTML help modes. E.g. in the '90s hm-html-help-mode (or something like that) and then the PSGML mode. The latter did not support very well initial creation of a page, but could provide help for any kind of HTML/XHTML DTD (since PSGML is an SGML/XML editor mode). In later versions of Gnu Emacs, both extensions are not included by default and have to be installed and configured.
For PSGML (still one of the best DTD-based XML editors around), insert at least the following in your .emacs. There are endless other options....
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) (autoload 'xml-mode "psgml" "Major mode to edit SGML files." t) (setq sgml-set-face t sgml-indent-data t sgml-auto-activate-dtd t) (defun go-bind-markup-menu-to-mouse3 () (define-key sgml-mode-map [mouse-3] 'sgml-tags-menu) (define-key sgml-mode-map [shift-mouse-3] 'sgml-attrib-menu) ) ;; change key binding whenever psgml mode is invoked (add-hook 'sgml-mode-hook 'go-bind-markup-menu-to-mouse3) (add-hook 'xml-mode-hook 'go-bind-markup-menu-to-mouse3)
PSGML is a must have extension if you work a lot with XML DTD's of various sorts. Modern distributions of Gnu Emacs don't include PSGML since they favor the Relax (rng) schema language and make the nxml extension the default XML editor. Support for HTML isn't satisfactory, e.g. nxml-based HTML editing is much too time consuming to use unless you do some heavy configuration work. However, readon ! There is a good HTML extension that is based on nxml.
- Download from http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
- Watch the tutorials There is no manual, if you don't watch the tutorials, you will be lost ! (... not that much suffering for getting a good extension).
Under Windows (tested with Emacs 32.2 win 7 64bit)
- Unpack to the emacs installation directory, e.g.
- Add to your ~/.emacs
- This file typically sits in c:/Users/xxx/AppData/Roaming/ directory, else just open it with C-X C-F entering ~/.emacs
- Open or a create a file with the *.html extension
- To make this extension faster, byte-compile using the nXhtml menu -> nXHTML help and setup
sudo apt-get install js2-mode
- In the .emacs (remove it again if it appears to be broken ....)
- Install this extension manually in some place, e.g. the site-lisp directory
E.g. (for a particular version). Also, add "sudo" in front of each if you are not root.
cd /usr/share/emacs/site-lisp wget http://ourcomments.org/Emacs/DL/elisp/nxhtml/zip/nxhtml-2.08-100425.zip unzip -l nxhtml-2.08-100425.zip unzip nxhtml-2.08-100425.zip
- Change the permission of this nxhtml sub-directory to you
sudo chown -R xxx:yyy nxhtml
- Change the ~/.emacs (not a really cross-emacsen and portable solution ...)
- as-config.el (this is only an option, did not install this)
There is a different and more recent actionscript mode from Austin Haas based on David Linquists ecmascript-mode. (made for emacsw32). I use this now for emacs 22.1.1 on Ubuntu - Daniel K. Schneider 13:17, 1 November 2008 (UTC)
To install these I did the following:
- Copied the 2 *.el files to /usr/share/emacs/site-lisp
- Byte-compiled (this is not necessary)
- Inserted this in my .emacs file:
;; Actionscript stuff (autoload 'actionscript-mode "actionscript-mode" "Major mode for editing ActionScript files." t) (add-to-list 'auto-mode-alist '("\\.as?$" . actionscript-mode))
- See XML editor for alternatives
- DTD support
The Xemacs (default "fat") installation provides good XML/DTD support through the PSGML library.
On recent Gnu Emacsen, the PSGML library has to be installed since nXML is now the default XML mode. E.g. on Linux Ubuntu this can be done through the Synaptic Package Manager. Type M-x xml-mode to get it.
Both Emacsen will find your private (system) DTDs and also includes/supports a list of public DTDs (you can add yours in the installation by editing ).
- Relax NG (RNC) support
Use nXML mode (it is distributed with a standard recent Gnu emacs installation). Here is a short how to:
- Start with a minimal template, e.g. to edit MXML Flex code use this:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> </mx:Application>
- Type M-X nxml-mode if by default *.xml files will go into no mode or PSGML mode in your setup.
- Menu XML->Set Schema ; File
- Select the appropriate RNC file
- To insert attributes
- Put your cursor inside a begin tag and hit CTRL-Return
- Then select a tag from the *Completions* buffer with the mouse or start typing and hit SPACE to find completions.
- To insert tags:
- Put the cursor between tags
- Type "<" and hit CTRL-Return or type some stuff and hit SPACE to see completions.
- Start inserting attributes (as above) if you like
- Then either type ">" followed by "</" + CTRL-Return or enter "/>".
As you can see, this interface was made for people willing to learn keyboard strokes. It's faster than using right-click contextual menus but more challenging for some ...
- XML Schema (XSD) support
- XML Schema support doesn't exist (IMHO).
- XSLT support
- Included in Gnu Emacs through nXML mode
- Included in Xemacs through some specific XSLT mode
With gnu emacs we suggest to use:
Alternatively you could try the following (I have been using this for years /DKS / March 2012, but think of switching to mediawiki.el - Daniel K. Schneider 19:40, 21 September 2012 (CEST)).
- wikipediamode.el(Wikipedia. It does syntax coloring plus navigation/tree tools. Download link: emacswiki.org. In addition we suggest to activate / install if needed: longlines.el
Most important Mediawiki.el commands
Acknowledgement: (Slightly Modified) summaries and templates taken from Wikiemacs
- M-x mediawiki-site
- Choose a site (say "WikEmacs") for the current session.
- [C-c C-o] (or M-x mediawiki-open)
- Open a page. To edit the main page, type "Main Page". Make your edits. (Copy and paste the page name from your web browser)
- [C-x C-s] (or M-x mediawiki-save)
- Submit your modifications.
- [C-c] (or M-x mediawiki-save-and-bury)
- Submit modifications and bury the buffer.
- [C-return] (or M-x mediawiki-open-page-at-point)
- Follow or browse to a WikiLink within the wiki code.
- [M-g] (or M-x mediawiki-reload)
- Reload a page
Suggested addition (edit your .emacs file)
(define-key mediawiki-mode-map (kbd "C-c o") 'mediawiki-browse)
- [C-c o] (or M-x mediawiki-browse)
- Will display the page in the web browser
- The following commands put in markup structures.
- C-c C-f C-s inserts italics
- C-c C-f C-b inserts bold text
- C-c C-f TAB italics
- C-c C-f C-e header
- C-c C-f C-l inserts a link
- C-c C-f C-u inserts user name
- C-c C-w inserts Daniel K. Schneider 15:25, 11 October 2012 (CEST)
- <M-return> inserts enumerate type structures
- C-\ inserts itemize type structures
- C-c C-l inserts a hline
For more information:
- Type c-h m
- Read Mediawiki.el on WikiEmacs
- Authentication expires too fast, so far I did not find a solution.
Ubuntu 12.04 LTS
Ubuntu as of sept 2012 still distributes old emacs 23.
To get emacs 24:
$ sudo add-apt-repository ppa:cassou/emacs $ sudo apt-get update $ sudo apt-get install emacs24 emacs24-el
Install packages (works much better now than previous extensions)
- Menu Options->Manage Emacs Packages
- Click on package to install and answer yes
So far, if I understand right, only official packages are there. Others, like the mediawiki editing extension, still neeed manual installation. Another caveat is that it installs on a per user basis.
Manuals & Short References
- GNU Emacs
- A guided Tour of Emacs (at gnu.org)
- GNU Emacs Reference Card (attention!!! for GNU emacs) [local copy]
- DIRED Mode Reference Card (PDF) (just the directory editor for GNU emacs)
- wikiemacs A newer wiki, that should replace the one below.
- EmacsWiki Good wiki site for both Emacs and Xemacs (multi-lingual)
- XEmacs Documentation, all kind of manuals in PDF
- XEMACS Emacs Reference Card (attention format POSTSCRIPT [local copy]
- XEMACS Emacs Reference Card (PDF)
Configuring the functionalities of XEmacs:
- The very unofficial dotemacs home: best overall site
- Robin S. Socha's XEmacs Settings : well-commented dot file collection and screen shots
- Erik Sundermann's XEmacs Customization Page: good 'starter' .emacs customization page (but a bit old!)
- Emacs keybindings Good (but very technical) document for all Emacsen
On the Web you can find many mini-tutorials, there are also book chapters, etc.
- There's the XEmacs tutorial available from the Help Menu under `Basics->Tutorials', or by typing C-h t. To check whether it's available in a non-english language, type C-u C-h t TAB, type the first letters of your preferred language, then type RET.
- Emacs editing environment by Michael Stutz at IBM developer works. Complete, requires 12 hours of work. (Free) registration required.
- Emacs Beginner's Tutorial by J.D. Zawodny @ RootPrompt.org
- XEmacs Tutorial Introduction by Sarah Waterson
- Tutorial - xemacs (good, but Very short)
- Quickies for Emacs (by Borkware)
- Emacs Lisp information (includes pointers to general emacs resources too)
(Some) Emacs Modes
- Html helper mode
- The Emacs Package "hm--html-menus", a mode that helps editing html pages.
- PSGML Mode home page. SEE the XML page for more pointers on PSGML !!
- Using Emacs for XML documents, good IBM developerWorks article (installation, configuration, external validator)
- Java Development Environment for Emacs (JDE)
Tools / Software
- For Linux, just use the packaging system to install, e.g. Synaptic Package Manager for Ubuntu. Check out addons (search for emacs)
- Various emacs versions
- XEmacs Download Locations
- EmacsW32 An Win Gnu emacs add on (also includes emacs in the distribution)
- Gnu Emacs (probably the best and largest beast)
- Small versions
There are many ....
- Ymacs (runs as browser plugin)