maxima mode keybinding complaint



Raymond Toy <toy@rtp.ericsson.se> writes:

...
> Just wishful thinking on my part so I don't have to learn yet another
> keybinding. :-) Ilisp basically talks to some lisp process which is
> not unlike what we are trying to do with maxima.  But if it's very
> tightly coupled with Lisp, then it's probably too much work to get
> ilisp to work with maxima.

I don't know that for sure; I seem to recall reading that it was
non-trivial to get it working with scheme, even.  (I had tried to
install it before, but it didn't work with Emacs 21 at the time.
Perhaps I should try it again.)

>     Jay> I'm not really familiar with ilisp, so some of my comparisons may be
>     Jay> off.  But here's what I have.  Ideas?
> 
> I've only started using maxima-mode, so I don't have a lot of
> experience with it yet.  Of course, the closer it is to ilisp, the
> happier I would be, but that's up to you.

A lot of the ilisp keybindings seem to match the keybindings in the
programming modes that come with Emacs, which is something that should
be taken care of.

> Note that ilisp's prefix character is configurable.  I think the
> default is C-z.

Yes, I was looking at the fsf-compliant keybindings.  
(I think that's why some of our takes on the ilisp keybindings differ.)

>  Jay> Motion commands     Keybinding   Notes
>  Jay> ---------------     ----------   -----
>  Jay> End of form         C-cC-e       This is bound to eval-defun in ilisp,
>  Jay>                                  which corresponds to send-form.  Use
>  Jay>                                  C-cC-e for send-form, and change this
>  Jay>                                  to M-e?
> 
> M-e means forward-sentence in XEmacs.  I never use this.
> 
>  Jay> Beginning of form   C-cC-a       This is unbound in ilisp, but could
>  Jay>                                 be changed to M-a to match end of form.
> 
> M-a is backward-sentence.  Ilisp uses M-C-a to move to the beginning
> of a defun.  M-C-e moves to the end of a defun.  Is that what form
> means here?

Probably close enough.  Perhaps it should be M-C-a and M-C-e, then.

>  Jay> Beginning of sexp   C-c(         This is bound to M-C-b in ilisp.
>  Jay>                                  Change to that?
> 
> I find this easier to type and M-C-b works this way in C/C++ mode, not
> just Lisp mode.

Yes, so it should be changed.

>  Jay> Send buffer          M-C-b        There is no analogue in ilisp,
>  Jay>                                   change to C-cC-b to match C-cC-r?
>  Jay>                                   (C-cC-b is bound to "switch to lisp
>  Jay>                                   buffer"   in ilisp, which has no
>  Jay>                                   analogue in maxima mode.)
> 
> You mean C-c b?  C-c C-b is an undocumented ilisp-compile-buffer.
> This is probably pretty close to send buffer.

Okay, then, perhaps it should be C-c C-b

> Or send buffer would be analogous to selecting a region and doing send
> region and therefore not needed, except as a convenience?

It's equivalent to selecting the whole buffer as the region and
sending the region.  Nothing wrong with an extra convenience...

>  Jay> Send line            M-C-l        There is no analogue in ilisp.  
>  Jay>                                   C-cC-l is bound to "load lisp file"
>  Jay>                                   in ilisp, for which there is no
>  Jay>                                   analogue here.  Change to that?
> 
> I think you mean C-c l.  Couldn't this load up a maxima .mc or .lisp
> file into the running maxima?

Yes, it could.  I can easily add that, perhaps have maxima prompt for
a file name, and then call load?
Then send line could be C-c C-c?

>  Jay> Send line, as well  C-RET         There is no analogue in ilisp.  C-RET
>  Jay> as any nearby lines               is unbound in ilisp.  Keep?
>  Jay> needed to complete
>  Jay> form.  Go to next
>  Jay> form.
> 
> On XEmacs C-RET is bound to 'complete to complete the previous
> symbol.  I never use this, so I don't know what it does.

So, perhaps keep C-RET, then?

>  Jay> Send region, as well M-RET        There is no analogue in ilisp.  M-RET
>  Jay> as any nearby lines               is bound to some completion command
>  Jay> needed to complete                in ilisp that isn't part of ilisp.
>  Jay> form.  Go to next                 Keep?
>  Jay> form.
> 
>  Jay> Kill Maxima.         M-C-k        There is no analogue in ilisp.  This
>  Jay>                               binding could be removed, and any cleanup
>  Jay>                               could be done when the buffer is
>  Jay>                               killed.
> 
> What kind of cleanup would you need to do?  

Kill the process.  

> When I use ilisp, I just
> kill the lisp buffer.  Ilisp has C-c z to repair the connection
> (hopefully) in case things get messed up

I'll add a kill-buffer hook that will delete the process, and keep the
kill maxima command.
How do things get messed up?

>  Jay> Completion commands     Keybinding   Notes
>  Jay> -------------------     ----------   -----
>  Jay> complete symbol         M-TAB        This corresponds with ilisp.
>  Jay> (present a buffer
>  Jay> with completions)
>
>  Jay> dynamic complete        C-TAB        C-TAB is bury buffer.  Perhaps
>  Jay> (cycle through                       another binding is in order.
>  Jay> completions)                         Suggestions?  
> 
> Hmm, in my ilisp C-tab is complete symbol, same as M-TAB.

These both do that, somewhat differently, so perhaps they're okay.

>  Jay> Commenting commands     Keybinding   Notes
>  Jay> -------------------     ----------   -----
>  Jay> comment region          C-cC-c       This is bound to C-c; in ilisp.
>  Jay>                                      Change to that?
> 
> I think C-c; is also used in other modes to comment a region.

Okay, it should be changed.

>  Jay> insert long comment     C-c;         This would have to change.
>  Jay> /*                                   Change to C-c/?
>  Jay>   like this.
>  Jay> */
> 
>  Jay> insert short comment    C-c:         The colon was so it would go
>  Jay> /* like this */                      nicely with the semicolon for 
>  Jay>                                      the long comment.  Change to C-c*?
> 
> In C/C++ mode, this is M-;.

Here, Emacs would prompt you for a short comment, perhaps that should
be removed...
Anyhow, this can be changed to M-;

>  Jay> Read manual                 C-cC-i      The i was for info manual.
>  Jay>                                         Change to C-cC-m?  (Which
>  Jay>                                         is unbound in ilisp?)
> 
> If you're not on a windowing system, C-cC-i is indistinguisable from
> C-c TAB.

Actually, I think it's indistinguishable from C-TAB even on a
windowing system; at least it is for me.  C-cC-m is indistinguishable
from C-cRET, I just wrote them C-cC-letter for mnemonic reasons.

>  Jay> Completion help             f12         This is somewhat analogous to
>  Jay> (describe functions               describe-lisp or documentation-lisp, 
>  Jay> which begin with word             which are bound to C-cC-i and C-cC-f
   Jay> at point)                         in ilisp.  Change?
> 
> I almost always have this automatic so that when I press a space,
> ilisp pops up a window (or uses the modeline) to display information
> about the function.

That could be done, but then if someone defines a function which is
the prefix of a built-in function, it could get annoying.

>  Jay> Miscellaneous commands     Keybinding   Notes
>  Jay> ----------------------     ----------   -----
>  Jay> Mark form                  C-cC-f    No analogue in ilisp. Suggestions?
> 
> I always use marking and motion commands to mark a s-exp.

Actually, in Emacs lisp mode, C-M-h is mark defun.  Perhaps that
should be used here.

Daniel Martins <dmartins@lcmi.ufsc.br> writes:

> About the keybindings I have a suggestion: try to keep as close as
> possible to the keybindings of the AucTex package to edit TeX/LaTeX
> files.
>
> As ilisp does not seem  to be a unanimity among Lisp programmers (am I
> right??), I feel that TeX/LaTeX is more common. BTW maybe most of the
> users of Maxima are not Lisp programmers (my case!) but need to keep
> documentation of their work up-to-date. 

The modes for writing documents, EMaxima and MaximaDoc, use the AucTeX
keybindings, with a few additions to deal with cells.
For Maxima mode, there are very few commands which are analogous to
TeX commands.
The ones that might be comparable (that I can come up with off-hand)
are
Command                      Keybinding
-------                      ----------
Complete symbol              ESC-TAB
Kill job                     C-cC-k
Command buffer               C-cC-b
Command region               C-cC-r
Comment region               C-c;

These match the ilisp/lisp bindings, which is another reason why the
maxima bindings should be fixed (similar commands in different modes
should have the same keybindings).

> >>Completion commands     Keybinding   Notes
> >>-------------------     ----------   -----
> >>complete symbol         M-TAB        This corresponds with ilisp.
> >>(present a buffer
> >>with completions)
> 
> Most interfaces, like Gnome, use M-TAB to change windows. This problem
> can be overcome, but some novice users of Emacs and/or Maxima may
> complain about it. 

Oh, good point.
But using M-TAB for completion is a standard thing in Emacs modes
(lisp, AucTeX,...), so I'm not sure this should change.  Still, it is
a bit of a problem.

> >>Commenting commands     Keybinding   Notes
> >>-------------------     ----------   -----
> >>comment region          C-cC-c       This is bound to C-c; in ilisp.    
> >>				       Change to that?
> 
> Keep ilisp keybinding C-c; which is the same as AucTex.
> 
> To uncomment a region maybe C-c: for the same reason and then the next
> two keybindings must be appropriately changed.

Okay, that can be fixed.

>>>Completion help             f12         This is somewhat analogous to
>>>(describe functions                     describe-lisp or documentation-lisp,
>>>which begin with word                   which are bound to C-cC-i and C-cC-f
>>>at point)                               in ilisp.  Change?
>>>
>>>Apropos help                M-f12       Keep?  Change to C-cC-a?
>>>(describe functions
>>>which contain word
>>>at point)
> 
> Good for me. But again some problems can found, with the F12 key, in
> some weird keyboards throughout the world.

Okay, perhaps Completion help could be bound to f12 and C-cC-h
and apropos help could be bound to M-f12 and C-cC-a?

So, what about the following keybindings?

Motion commands     Keybinding
---------------     ----------
End of form         M-C-e
Beginning of form   M-C-a
Beginning of sexp   M-C-b
End of sexp         M-C-f

Process commands     Keybinding
----------------     ----------
Send region          C-cC-r
Send buffer          C-cC-b
Send line            C-cC-c
Send form            C-cC-e
Send line, as well   C-RET
as any nearby lines       
needed to complete
form.  Go to next
form.
Send region, as well M-RET
as any nearby lines       
needed to complete        
form.  Go to next         
form.
Kill Maxima.         C-cC-k

Completion commands     Keybinding
-------------------     ----------
complete symbol         M-TAB     
(present a buffer
with completions)
dynamic complete        C-TAB
(cycle through               
completions)                 

Commenting commands     Keybinding
-------------------     ----------
comment region          C-cC-;
uncomment region        C-cC-: 
insert long comment     M-C-;
insert short comment    M-;

Indentation commands     Keybinding
--------------------     ----------
Indent form              M-C-q   


Documentation commands     Keybinding
----------------------     ----------
describe                    C-cC-d
Read manual                 C-cC-m
Completion help             f12  and C-cC-h
Apropos help                M-f12 and C-cC-a

Miscellaneous commands     Keybinding
----------------------     ----------
Mark form                  M-C-h
Check region for           C-c)
parentheses     
Check form for             C-cC-)
parentheses
Start process/             C-cC-p
display process 
buffer