Quick
index
main
eev
eepitch
maths
angg
blogme
dednat6
littlelangs
PURO
(C2,C3,C4,
 λ,ES,
 GA,MD,
 Caepro,
 textos,
 Chapa 1)

emacs
lua
(la)tex
maxima
 qdraw
git
lean4
agda
forth
squeak
icon
tcl
tikz
fvwm
debian
irc
contact

Edrx's Emacs page

Home is where my .emacs is.

I use Emacs+eev as my main interface to the system. Main reason: executable notes.

A quote from Neil Stephenson's "In the Beginning it was the Command Line":

In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. If you are a professional writer - i.e., if someone else is getting paid to worry about how your words are formatted and printed - Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish. For page layout and printing you can use TeX: a vast corpus of typesetting lore written in C and also available on the Net for free.

From a paper by RMS on Emacs written in 1981:

The programmable editor is an outstanding opportunity to learn to program! A beginner can see the effect of his simple program on the text he is editing; this feedback is fast and in an easily understood form. Educators have found display programming to be very suited for children experimenting with programming, for just this reason (see LOGO).

Programming editor commands has the additional advantage that a program need not be very large to be tangibly useful in editing. A first project can be very simple. One can thus slide very smoothly from using the editor to edit into learning to program with it.

When large numbers of nontechnical workers are using a programmable editor, they will he tempted constantly to begin programming in the course of their day-to-day lives. This should contribute greatly to computer literacy, especially because many of the people thus exposed will be secretaries taught by society that they are incapable of doing mathematics, and unable to imagine for a moment that they can learn to program. But that won't stop them from learning it if they don't know that it is programming that they are learning! According to Bernard Greenberg, this is already happening with Multics EMACS.

Note that eev takes the idea of "...need not be very large..." to the extreme: most eev "programs" are one-liners. See:

(find-eev-quick-intro  "3. Elisp hyperlinks")
(find-eev-quick-intro  "4. Creating Elisp Hyperlinks")
(find-eev-quick-intro  "7.3. Defining eejump targets")
(find-eev-quick-intro  "7.4. Commands with very short names")
(find-here-links-intro "2. " "Here")
(find-pdf-like-intro   "4. Hyperlinks to pages of PDF files")
(find-pdf-like-intro   "7. Shorter hyperlinks to PDF files")
(find-audiovideo-intro "4.3. A demo")

The book "Free as in Freedom" has a chapter about Emacs.

The best way to see what's going on in the Emacs World is to visit Sacha Chua's blog.


The rest of this page is very old - pre-2015!


I use GNU Emacs. I don't know how to make my glyphs work in XEmacs.

These days I tend to use Emacs on X, on Fvwm.

Quick index:

1. General links

I used to use IRC a lot. My favourite IRC client is rcirc (its EmacsWiki page, rcirc stuff in my .emacs).

Some links on dynamic scoping vs. lexical scoping: an IRC log, a bigger discussion, a section about that in an old Emacs paper, the "Dynamic Scope Analysis" paper.

Emacs Lisp is a Lisp-2.

CVS Emacs:

Etc:

Org, Howm and Planner

Tramp (and $ASROOT); rcirc, circe, bitlbee

Things to try: screen-lines.el, two-mode-mode.el (see also this)

Do you think that this page is unreadable? Sorry human animal! Xah Lee thinks that too! But I am a unix moron, what can I do?


2. What is eev

(2007oct15: Note: this is a very short introduction to eev, written mainly for people who already know Emacs well enough. The material that I use to explain Emacs and eev at the same time for people unfamiliar with Emacs is below. This is very incomplete.)

I use eev to make Emacs be my main interface with the system.

Eev lets me "record" what I do into plain text files, in ways that can be "played back" later easily; I call these text files "e-scripts".

There is no way to run an e-script file all at once - e-scripts are not like scripts, they are more like "executable notes", or "executable logs"; we can select blocks in them and then say to Emacs to execute those blocks in a certain way. The two most basic ways are: (1) "go to the end of this line and execute the sexp before point" (this is bound to M-e in eev-mode, and is roughly equivalent to C-e C-x C-e, and (2) "send the current line to a program (typically a shell) running in another buffer"; this is bound to F8 (`eepitch-this-line').

Way (1) is mainly for recording links to interesting information, using sexps as hyperlinks. For example:

(find-enode "Lisp Eval")
(find-enode "Lisp Eval" "`C-x C-e'")
(find-eevfile "")
(find-eevarticlesection "hyperlinks")
(find-eevarticlesection "shorter-hyperlinks")

Way (2) is for recording commands to be sent to external programs - mainly to the shell. There's a trick: when the current line starts with a red star glyph the rest of the line is executed as Lisp, not sent; this is used to set up the "eepitch target". For example:

* (eepitch-shell)
cd /tmp/
echo $[1+2]

There are other ways to send commands to external programs, but they require some setup (like patching rcfiles):

(find-eevarticlesection "making-progs-receive-cmds")
(find-eev "INSTALL")
(find-eev "eev-rctool")

3. A short Emacs tutorial

(Started in 2007jul23. Work in progress.)

Most Emacs tutorials, for example this "guided tour" from gnu.org, treat Emacs as an editor that can "edit" anything that looks like text - files, directories, manpages, help, shell sessions, the source code of programs, debugging sessions, etc. I don't like this approach very much; it makes people feel overwhelmed. I prefer to see Emacs as a Lisp environment that people have used to build several kinds of editors and tools.

A bit of history (simplified, but not far from the truth): in the middle of 1970s people were starting to experiment with programmable (i.e., extensible) text editors, but most of the time what they were getting were systems where one person's extensions wouldn't be easily reusable by other people. For example, if Alice had programmed some functions to make it easier to edit e-mails then Bob would find Alice's extensions very hard to understand, and they would probably not work if Bob tried to use them together with his own extensions... But then at some point some people said: "hey, instead of taking an existing text editor and trying to make it programmable, let's take this programming language here, Lisp, that is very easy to extend and to modify, and let's add a few functions to it so that it will also behave as a very primitive text editor; then we will add the rest" - and this worked VERY well, and this was the core of Emacs; so Emacs is a Lisp on top of which hundreds, or thousands, of modules have been added, and these modules can be understood each one separately from the others.

In Emacs the Lisp is "very close to the surface", always accessible, and if we present some basic things about it as soon as possible - I always do that in the first 5 minutes when I'm explaining Emacs to people - then everything becomes simpler. In the boxes below the "(functionname argument ...)" things with hyperlinks are small Lisp programs - "one-liners" - whose actions are somehow correspondent to following the hyperlink at the `")'; the link at the `functionname' points to more detailed explanations of what those one-line programs do.

Commands, keys, prefixes, aborting, completion
==============================================
Commands in Emacs can be several keys long,
and all commands have names and can be invoked
by their names - for example, `M-x find-file'.
The prefixes "C-" and "M-" mean "Control" and
"Meta"; on most keyboards "Meta" is "Alt".
To abort a partially-typed command use `C-g'.

  (find-enode "Keys" "key sequence")
  (find-enode "User Input" "`Control-a'" "usually written `C-a'")
  (find-enode "User Input" "<META> key")
  (find-enode "M-x" "Running Commands by Name")
  (find-enode "Quitting" "`C-g'")

The TAB key can be used for completion in M-x,
and in many other situations.

  (find-enode "Completion")
Files, Buffers, Windows, Frames, Display, etc
=============================================
Emacs can edit several files at the same time, each one
in a "buffer".

  (find-enode "Files")
  (find-enode "Buffers")
  (find-enode "Windows")
  (find-enode "Frames")

The display of Emacs looks like this:
(TODO: create a real screenshot.)
                                        __ _ _
              ______________emacs_______\/|-|X|
          /  |                                 |  \
          |  | bla                             |  | Emacs
Window    |  |                                 |  | calls this
managers  |  |                                 |  | a "window".
call      |  |                                 |  /
this a    |  |--:** foo.txt  (Fundamental) ----|  <-- Its "modeline".
"window". /  |                                 |  \
Emacs     \  | bla bla                         |  | Another
calls     |  | bleh                            |  | window.
this a    |  |                                 |  |
"frame".  |  |                                 |  /
          |  |--:** bar.txt  (Fundamental) ----|  <-- Its modeline.
          \  |Find file: ~/bletch.txt__________|  <-- The minibuffer.

The bottom line of a frame is sometimes the "echo area",
sometimes the "minibuffer". The minibuffer acts like a
window when it is active, and `C-x o' can be used to move
from it to the "normal windows" and back. You can also
use the mouse to move between windows.

  (find-enode "Other Window")
Basic keys
==========
The keys that should be learned first are:
  `C-g'           See: (find-enode "Quitting" "`C-g'")
  `C-_' or `C-/'  See: (find-enode "Basic Undo")
  `C-x C-e'       See: (find-enode "Lisp Eval")
       and: http://angg.twu.net/eev-article.html#hyperlinks

Then:

M-x     -- execute-extended-command     (find-enode "M-x")
            more about the minibuffer:  (find-enode "Minibuffer")
TAB     -- for completion:              (find-enode "Completion")
           for indentation:             (find-enode "Indentation")
           in programming modes:        (find-enode "Basic Indent")

C-x o   -- other-window                      (find-enode "Other Window")
C-x 0   -- delete-window                     (find-enode "Change Window")
C-x 1   -- delete-other-windows ("1 window") (find-enode "Change Window")
C-x 2   -- split-window-vertically (Abv/Blw) (find-enode "Split Window")
C-x 3   -- split-window-horizontally   (L|R) (find-enode "Split Window")

                                        (find-enode "Dired")
C-x C-f -- find-file                    (find-enode "Visiting")
C-x C-s -- save-buffer                  (find-enode "Saving")
C-x C-c -- save-buffers-kill-emacs      (find-enode "Saving")
C-x b   -- switch-to-buffer             (find-enode "Select Buffer")
C-x k   -- kill-buffer                  (find-enode "Kill Buffer")

                                        (find-enode "Mark")
C-SPC   -- set-mark-command             (find-enode "Setting Mark")
C-w     -- kill-region     (cut)        (find-enode "Other Kill Commands")
M-w     -- kill-ring-save  (copy)       (find-enode "Kill Ring")
C-y     -- yank            (paste)      (find-enode "Kill Ring")

C-a     -- beginning-of-line            (find-enode "Moving Point")
C-e     -- end-of-line                  (find-enode "Moving Point")
M-<     -- beginning-of-buffer          (find-enode "Moving Point")
M->     -- end-of-buffer                (find-enode "Moving Point")

M-q     -- fill-paragraph               (find-enode "Fill Commands")

C-s     -- isearch-forward              (find-enode "Incremental Search")
C-r     -- isearch-backward             (find-enode "Incremental Search")
M-C-s   -- isearch-forward-regexp       (find-enode "Regexp Search")
M-C-r   -- isearch-backward-regexp      (find-enode "Regexp Search")
M-%     -- query-replace                (find-enode "Replace")

C-x (   -- start-kbd-macro              (find-enode "Keyboard Macros")
C-x )   -- end-kbd-macro                (find-enode "Keyboard Macros")
C-x e   -- call-last-kbd-macro          (find-enode "Keyboard Macros")

4. A minimal roadmap/tutorial for eev

(Started in 2007aug24. Work in progress.)

Not all links work at this moment - the red words are "future links"...

Sending commands to shells (screenshot):
  M-x eev           save the region into $EE
  M-x eev-bounded   save the bounded region into $EE
  F3                run the default bounded action
  "ee" in a         execute the commands in $EE
    prepared shell  (verbosely; $EE is a temporary script)
Sending one line to a shell:
  F8                send to an M-x shell buffer
  F9                send to an xterm listening on a channel
F8 and F9 treat red-star lines specially (as Lisp):
* (eepitch-shell)   set the target for F8
* (eepitch-kill)    kill the current eepitch target
* (eexterm "A")     set the target for F9; create an xterm if needed
* (eexterm-kill)    kill the current eexterm
Commands to convert the current line into hyperlinks (by "wrapping"):
  M-F  -- wrap the current line in a `find-fline'
  M-M  -- wrap the current line in a `find-man'
  M-S  -- wrap the current line in a `find-sh'
  M-T  -- generate an "* (eepitch-{xxx,kill,xxx})" block (three lines).
          Typical usage: type "shell", then `M-T', then `F8's on the result.
  M-D  -- treat the contents of the current line as the name of a Debian
          package and produce three hyperlinks from it
  M-C  -- treat the contents of the current line as a "code" and a
          "directory" and produce a `code-c-d' and a `find-_file' sexps
          from it
  (Note that the key sequences above use uppercase letters - to obtain
  `M-F', type `meta-shift-t').

Commands to generate pages with lists of hyperlinks (in a separate buffer):
  M-h f   -- hyperlinks to the current file
  M-h M-f -- hyperlinks to an Emacs function
  M-h M-i -- hyperlinks to the current Info node
  M-h M-k -- hyperlinks to a key sequence and to the function
             associated to it
  M-h M-v -- hyperlinks to an Emacs variable
  M-h M-s -- hyperlinks to a face (default: face at point)
  M-h M-m -- hyperlinks to a manpage (ask for name)
  M-h m   -- hyperlinks to a manpage (being viewed)
  M-h M-d -- hyperlinks about a Debian package
Editing:
  C-q C-o           insert a red star glyph: "*"
                        (a typical delimiter for F3 is "\n#*\n")
  M-h M-2           duplicate the current line
  M-h M-y           refine a hyperlink
Basic cut & paste keys (not eev-specific)
  C-SPC             set the mark
  C-x C-x           exchange point and mark
  M-w               copy
  C-w               cut
  C-y               paste
  C-k               kill-this-line
Hyperlinks (keys to follow them):
  M-e               like C-e C-x C-e: go to end of line, then M-E
  M-E               like C-x C-e: eval the sexp ending before point
Hyperlinks (keys to returning from them):
  M-k               kill-this-buffer
  M-K               bury-buffer

Temporary buffers with hyperlinks:
  M-h M-f           hyperlinks to an Emacs function
  M-h M-k           hyperlinks to a key sequence and to the function
                        associated to it
  M-h.f             hyperlinks to the current file
  M-h M-i           hyperlinks to the current Info node
  M-x ee-hyperlink-prefix
Turning eev-mode on (with M-x eev-mode) has only two effects:
the keymap eev-mode-map becomes active, and `pop-up-windows'
becomes nil (this makes `M-e', `M-E', `M-k', and `M-K' behave better).
Turning eev-mode off deactivates the keymap and restores the value of
`pop-up-windows'.

The easy way to try eev is to download and unpack the tarball somewhere,

  mkdir ~/eev-current/
  cd    ~/eev-current/
  wget http://angg.twu.net/eev-current.tar.gz
  tar -xvzf eev-current.tar.gz

and then load it and activate it with:

  (add-to-list 'load-path "~/eev-current/")
  (require 'eev-all)
  (eev-mode 1)

The effects of "(require 'eev-all)" are: lots of functions are defined
(mainly for hyperlinks); some environment variables are set ($EE,
$EEVTMPDIR, etc), but only in Emacs and in programs started from
Emacs; and a few glyphs are defined.

The "full instalation" for eev involves changing some rcfiles -
.emacs, .bashrc, etc. This can be done semi-automatically (see
eev-rctool and the INSTALL file) and is trivial to undo. If you try
eev without changing rcfiles then M-x eev and F3 will not work
properly, in the sense that the shortcut "ee" to execute the temporary
script file - a shell function - will not be defined.


5. A 2D map of eev

(Started in 2010sep10. Work in progress.)

At some point this will be a very compact - yet complete - guide to all the main ideas and features of eev, in a nice order, with the most basic ones coming first in each block...

Global installation
via apt-get                Basic glyphs          For the paranoid hacker
-----------                ------------          -----------------------
adjust_sources.list        C-q_and_red_stars     inspect_the_repository
apt-get_update             ee-wrap-eepitch       dowload_the_.deb
apt-get_install_eev        innards:_ee-glyph     inspect_the_.deb
the_emacs-eev_icon         eev-bounded           build_the_.info
the_emacs-eev_script       eelatex-bounded       build_the_info-htmls
                                                 build_the_.htmls
Basic skills               Advanced glyphs       build_the_.tar
------------               ---------------       upload_the_.tar
execute_a_sexp             raw-byte_buffers      build_the_.deb
execute_a_sexp_with_M-e    local_variables       inspect_the_DEBIAN_dir
M-?:_eev-help-page         M-,:_compose_keys     dpkg_-i_.deb
M-h_M-e:_all_eev_keys      to_and_find-anchor    build_local_repository
run_eepitch                eev-math-glyphs.el    update_the_repository
create_an_eepitch_block                          upload_the_.deb
create_hyperlinks_with_wrap   Advanced skills
hyperlinks_about_function     ---------------
hyperlinks_about_file         eev_and_F3         
hyperlinks_about_info_page    find-elinks        
create_hyperlinks_with_M-h    eesteps_and_eek    
refine_a_hyperlink            templates          
code-c-d                      ee-hyperlink-prefix
local_copies_of_urls          browse-url_functions
hyperlinks_to_pdfs            find-find-links-links

Advanced installation
---------------------
the_temporary_scripts_dir
patching_rcfiles
M-x_eev_and_friends
unpatching_rcfiles
eechannel
expect_and_xterm
w3m

Local installation via tgz
--------------------------
downloading_tgz
trying_eev_just_once
local_overrides_global
find-eev-update-links

Installation on W32
-------------------
(to be written)

6. Call Diagrams (for some parts of eev)

A diagram for the `find-fline'/`find-node' family:

.                                code-c-d   find-code-c-d
                                    |     /       |
                                    v    v        v
            find-node <------ ee-code-c-d   find-estring-elisp
             |              /       |             |
             |             v        v             v
ee-expand <--+--- find-fline   find-anchor  find-eoutput-rerun
             |        |             |
             |        |             v
             |        |        ee-goto-anchor <-- ee-to <-- to
             |        |      /      |
             v        v     v       v
            ee-goto-position   ee-anchor-format
                  |
                  v
            ee-goto-rest

Top-level words:
  find-fline    - hyperlink to a file
  find-node     - hyperlink to an info node
  code-c-d      - to define `find-xxxfile' and `find-xxxnode' words
  find-code-c-d - inspect the code that `code-c-d' would run

The `eev' family:

.                         eeb-define   find-eeb-define
                                |    /       |
                                v   v        v
                       ee-eeb-define   find-estring-elisp
                               |
                               v
                         eev-bounded
                          |       |
                          |       v
                          |   eeb-default
                          |    /     \
                          v   v       v
eev <-------------- eeb-defaults    eeflash
|  \                      :
|   v                     v
| ee-se-to-string   eev-set-glyph
|
v
ee-write-string

Top-level words:
  eev         - save the region to a temporary script file
  eev-bounded - save a bounded region into the temporary script file
  eeb-define  - used to define `eev-bounded' from `eev'
  find-eeb-define - display the code that eeb-define runs

The relations in the graph above:
  `eev' calls `ee-write-string', that calls `ee-se-to-string'.
  `eev' uses `ee-se-to-string' to get what to save.
  `eev-bounded' sets `eeb-defauls' and calls `eeb-default'.
  `eeb-default' read the delimiters and the function from `eeb-defaults'.
  The delimiters in `eeb-defaults' usually contain `*', whose
  appearance is defined by a call to `eev-set-glyph'.
  `eeb-default' calls `eeflash' to highlight the region.
  `eeb-define' calls `ee-eeb-define' to generate the code of a defun -
  for example, for the definition of `eev-bounded'. This code is then
  evaluated.
  `find-eeb-define' also calls `ee-eeb-define', but instead of evaluating
  the code it uses `find-estring-elisp' to display the code in a buffer.

Diagrams for the steppers:

eesteps:

.     <f12> ---->    eesteps-do-step
                       |        \
                       |         v
M-e ---->   eesteps    |   eesteps-perform
               |       |          |
               v       v          v
             eesteps-list        eek   eek0
             eesteps-pos

eepaste:

M-P ---->   eepaste-one-line
                 |       \
                 v        v
M-w ---->   kill-ring      (insert line)
                         (call-interactively (key-binding "\r"))

eepitch:

<f8> ---->   eepitch-this-line
                 | |         \ *
                 | |          v
                 | |           eepitch --------------
                 | |          /                       \
                 | v         v                         v
                 | eepitch-prepare-target-buffer ---> eepitch-code
                 | eepitch-display-target-buffer
                 | eepitch-not-this-buffer
                 v
              eepitch-line
                    |                         eepitch-target-buffer
                    v
              (insert line)
              (call-interactively (key-binding "\r"))

eechannel:

<f9> ----->   eechannel-this-line
                 |              \ *
                 |               v
                 |                eechannel
                 |                       \
                 v                        v
              eechannel-send ----------> eechannel-default
                    |      \
                    |       v
                    |       eechannel-kill
                    |           |
                    |           v
                    |       eechannel-pid
                    |           |
                    v           v
        eechannel-strfile   eechannel-pidfile

7. Debugging Emacs with elisp hyperlinks

I should have sent this idea to emacs-devel, but I didn't...

http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00517.html

(find-efunctiondescr 'find-file)
(find-efunctiondescr 'find-file "files.e")
(find-efunctiondescr 'find-file "files.e" '(eek "RET"))
(find-efunctiondescr 'find-file "files.e" '(eek "M-h M-k RET"))
(find-efunctiondescr 'find-file "files.e" '(eek "M-x push-button"))
(find-efunctiondescr 'find-file "files.e" '(push-button (point)))
(find-efunctiondescr 'find-file "files.e" '(progn (debug) (push-button (point))))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-at (point))))
(find-efunctiondescr 'find-file "files.e" '(button-activate (button-at (point))))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'action)))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'action)))
(find-efunctiondescr 'find-file "files.e" '(help-button-action (button-at (point))))
(find-efunctiondescr 'find-file "files.e" '(find-epp help-button-action (button-at (point))))

(find-efunction 'push-button)
(find-efunction 'button-activate)
(find-efunction 'help-button-action)

(find-efunctiondescr 'find-file "files.e" '(find-epp (button-start (button-at (point)))))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'help-function)))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'help-args)))
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'help-function)))
(find-efunctiondescr 'find-file "files.e" '(find-efunctiond (button-get (button-at (point)) 'help-function)))
(find-egrep "grep -nH -e 'Unable to find location in file' $(find * -name '*.el')")
(find-efile "help-mode.el" "define-button-type 'help-function-def")
(find-efile "help-mode.el" "define-button-type 'help-variable-def")
(find-efile "help-mode.el" "define-button-type 'help-face-def")

(load "help-mode.el")
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'help-function)))
(load "help-mode.elc")
(find-efunctiondescr 'find-file "files.e" '(find-epp (button-get (button-at (point)) 'help-function)))

8. The unibyte<->multibyte bridge

2008oct21: My green guillemet glyphs do not work well in multibyte buffers - functions based on find-anchor, mkto and eev-compose-two-keys fail in weird ways. I'm trying to understand how Emacs converts between unibyte and multibyte, in strings, buffers and files, to fix this...

(find-es "emacs" "anchors-in-latin-1")
(find-es "emacs" "anchors-in-latin-1-2")
(find-angg ".emacs" "save-this-block-as")
(find-elnode "Converting Representations")
(find-elnode "Coding System Basics" "`raw-text'")
(find-elnode "Coding System Basics" "`emacs-internal'")
(find-elnode "Coding System Basics" "latin-1")
(find-elnode "Lisp and Coding Systems" "coding-system-charset-list")
(find-elnode "Lisp and Coding Systems" "detect-coding-region")
(find-elnode "Explicit Encoding")
http://article.gmane.org/gmane.emacs.bugs/21772
http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-10/msg00830.html
http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-01/msg00555.html
http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-01/msg00557.html

   unibyte string/   <-\ convert/
  multibyte string   --/ concat
        ^ |
   kill | | insert/search
        | v
   unibyte buffer/   glyphs
  multibyte buffer   ------>  display
         ^
         |
         v
  raw unibyte files/
  raw multibyte files/
  files with other
  encodings
;;--------snip,snip--------
;; -*- coding: latin-1 -*-
;; (save-this-block-as "/tmp/4.txt")

(setq <<foo>> "\253foo\273")
(setq <<foo>>uni    (string-to-unibyte   <<foo>>))
(setq <<foo>>multi  (string-to-multibyte <<foo>>))
(setq <<foo>>uni+   (decode-coding-string <<foo>>uni   'iso-8859-1))
(setq <<foo>>multi+ (decode-coding-string <<foo>>multi 'iso-8859-1))

;; Note: <<foo>>uni  is unibyte,
;;   but <<foo>>uni+ is multibyte
;; (and <<foo>>uni+ = <<foo>>multi+)
(multibyte-string-p <<foo>>)
(multibyte-string-p <<foo>>uni)
(multibyte-string-p <<foo>>multi)
(multibyte-string-p <<foo>>uni+)
(multibyte-string-p <<foo>>multi+)

(insert 171 "foo" 187)

(search-backward <<foo>>uni)
(search-backward <<foo>>multi)
(search-backward <<foo>>uni+)
(search-backward <<foo>>multi+)
;;--------snip,snip--------

9. eejump

Here's something that I've been using a lot lately... The full version is here; the code below is a miniature that just shows the main idea. Further reading: this and this.

;; eejump (M-j):
;; M-1 M-j opens a certain file,
;; M-2 M-j opens another file,
;; when the argument is 11, 22, 33 or 44 do something special,
;; like changing the font;
;; with no argument or with an unrecognized argument jump to
;; the definition of eejump in ~/.emacs; then we can see which
;; numbers correspond to which actions (the source is the
;; documentation!), and we can change the definition if needed -
;; just run C-x C-e (eval-last-sexp) at the right place to make
;; the changes apply.
;;
(global-set-key (kbd "M-j") 'eejump)
(defun eejump (arg) (interactive "P")
  (cond ((eq arg 1) (find-file "~/NOTES"))
        ((eq arg 2) (find-file "~/otherfile.txt"))
        ;;
        ((eq arg 11) (set-frame-font "fixed"))
        ((eq arg 22) (set-frame-font "terminus-16"))
        ((eq arg 33) (set-frame-font "terminus-bold-16"))
        ((eq arg 44) (set-frame-font "10x20"))
        (t (find-function 'eejump))))


10. palette

This is just a proof of concept for another idea... given a region and a list of names - say, ("foo" "bar") - go through each word of the region, and when the word is in the list convert it to a button whose action is to jump to an anchor with that name in an index buffer (that index buffer can be something like this, but using anchors and sexps).

The code is here.


11. Flipbooks

eev-sshot.el, for screenshots and flipbook animations (2006oct02).

Three flipbooks (suggestion: open them in new browser tabs):

Some notes about a javascript-based interface are here.


12. Editing XPM favicons in Emacs

Here: myxpm.el. The favicons can be seen in my main page. No docs yet.