Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and...
Transcript of Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and...
![Page 1: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/1.jpg)
Being Productive With EmacsPart 2
Phil Sungsipbiap[email protected]
http://stuff.mit.edu/iap/emacsSpecial thanks to Piaw Na and Arthur Gleckler
![Page 2: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/2.jpg)
Previously...● Emacs as an editor
– Useful features– Motifs in emacs– Learning more
![Page 3: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/3.jpg)
Previously...● Acquiring Emacs
– Already installed on Athena (v.21)– Ubuntu: emacssnapshotgtk package (v.22)– Gentoo: emacscvs package (v.22)– Windows: EmacsW32 installer
![Page 4: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/4.jpg)
Previously...● Learning more about emacs
– Look up an existing function or key● Ch f, Ch k
– Apropos (search for commands)● Ch a
– Help about help facilities● Ch Ch
![Page 5: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/5.jpg)
Previously...● Learning more about Emacs
– Emacs tutorial● Ch t
– Emacs manual● Mx info, select emacs
![Page 6: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/6.jpg)
Previously...● If you're stuck...
– Cancel: Cg– Undo: C/ or C_
![Page 7: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/7.jpg)
Today● Customizing Emacs● Elisp basics● Defining a new command
![Page 8: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/8.jpg)
Customizing Emacs● Almost every aspect of the editor can be
customized– More finegrained control than major/minor modes– In general, use Mx evalexpression– Show trailing whitespace on lines(setq showtrailingwhitespace t)
– Show column numbers in mode line(columnnumbermode t)
![Page 9: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/9.jpg)
Customizing Emacs● Customization buffer: Mx customize
– Browse, point and click for customization options– No elisp necessary, but capabilities are limited
![Page 10: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/10.jpg)
Review: running elisp code● Evaluate elisp with Mx evalexpression
– Example function call: (+ 2 4 6)● Get or set variables:
– sentenceenddoublespace– (setq inhibitstartupmessage t)
● Sometimes these correspond to commands:– (forwardchar) is same as Cf orMx forwardchar
![Page 11: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/11.jpg)
Writing elisp code● Use the *scratch* buffer for playing with
elisp– Cx Ce to evaluate– Move to ~/.emacs for permanent changes
![Page 12: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/12.jpg)
Your .emacs file● Cx Cf ~/.emacs
● Elisp code here is loaded when Emacs starts– Run any valid lisp code here– Set variables, keybindings to your liking– Define your own commands
● Mx customize works by adding code to your .emacs
![Page 13: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/13.jpg)
Why bother with elisp?● Macros record and play back key sequences
– Start recording macro: Cx (– Stop recording macro: Cx )– Execute last macro: Cx e
● Great for automating tedious tasks– Cx e e e ...– Cu 100 Cx e
![Page 14: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/14.jpg)
Macro example6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc
6.00 programming
6.001 sicp
6.002 circuits
6.003 linearsystems
6.004 digital
6.011 signalproc
M-f M-f M-d C-n C-a repeatedlyLet's remove this
column
![Page 15: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/15.jpg)
Why elisp?● Macros only repeat canned key sequences● Sometimes you need:
– Calculations– Control flow– User interaction– Additional features– Maintainability
![Page 16: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/16.jpg)
Elisp is...● an implementation language● a customization language● an extension language
![Page 17: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/17.jpg)
Elisp for implementation● Example: Mx calc
– Ch f to see where calc is defined– RET on filename in help buffer to view source code
![Page 18: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/18.jpg)
Elisp for customization● Set variables and options● Persistent customizations can go in .emacs● Compare to Mx customize
![Page 19: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/19.jpg)
Elisp for extensions● Alter behavior of existing commands● Define your own commands, functions● Define new modes
![Page 20: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/20.jpg)
Why elisp?● It's the implementation language● Dynamic environment
– No need to recompile/restart emacs– Easily override or modify existing behaviors
● Simple oneliners are sufficient to do a lot!
![Page 21: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/21.jpg)
Getting started● Similar to lisp and scheme● Use *scratch* buffer as a temporary work space
– or activate lispinteractionmode anywhere
– Cx Ce after an expression to evaluate it– or use Mx evalexpression (M:)
● Example: setting a variable– (setq undolimit 100000)
![Page 22: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/22.jpg)
Getting started● Evaluating an expression can mean
– Performing some computation/action– Displaying the value of a variable– Defining a function for later use
![Page 23: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/23.jpg)
Basic elisp● These are expressions (“atoms”)
– 15– “Error message”– bestvalue
● These are also (“compound”) expressions– (+ 1 2)– (setq includeallfiles t)
![Page 24: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/24.jpg)
Setting variables● Set variable by evaluating(setq undolimit 100000)
– i.e. do M: (setq ...) [RET]● Read variable by evaluating undolimit
– i.e. do M: undolimit [RET]● Find out more about any variable with Ch v
![Page 25: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/25.jpg)
Common customizations● Configuration options● Set your own keybindings
![Page 26: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/26.jpg)
Configuration options● Some customizations are done by setting
variables– (setq undolimit 100000)
– (setq enablerecursiveminibuffers t)
– (setq fillcolumn 80)
![Page 27: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/27.jpg)
Configuration options● Other options are exposed as their own
functions– (menubarmode nil) (Hide menu bar)– (icompletemode)
(Show completions continuously)– (serverstart) (Start emacs server)
![Page 28: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/28.jpg)
More about variables● Many variables are boolean
– Usually a distinction is only made between nil and nonnil values (e.g. t)
● Look in function documentation to see which variables can alter the function's behavior
● Ch v to get documentation for a variable
![Page 29: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/29.jpg)
Key bindings● We've seen two ways to invoke commands
– Cx n w (key invocation)– Mx widen (Mx invocation, or invoking by name)
● Emacs binds each key to a command in a keymap– A keymap can be specific to a mode or feature– Bindings may be changed at any time
![Page 30: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/30.jpg)
Customizing key bindings● (globalsetkey [f2] 'splitwindowhorizontally)
● (globalsetkey "\Co" 'findfile)● (globalsetkey "\Cx\C\\" 'nextline)
binds to C-x C-\
![Page 31: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/31.jpg)
Customizing key bindings● A binding can be set to apply only in a particular mode
– (definekey textmodemap "\Ccp" 'backwardparagraph)
binds to C-c p
![Page 32: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/32.jpg)
Keybindings● What keys can you assign?
– Reserved for users:● Cc [letter]
– Reserved for major and minor modes:● Cc C[anything]● Cc [punctuation]● Cc [digit]
![Page 33: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/33.jpg)
Calling commands● Any command you use can be invoked
programmatically by elisp– Often, Mx myfunction is accessible as(myfunction)
– For key commands, look up the full name first● Use commands as building blocks for more
complex behaviors
![Page 34: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/34.jpg)
Hooks● Specify a custom command to run whenever a
particular event occurs, e.g.– when a particular mode is entered– when any file is loaded or saved– when a file is committed to CVS
![Page 35: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/35.jpg)
Hooks● (addhook 'vccheckinhook '(lambda () (sendemailtogroup)))
![Page 36: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/36.jpg)
Hooks● (addhook 'javamodehook '(lambda () (setq indenttabsmode t) (setq tabwidth 4) (setfillcolumn 80)))
![Page 37: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/37.jpg)
Hooks● General template
– (addhook 'nameofhook'(lambda () (dothis) (dothat) (dotheotherthing)))
![Page 38: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/38.jpg)
Hooks● To find available hooks:
– Every major mode has a hook– Mx aproposvariable and search for
"hook"
![Page 39: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/39.jpg)
Defining your own functions● (defun functionname (arg1 arg2 ...) “Description of function” (dothis) (dothat) (dotheotherthing))
● Invoke with:(functionname one two ...)
![Page 40: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/40.jpg)
Strategy for making functions● Find key commands that would have desired
result● Replace key commands with elisp function calls
![Page 41: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/41.jpg)
A simple function● (defun capitalizebackwards () "Capitalize last letter of a word." (backwardword) (forwardword) (backwardchar) (capitalizeword 1))
![Page 42: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/42.jpg)
Not every function is a command● Functions need arguments:
– (defun square (x) (* x x))(square 5) ==> 25
● Commands don't say what arguments to substitute– Mx square ==> ??
● Interactive specification needed to say what arguments to fill in
![Page 43: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/43.jpg)
A simple command● (defun capitalizebackwards () "Capitalize last letter of a word." (interactive) (backwardword) (forwardword) (backwardchar) (capitalizeword 1))
![Page 44: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/44.jpg)
Problem● This command moves the cursor
– This can be distracting if the user isn't expecting it
![Page 45: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/45.jpg)
Restoring the cursor● (defun capitalizebackwards () "Capitalize last letter of a word." (interactive) (saveexcursion (backwardword) (forwardword) (backwardchar) (capitalizeword 1)))
![Page 46: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/46.jpg)
Useful functions● (point)● (pointmax)● (currentbuffer)● (message “This is the answer: %s” answer)
![Page 47: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/47.jpg)
Local variables● (let ((a newvalue) (b anothervalue) ...) (dosomething) (dosomethingelse))
![Page 48: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/48.jpg)
Example: counting word length● (defun wordlength () "Prints the length of a word." (interactive) (saveexcursion (backwardword) (let ((a (point))) (forwardword) (let ((b (point))) (message "Word is %d letters" ( b a))))))
![Page 49: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/49.jpg)
Getting help with elisp● Manuals
– Mx info, then select elisp or eintr● Learning by example
– Function documentation (Ch f or Ch k) always gives a link to the function's source code
![Page 50: Being Productive With Emacsweb.psung.name/emacs/2007/emacs-slides-2.pdf · Similar to lisp and scheme Use *scratch* buffer as a temporary work space – or activate lispinteractionmode](https://reader035.fdocuments.in/reader035/viewer/2022070114/60891bc1fd6e2507dc5dc1d3/html5/thumbnails/50.jpg)
Next week...● Control flow● User interaction● Commands for manipulating text● Other extension methods