aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorlukeg <lukeg>2003-02-21 19:01:14 +0000
committerlukeg <lukeg>2003-02-21 19:01:14 +0000
commite7d48fe500f6ed676ee1b212ebd61408bced1c5b (patch)
tree11a756c7bb4906f3e186c1cb8331cb7ed27bc69c /doc
downloadermacs-fork-e7d48fe500f6ed676ee1b212ebd61408bced1c5b.tar.gz
*** empty log message ***
Diffstat (limited to 'doc')
-rw-r--r--doc/DESIGN36
-rw-r--r--doc/TOUR115
-rw-r--r--doc/TROUBLESHOOTING11
3 files changed, 162 insertions, 0 deletions
diff --git a/doc/DESIGN b/doc/DESIGN
new file mode 100644
index 0000000..d33c28c
--- /dev/null
+++ b/doc/DESIGN
@@ -0,0 +1,36 @@
+Notes on how this bastard works
+===============================
+
+Overview:
+
+The editor is based on Emacs: same sort of buffers, similar commands, etc.
+It's written in Erlang and uses the S-Lang library for terminal control.
+
+Essential facts:
+
+- Text is stored as a tree of binaries
+- Buffers are small servers and are destructively updated (.. for now?)
+- Commands are executed serially, but buffers can be "loaned" to other
+ processes to work on them asynchronously.
+
+Hacking:
+
+To see how commands are implemented, look at the edit_lib module, it contains
+all the most basic commands. A rundown of the most important modules:
+
+* edit: where it all begins, and main editor loop.
+* edit_lib: basic command implementations
+* edit_eval: erlang shell mode
+* cord: text data structure
+* edit_buf: buffer server
+* edit_globalmap: standard keymap definitions - look there to see what exists.
+* edit_display: screen redraw
+* edit_extended: "interactive" command runner (shows how to use minibuffer)
+* edit_var: emacs-style variables (optionally persistent)
+
+Programming style:
+
+I've gone with do-it-yourself servers and message sending in a lot of places.
+I'd like to keep it that way, at least for now. It feels good to use
+selective receives and whatnot :-)
+
diff --git a/doc/TOUR b/doc/TOUR
new file mode 100644
index 0000000..4f61132
--- /dev/null
+++ b/doc/TOUR
@@ -0,0 +1,115 @@
+Interactive tour of the editor!
+
+Motion
+------
+
+Like emacs.
+
+Erlang Evaluation
+-----------------
+
+In emacs M-: lets you enter a lisp expression in the minibuffer. In ermacs
+it lets you enter an erlang expression.
+
+Try it, e.g:
+
+ M-: os:type(). RET
+
+There's also an erlang-interaction-mode. You can enter it by pressing
+"C-x i", and get back to Fundamental mode with "C-x f".
+
+Erlang interaction mode is an erlang shell, and its prompt looks like this:
+
+>> foo.
+
+When you press return in Erlang Interaction mode, it evaluates the expression
+between the point and the prompt (or start of buffer) and shows the result.
+
+Try it: now press "C-x i". Now press return at the end of the following line:
+>> (fun(X) -> X + 5 end)(10).
+
+And now press "C-x f" to get back into fundamental mode.
+
+In erlang-interaction-mode, your history is recorded. You can use:
+
+ M-p: previous input
+ M-n: next input
+ M-r: regexp search backwards through input history
+
+If you want, you can make this history persistent so that it's stored in a
+dets file in your home directory. To do that, go into erlang interaction mode
+and hit enter at the end of the following line.
+
+>> edit_var:permanent(erlang_interaction_history, true).
+
+Asynchronous I/O works too:
+
+>> spawn(fun() -> receive after 1000 -> io:format("bar~n") end end).
+
+Erlang Indentation
+------------------
+
+The editor can indent erlang code. To enter erlang-mode, press "C-x e". Then
+you can hit tab to indent these lines:
+
+one() ->
+ok.
+
+two(X) when X > 0,
+X < 10 ->
+X.
+
+three(X) ->
+[Y*2 || Y <- make_list(),
+Y < 10].
+
+four() ->
+if X == 1 ->
+if Y == 2 ->
+ok;
+Z == 3 ->
+ok
+end
+end.
+
+five([]) ->
+0;
+five(List) ->
+Sum = lists:foldl(fun(X, Sum) ->
+X + Sum
+end,
+0,
+List),
+Sum / length(List).
+
+six(X) ->
+if X /= 1,
+X /= 2 ->
+X;
+true ->
+3
+end,
+six.
+
+Windows
+-------
+
+You can split windows.
+
+Type "C-x 2". Now type "C-x 0".
+
+Notice that if you scroll one window, the other scrolls too. This is a bug :-)
+
+Multiple buffers
+----------------
+
+You can use "C-x C-f" to open a new file, and then "C-x b" back here
+as you would in emacs (but without the completions).
+
+Other stuff
+-----------
+
+To see what else there is, look in the keymap definition:
+
+ C-x C-f ../src/edit_globalmap.erl RET
+
diff --git a/doc/TROUBLESHOOTING b/doc/TROUBLESHOOTING
new file mode 100644
index 0000000..27997ac
--- /dev/null
+++ b/doc/TROUBLESHOOTING
@@ -0,0 +1,11 @@
+Random notes on trouble shooting:
+
+- io:formats go to /tmp/edit.out, which is re-created from scratch each time.
+
+- Sometimes colours go strange, particularly (for me) when running in a
+ shell on a remote machine. When this happens to me in xterm, I retry in
+ rxvt and it tends to work. However, on *my* computer the colours are ok :-)
+
+ Presumably some extra initialisation of the SLang library is needed.
+
+