Emacs
This section is about GNU Emacs, the GNU incarnation of the advanced, self-documenting, customizable, extensible, real-time display editor Emacs.
• Fax Mode: | ||
• Info Lookup: | ||
• Battery Mode: | ||
• Word Hyphenation: |
Browse pub/emacs/, if you look for other packages.
Next: Info Lookup, Up: Emacs
Fax Mode
Fax mode is a major mode for Emacs and it looks and works like mail mode. There are also low-level commands for sending any part of an Emacs buffer directly to the fax sub-system. Here is an incomplete list of features:
- Fully customizable. Works with virtually any fax sub-system, for example, hylafax and mgetty+sendfax.
- Fax aliases including dialing lists and recursive definitions.
- Rewriting of phone numbers, for example, automatically remove the international access code from a recipient’s phone number.
- File attachments.
- Mail address database interface. Examples for
forms
andedb
are included. - Output filters. Text (
write-region
), PostScript (ps-print-region
, orps-print-region-with-faces
) and a hybrid text/TeX filter are available by default.
Fax mode is available at the Emacs Lisp archive, or download it from here.
Next: Battery Mode, Previous: Fax Mode, Up: Emacs
Info Lookup
Info lookup displays the Info documentation of symbols and files
according to the programming language you are editing. It is part of
GNU Emacs (see file info-look.el). In Emacs 22, the command
info-lookup
is bound to C-h S. In Emacs 21 it is
bound to C-h C-i (also known as C-h TAB).
Next: Word Hyphenation, Previous: Info Lookup, Up: Emacs
Battery Mode
Battery mode displays the battery status of your laptop in the echo area
or in the mode line. It is part of GNU Emacs (see file battery.el).
You can either query the battery status with the command
battery
or you can display it permanently in the
mode line with the command display-battery-mode
.
No way is not an option
Prior to version 21.1, GNU Emacs could not visit non-ordinary files.
This was quite inconvenient because, for example on Linux, the battery
status information has to be read from a file in the /proc file
system. To avoid yet another useless use of cat
, I took the
challenge to implement it in Emacs Lisp. After half an hour of digging,
coding, and testing, I ended up with the code displayed below.
(defun battery-insert-file-contents (file-name) "Insert contents of file FILE-NAME after point. FILE-NAME can be a non-ordinary file, for example a named pipe. Return t if file exists." (let ((load-read-function 'battery-read-function) (load-source-file-function nil) (load-path '(".")) (load-history nil)) (save-excursion (load file-name nil t t)))) (defun battery-read-function (&optional stream) "Function for reading expressions from STREAM. Value is always nil." (let (char) (while (not (< (setq char (get-file-char)) 0)) (insert char))))
Nota bene: The most surprising thing was the discovery of the
get-file-char
function and it’s documentation string.
Previous: Battery Mode, Up: Emacs
Word Hyphenation
I have implemented Liang’s hyphenation algorithm in Emacs Lisp. Up to now I can type M-x hyphen-show-hyphens RET and Emacs displays the syllables of the word at point in the echo area. The package supports multiple languages, hyphenation exceptions, and all the other features known from TeX. What still is to do is to merge word hyphenation into Emacs’ filling modes–which is not that easy.
A working copy of the source code is available in the pub/emacs/ directory. You need at least the file hyphen.el and a set of hyphenation patterns for your language of choice, for example hyphen-us.* for U.S. English.