Changing Emac shortcut keys?

Discussion of programming Lisps using Emacs, including SLIME and other tools
speech impediment
Posts: 36
Joined: Mon May 04, 2009 5:19 pm

Changing Emac shortcut keys?

Post by speech impediment » Tue May 05, 2009 7:25 pm

Ok, Lisp in Box works fine, but now that I am working with a bit more sophisticated code (relatively, I'm about halfway through Touretzky's book), I would like to use traditional cut, copy, paste commands for Windows in emac/slime. The zxcv series is also normal for macs, so it is difficult for me to switch after using windows and macs for so long. At the gnu site, it says to type something like this: (keyboard-translate ?\C-h ?\C-?) However, I get an undefined function error when I type this in the prompt. Also, I would like to keep these settings permanent. I'm not sure how this is done either...

While I am at it, what newbie emac tutorial do you recommend that I start out with? The gnu website isn't too easy to navigate when I am just concerned with basic user issues for the moment. I'm sure I'd like to customize the emacs further to my taste.

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Changing Emac shortcut keys?

Post by gugamilare » Tue May 05, 2009 8:34 pm

speech impediment wrote:Ok, Lisp in Box works fine, but now that I am working with a bit more sophisticated code (relatively, I'm about halfway through Touretzky's book), I would like to use traditional cut, copy, paste commands for Windows in emac/slime. The zxcv series is also normal for macs, so it is difficult for me to switch after using windows and macs for so long. At the gnu site, it says to type something like this: (keyboard-translate ?\C-h ?\C-?) However, I get an undefined function error when I type this in the prompt. Also, I would like to keep these settings permanent. I'm not sure how this is done either...

While I am at it, what newbie emac tutorial do you recommend that I start out with? The gnu website isn't too easy to navigate when I am just concerned with basic user issues for the moment. I'm sure I'd like to customize the emacs further to my taste.
Actually, Linux also uses the zxcv shortcuts, but emacs' keystrokes are different. I believe the emacs tutorial itself is a good start (you can get it from the help menu, or C-h t I guess). If you are interested in learning lisp and learning emacs is not a must, at least for now, you can try Able (which is light and written in Common Lisp!) or Cusp (which uses Eclipse, the well-known Java code editor, which, in turn, is heavy). They are both more user-friendly than emacs (but less flexible, though you don't need to care with this right now) and they use normal shortcuts for cut, copy and paste.

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: Changing Emac shortcut keys?

Post by findinglisp » Tue May 05, 2009 10:24 pm

There's really not much point in cutting/pasting code in SLIME. Instead, just write code in your Lisp buffer and then C-M-x to send the code over to the SLIME inferior Lisp process (or C-c C-c if you want it compiled, but I typically just use C-M-x). Then switch to the inferior Lisp process (e.g. C-x o) and test the code from the REPL. Yes, it's different than Windows zxcv bindings, but it's actually a bit easier, IMO. There is no need to highlight the text; C-M-x takes care of sending the whole top-level form (what Emacs broadly calls a "defun" but which can include more than DEFUN forms) over to the inferior Lisp process. You can also evaluate regions and buffers at a time. See the SLIME documentation for more info on the various functions and bindings available.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

speech impediment
Posts: 36
Joined: Mon May 04, 2009 5:19 pm

Re: Changing Emac shortcut keys?

Post by speech impediment » Wed May 06, 2009 12:01 am

Um... I don't understand how that can be easier than moving code around. When I type C-M-x, it adds semicolons treating it as comments. Would I not have to remove these semicolons later? Also, I would think that sometimes it would be useful to cut/copy and paste code just because sometimes things are out of order, need to be reused, etc. I'm afraid I am at a loss at your point. :oops:

With regarding ABLE, it looks great. This is an interactive environment that is more familiar with me. I like the listener concept and separating the plain text source code in a different window from the evaluated code. It just feels cleaner to me when the two kinds of code isn't in one window. This is probably an irrational preference due to ignorance. The only slight problem is that there aren't any menus whatsoever, but I suppose I'm not going to be doing anything sophisticated for a while, so it is a good complement to slime/emacs.

Oh, there seems to be a CUA mode for emacs under the options menu, but the tech gods do not favor me and I can't see CUA mode in my options menu or submenus...

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Changing Emac shortcut keys?

Post by Paul Donnelly » Wed May 06, 2009 1:29 am

speech impediment wrote:Um... I don't understand how that can be easier than moving code around. When I type C-M-x, it adds semicolons treating it as comments. Would I not have to remove these semicolons later? Also, I would think that sometimes it would be useful to cut/copy and paste code just because sometimes things are out of order, need to be reused, etc. I'm afraid I am at a loss at your point. :oops:
He thought you were talking about copying code from a file to the REPL to evaluate it, rather than using an appropriate command (I like C-c C-c) which is a fairly common newbie mistake.

I'm not sure why C-M-x is commenting things out rather than evaluating them though... that's not right. You pressed ctrl+alt+x?

You can just type "M-x cua-mode" to enable cua-mode, but personally I'd[id] just learn Emacs.

speech impediment
Posts: 36
Joined: Mon May 04, 2009 5:19 pm

Re: Changing Emac shortcut keys?

Post by speech impediment » Wed May 06, 2009 4:47 am

I'm not sure why C-M-x is commenting things out rather than evaluating them though... that's not right. You pressed ctrl+alt+x?
Yup. Right after Lisp-in-a-box loads and gives me the CL-USER> prompt, I typed a simple function like this: (+ 1 2) and then ctrl-alt-x (held all three keys at the same time). I think it might be my version (CLISP 2.33), because not only does the cua mode command don't work, the tutorials are not in the directory when I access it through the menu or shortcut key. For now, I think I am going to use ABLE until I can better understand asdf, swank, slime, emacs, etc.

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Changing Emac shortcut keys?

Post by gugamilare » Wed May 06, 2009 7:35 am

speech impediment wrote:Yup. Right after Lisp-in-a-box loads and gives me the CL-USER> prompt, I typed a simple function like this: (+ 1 2) and then ctrl-alt-x (held all three keys at the same time). I think it might be my version (CLISP 2.33), because not only does the cua mode command don't work, the tutorials are not in the directory when I access it through the menu or shortcut key. For now, I think I am going to use ABLE until I can better understand asdf, swank, slime, emacs, etc.
Yes, I think that struggling to learn Emacs is not what you need right now. Just a note I forgot to mention, though: I am not sure which features Able has (like introspection, showing the location in your code where the error is, copying result values, ...). I know that Cusp implements all of those (it has essentially all features of slime, it uses slime in the background). So, it is your choice which you will use.

phil
Posts: 27
Joined: Wed Aug 13, 2008 1:23 pm
Contact:

Re: Changing Emac shortcut keys?

Post by phil » Wed May 06, 2009 9:25 am

speech impediment wrote:The only slight problem is that there aren't any menus whatsoever, but I suppose I'm not going to be doing anything sophisticated for a while, so it is a good complement to slime/emacs.
You're the third person to mention the lack of a menu this week and the umpteenth since I removed them (I removed them because of a crashing bug in LTK when running on OS X but I have a (messy) workaround for that now). So I should really listen to what people want and bring it back in 0.20!

speech impediment
Posts: 36
Joined: Mon May 04, 2009 5:19 pm

Re: Changing Emac shortcut keys?

Post by speech impediment » Wed May 06, 2009 1:12 pm

So I should really listen to what people want and bring it back in 0.20!
Yes, they are always a gentle introduction to any program, especially when they have short cut keys right next to the menu items so after a few clicks, the short cut keys get remembered instead of having to look up the documentation every time you forget a command. I will be checking updates for sure. :)

Oh, that was a good introductory tutorial video you had. If you are going to make another video and you want to make it extra easier for the even more clueless, I recommend telling people what you are typing that isn't on the screen, like scrolling through functions to get mapcar, initializing hyperspec, etc.

phil
Posts: 27
Joined: Wed Aug 13, 2008 1:23 pm
Contact:

Re: Changing Emac shortcut keys?

Post by phil » Wed May 06, 2009 3:17 pm

speech impediment wrote:Oh, that was a good introductory tutorial video you had. If you are going to make another video and you want to make it extra easier for the even more clueless, I recommend telling people what you are typing that isn't on the screen, like scrolling through functions to get mapcar, initializing hyperspec, etc.
Actually that's another thing people have commented on. The reason I didn't do it was because the default key bindings are Windows / GNOME friendly and because I recorded the demo on Mac, I'd rebound every shortcut so it would have been misleading. Next time I'll leave the bindings default and state what I'm doing more clearly (I say "next time" but that 7 minute video took me 3 days of 're-takes' to get even close to decent so I'm in no hurry to do another!).

Post Reply