Added Evaluate DWIM (Do What I Mean) functions

"Clementson, Bill" <[email protected]>
Newsgroups gmane.lisp.ilisp.devel
Message-ID <[email protected]>
There are 9 different eval functions in ilisp with separate commands
(and key bindings) to evaluate:
1. The last sexp (with and-go companion)
2. The next sexp (with and-go companion)
3. The defun (with and-go companion)
4. The current region (with and-go companion)
5. Any changes 

Although the new fsf keybindings make it easier to remember which key is
bound to which function, I thought it might be nice to have an evaluate
binding that just "did what I meant". So, I created one (with and-go
companion) and have posted it to cvs. The new functions are
eval-dwim-lisp and eval-dwim-and-go-lisp and they are bound to "C-c C-j
C-j" and "C-c C-j j" respectively in the fsf key bindings. They should
be considered "convenience" functions rather than replacements for any
of the other functions. 

It is important to understand when using these commands that, when the
command is executed, it does an evaluation based on the following
criteria:

1. If a region is selected, evaluate the region.  
2. If the cursor is on or immediately after a ')', evaluate the last
sexp.  
3. If the cursor is on or immediately before a '(', evaluate the next
sexp. 
4. If the cursor is inside a defun, evaluate the defun. 
5. If the cursor is inside a top-level sexp, evaluate the top-level
sexp. 

Tests are done in the order specified above so, if there is any
ambiguity, make certain that the cursor is either on a parenthesis (for
the eval last/next commands) or not directly before/after/on a
parenthesis (for the eval defun/top-level commands).

This function can be used in place of the 8 functions covered by items
#1-#4 above - the only one that it doesn't cover is the eval changes
commands (#5 above). I've found this binding much easier to use during
edit sessions. Hope others find it useful too. 

--
Bill Clementson


-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.