Scheme in EMACS
Why bother?
-
Using scheme in emacs is natural.
-
They were designed for each other
-
It becomes easy to close the edit/run loop. We can flip
between edit and running a function with ease.
-
We can minimise typing by being able to redo commands
and function calls with simple keystrokes
-
We get bracket matching on the command line, minimising
errors
-
We can call back previous commands and edit them
-
minimising typing minimises typing errors and speeds us up.
-
emacs is scheme's program development environment!
Note
NOTE 1. Make sure you have my init file (/home/s7/pat/scheme/pub/ScmInit.scm) in your
home directory: ScmInit.scm
NOTE 2. Always use file with .scm extension, example
btree.scm This is because emacs will then recognise this as
a scheme file and edit/format it as such
NOTE 3. When typing in source text for a function use line feed
to get correct formatting (rather than line feed).
Otherwise put mouse on line then hit tab key
NOTE 4. Try and adopt style consistent with that used in the course
That is, use cond rather than if, close off function
on last line (not many trailing closing brackets),
feel free to use set! and do, ignore lambda (use
syntactic sugar)
running scheme: meta x run scheme
redo previous line: meta p
go back two lines: meta p meta p
go back three lines: meta p meta p meta p
go forwards one line: meta n
go forwards two lines: meta n meta n
UNIX, some useful stuff
set up tc-shell: tcsh&
(gives us ability to repeat and edit commands.)
cd dirname; change directory
cd ~ ; go to top directory
Concatenate files: cat
Copy a file: cp f1 f2
chmod 700 f: gives ME all access
chmod 755 f; gives ME all access, staff read/ex, students read/ex
Difference between two files: diff f1 f2
Direct output to a file: >
Find string in file: grep 'string' fname
head -n file gives first n lines of file
Kill printer file: lpq to get spool number then ...
lprm xxx
List all files: ls -a
List files in chrono order: ls -t
List files with long info: ls -l
paste f1 f2 gives new file with f1 before f2 record by record
Pipe to program: |
Print a file on screen: pr [-n] fname
(alternatively : page fname)
Print last 10 lines: tail fname
Purge a file: rm fname
Rename a file: mv f1 f2 looks a lot like move file f1 to f2
script filename: trace to filename, terminate with exit
Set bracket matching in vi: set sm
Spelling check: spell f1
Two Up: psnup -2 x.ps > y.ps
tvtwm& fires up window manager
Time and date: date
Who's on: who
Wild cards: * for any number of chars
Wild cards: ? for 1 char
Wild cards: [A-Z] for selection of chars
Word count: wc fname