DEV Community

Your first taste of emacs

Shane Kennedy on February 08, 2022

This is a repost from Junior Developer Diaries, head over there to see more tutorials, tips and tricks I wish I had when starting out. Fo...
Collapse
 
ankush981 profile image
Ankush Thakur

Things went south for me when trying to press M-x. I only got a weird character and finally gave up. I'm willing to put in the effort for learning vi/emacs, but I don't enjoy these stumbling blocks for every small thing. :(

Collapse
 
shaneikennedy profile image
Shane Kennedy

Interesting! What key did you use for M? The default on a Mac is the option key, but right at the beginning I remap it to command, so I'm wondering if that has something to do with it. Also, are you running emacs as its own client or running it in the terminal?

Good feedback! If I can help understand better I'll update the post :)

Collapse
 
ankush981 profile image
Ankush Thakur

I used the Option key and also tried the Meta key with no success. I think the problem is that I was inside the file buffer in edit mode (to borrow a vi term!) which is why the key combination produced just a stupid-looking character and wasn't interpreted as a command? In any case, you wrote a brilliant and highly enthusiastic tutorial that got me fired up once more despite countless previous bad experiences.

Thread Thread
 
shaneikennedy profile image
Shane Kennedy

Thanks for the kind words I'm glad you liked it :)

When I try option+x I get the weird character that you mention but command+x still works for me :/ Assuming you copied the code in this tutorial, it sounds like you copied the part where I remap command to "meta" and leave option as nothing, I would try making sure that both all of that lisp code is evaluated; I'm wondering if your emacs is in some weird state where you've unmapped the option key but not mapped the command key.. Try the tutorial from scratch (make sure to remove the .emacs file in your home directory) and when it comes to the section about remapping keys make sure to use M-x eval-buffer so that everything gets evaluated.

Thread Thread
 
ankush981 profile image
Ankush Thakur

I did that but found myself just typing the words into the file buffer (I think). I seem to be not switching to any eval-buffer or anything special by pressing M-x. Sorry, but I've given up for now. 😂 Thanks for your time! It was definitely worth the effort. I've seen Emacs wizards at work and it's a tool I'll revisit later for sure. 🙂

Collapse
 
shaneikennedy profile image
Shane Kennedy

Thanks :) I'm writing some java at work atm and intellij's refactoring tools are just too nice when doing bigger refactorings, but I still always do my git work in magit, 10/10 tool <3

Collapse
 
thumbone profile image
Bernd Wechner • Edited

Small tip 1: kill=cut not copy. And if raising that vocab at all, why not link to a nice page describing it? That's how to farm out complex history for readers who do want to know. Emacs lacks a term for copying as far as I can see, describing it instead as saving to the kill-ring (what it calls its equivalent of the clipboard).

Small tip 2: It's nice and all that you use a Mac but last I checked it had some 9.5% of the market share and the remaining 90.5% pretty much all use the same keyboard that we might call the not-Mac keyboard but which today even if you're on a *nix system (in any of its gazillion forms from servers to Rpis) you almost certainly have a Windows key:

keyboard

as pretty much any and every generic keyboard I've seen in donkey's years had those.

So it's worth, unless pitching articles at that 9.5% alone, to do a quick check on what default as the emacs M- key on such keyboards. My guess is it would be the Win Key, but hey, to work it out I just installed emacs and tried. Turns out it mapped by default to the Alt key. So M- is ALT+ in more customary syntax.

Aside from that, nice article good work, always nice to see some enthusiasts trying to make free and established if less well known tech accessible. It should be added IMHO that emacs is also historically and primarily IMHO targeted at the text console environment and hence is possibly a useful skill in environments where no Windowing system is available. That said, to try it out when one is available you need to start it with -nw.

Collapse
 
shaneikennedy profile image
Shane Kennedy

Thanks for the detailed feedback :) I'll update the kill/yank text to be cut/paste and add a link for further reading, I think that's a good idea so thanks for that !

Collapse
 
azlan_syed profile image
Azlan-Syed

well didn't use it but good article

Collapse
 
dansvel profile image
dan

or,, you can check
spacemacs.org
Spacemacs: Emacs advanced Kit focused on Evil

Collapse
 
shaneikennedy profile image
Shane Kennedy

I link to spacemacs (and doom, but never used myself) at the bottom of the post, spacemacs is very well done ! :)