Software I like: Emacs

GNU Emacs logo

My customizations

Under MS Windows, you should define a HOME environment variable (e.g., C:\Users\username\). Under Linux, HOME should already be defined.

You can add something like -geometry 80x40+100+25 to the Shortcut Target to specify the initial size and position of the Emacs window. (I'm not actually sure where to do this after using the installer for Emacs 27.2.)

Emacs can be customized using a .emacs file in one’s home directory and .el files in in the directory ~/.emacs.d/lisp/. These are my customizations:

Basic key bindings

The following table summarizes the emacs key bindings that I use, as defined in pen.el. They are patterned after BBN's PEN text editor:

The caret (or circumflex accent) character (^) is used to indicate control characters. For example, ^a signifies holding down the Control key while pressing the a key.

The Single column lists single-character commands. The following three columns list commands which consist of two characters: ^x, ^y or ^z followed by another character.

The table does not include the use of the arrow keys, backspace key, etc; nor the use of whatever menus may appear on the screen; nor all of the commands that can be invoked use ^[ x.

The strongly emphasized entries are those that I use most often, and that might be considered as fundamental.
Single^x^y^z
^aBeginning of line Save all buffers (undefined) Beginning of buffer
^bBackward one character List buffers (undefined) Move line to bottom of window
^c(html-helper-mode commands) Quit (undefined) Re-centre
^dDelete character at cursor List directory Deactivate mark Down half a window
^eEnd of line (undefined) (undefined) End of buffer
^fForward one character Find file (after ^u) (undefined) (undefined)
^gGobble word to right (undefined) Get region (undefined)
^hHelp (undefined) (undefined) Home (beginning of window)
^i(tab) Indent region (undefined) Insert/Overwrite mode
^j(line feed) (undefined) (undefined) Search backward (after ^u)
^kKill line Edit keyboard macro Kill region (undefined)
^lLeft one word Call last kbd macro (undefined) Scroll left
^m(carriage return) (coding-system commands) (undefined) (undefined)
^nNext line Set goal column for ^n & ^p (undefined) Next screenful
^oOpen space Delete blank lines Open region (undefined)
^pPrevious line Mark page Put region Previous screenful
^q(see ^\)
^rRight one word Re-highlight (redraw) (undefined) Scroll right
^s(see S)
^tToggle characters Clear modification flag (undefined) Line to top
^uUser argument Re-use user argument Unkill region Up half a window
^v(html-insert commands) Find alternate file (undefined) Split window vertically
^wWipe word to left Write file (undefined) Split window horizontally
^x(^x commands) Run command shell Exchange pos'n with mark
^y(region commands) (undefined) Set mark (undefined)
^z(^z commands) Exit & save (undefined) Other window
^\Quote (undefined) (undefined) (undefined)
^]Search forward (after ^u) Save buffer Shape of region (undefined)
^[Meta (undefined) (undefined)
S (self-insert) Save buffer Shape of region Incremental search fwd
( Start macro Blink matching open (undefined)
) End macro (undefined) (undefined)
L Count lines on page Convert region to lower case (undefined)
U Undo Convert region to upper case (undefined)
= Show cursor position (undefined) Show cursor position
1 Single window (undefined) Single window
C (undefined) (undefined) Change case sensitivity for searches

^s and ^q are not used because in some contexts they are interpreted as transmission off and on, respectively.

Key bindings for HTML character entities

The following table lists the keystrokes to use after ^v in order to insert various HTML character entities. In some cases, pairs of characters may be entered in either order.

Non-alphabetic symbols

Name Glyph Keystrokes
ampersand & &
left angle bracket < <
right angle bracket > >
double quotation mark " "
left single quotation mark
right single quotation mark
paragraph symbol pa
British pound symbol £ po
plus-minus symbol ± pm

Ligatures

Name Glyph Keystrokes Name Glyph Keystrokes
AE Æ AE ae æ ae
OE Œ OE oe œ oe
sz ß sz
ss

Non-Latin characters

Name Glyph Keystrokes Name Glyph Keystrokes
ETH Ð ETH eth ð eth
THORN Þ TH thorn þ th

Decorated Latin characters

Name Glyph Keystrokes Name Glyph Keystrokes
Aacute Á A' aacute á a'
Acirc  A^ acirc â a^
Agrave À A` agrave à a`
Aring Å Ao aring å ao
Atilde à A~ atilde ã a~
Auml Ä A\ auml ä a\
Ccedil Ç C, ccedil ç c,
Eacute É E' eacute é e'
Ecirc Ê E^ ecirc ê e^
Egrave È E` egrave è e`
Euml Ë E\ euml ë e\
Iacute Í I' iacute í i'
Icirc Î I^ icirc î i^
Igrave Ì I` igrave ì i`
Iuml Ï I\ iuml ï i\
Ntilde Ñ N~ ntilde ñ n~
Oacute Ó O' oacute ó o'
Ocirc Ô O^ ocirc ô o^
Ograve Ò O` ograve ò o`
Oslash Ø O/ oslash ø o/
Otilde Õ O~ otilde õ o~
Ouml Ö O\ ouml ö o\
Uacute Ú U' uacute ú u'
Ucirc Û U^ ucirc û u^
Ugrave Ù U` ugrave ù u`
Uuml Ü U\ uuml ü u\
Yacute Ý Y' yacute ý y'
yuml ÿ y\

Greek characters

Glyph1 is displayed using a Symbol font. Glyph2 is displayed using HTML character-entity names. The latter is more correct but doesn't work in many browsers; the former is inelegant but may work in some circumstances. The variant lower-case characters are even more problematical than the others.
Name Glyph1 Glyph2 Keystrokes Name Glyph1 Glyph2 Keystrokes
Alpha A ΑgA alpha a αga
Beta B ΒgB beta b βgb
Gamma G ΓgG gamma g γgg
Delta D ΔgD delta d δgd
Epsilon E ΕgE epsilon e εge
Zeta Z ΖgZ zeta z ζgz
Eta H ΗgH eta h ηgh
Theta Q ΘgQ theta q θgq
theta J ϑgJ
Iota I ΙgI iota i ιgi
Kappa K ΚgK kappa k κgk
Lambda L ΛgL lambda l λgl
Mu M ΜgM mu m μgm
Nu N ΝgN nu n νgn
Xi X ΞgX xi x ξgx
Omicron O ΟgO omicron o οgo
Pi P ΠgP pi p πgp
Rho R ΡgR rho r ρgr
Sigma S ΣgS sigma s σgs
sigma V ςgV
Tau T ΤgT tau t τgt
Upsilon U ΥgU upsilon u υgu
Phi F ΦgF phi f φgf
phi j gj
Chi C ΧgC chi c χgc
Psi Y ΨgY psi y ψgy
Omega W ΩgW omega w ωgw
omega v gv

Coding-system commands

The following table shows three of the coding-system commands, which are prefaced by ^X^M. The command is followed by the name of the coding system and then ^M. For example, ^x ^m c mule-utf-16-le ^m.
c Specify coding system for the immediately following command
f Use specified coding system for the visited file in the current buffer
r Revisit current file using the specified coding system (Emacs version 22)

There are also other coding-system commands.

LaTeX mode(s)

My current favourite is AUCTeX.

HTML mode(s)

I have been using Nelson Minar's html-helper-mode and G. U. Lauri's version; see also page on EmacsWiki (cf. D. Brierton's suggested extensions from 2002)).

In 2011 Jan, I started considering the use of the HTML Mode built into Emacs (see also HtmlMode in EmacsWiki).

For me, the advantages of the old html-helper-mode (apart from the fact that I'm used to it) are that it generates time-stamps, and that it has keystrokes defined for definition lists and for em, strong, code, sup and sub (and for span class=menu that I added myself).

The disadvantages are that it hasn't been supported for a long time, and that it doesn't support the entry and indenting of tables.

((HTML-mode
  (time-stamp-line-limit . -50)
  (time-stamp-end . "\\.?$")
  (time-stamp-format . "%:y-%02m-%02d:%:H:%:M:%:S")
  (time-stamp-start . "^Last modified: ")))

To get the time-stamp functionality that was provided by html-helper-mode, for the new HTML mode I created the code shown at the right, for inclusion in the directory-variables file ~/.dir-locals.el. (These became available only in Emacs version 23; they do not work for remote directories, which might become a problem if I were using the feature whereby they identify the files to which they apply based on location rather than mode.) I have not been able to figure out how to get an initial-caps abbreviated month name from the date and time formatting specifications.

Here is a list of those particular html-helper-mode keystrokes that I have been used to using, for comparison with the newer HTML mode.
Keystrokes Entity Notes Keystrokes [1]
^C & &amp; ^V &
^C < &lt; ^V <
^C > &gt; ^V >
^C ␠ &nbsp; ^C Space ^V ␠
Keystrokes Tag Notes Keystrokes [2]
^C ^L u ul ^C ^C u
^C ^L o ol ^C ^C o
^C ^L i li (or dt+dd) ^C ^C l
^C ^L d dl
^C ^L t dt+dd
^C ^A n a name= ^C ^C n
^C ^A l a href= ^C ^C h
^C ␉ img ^C Tab ^C ^C i
^C ^S e em
^C ^S s strong
^C ^S c code
^C ^S k kbd
^C ^S m span class=menu added by me
^C ^P ^ sup
^C ^P _ sub
^C ^T1 h1 ^C 1
^C ^T2 h2 ^C 2
^C ^T3 h3 ^C 3
^C ^T4 h4 ^C 4
^C ^T5 h5 ^C 5
^C ^T6 h6 ^C 6
^C ␍ br ^C Enter ^C ␊ (^C ^J)
␛ ␍ p ^[ Enter ^C ␍

[1] Keystrokes defined in my html-ins.el
[2] Keystrokes defined in newer HTML mode


R. Funnell
Last modified: 2023-12-15 07:26:22