You can find precompiled versions of emacs and Emacs.app at. I can't pretend that keyboard configuration for Emacs on Mac isn't something of a Battle Royale, but with a bit of playing around you will get something that works for you in the end.The official Emacs fully supports Mac OS X (along with GNU/Linux, Windows, DOS, and then some). (global-set-key (kbd "M-,") 'beginning-of-buffer) (global-set-key (quote beginning-of-buffer)) We also configured M-up and M-down for both the Terminal and Desktop version.įor your convenience here's the complete config: get hash key working on Apple Mac! So we configured Emacs so the '#' key worked. emacs file and they will work quite happily together. But the two configurations can remain in your. This won't work in the Terminal version as we currently have it configured though due to that "Use Option as Meta key" thing we checked. You can achieve the same thing in the desktop version using a slightly different configuration: (global-set-key 'beginning-of-buffer) ![]() We are treating the Meta key slightly differently in the Terminal version. Still, it should be possible to achieve the same effect. Well the first thing we did was configure Terminal to 'Use Option as Meta key'. When you fire up the Desktop version of Emacs you'll find the previous key setup no longer works - you can't jump to start and end of buffer using M-up or M-down. However, if you then use the desktop version of Emacs on Mac this will not work. This works well in the Terminal version of Emacs. You can now easily jump to the start or end of a buffer with M-up or M-down (Meta and up arrow key or Meta and down arrow key). So you want to configure M-up as 'go to start of buffer' and M-down as 'go to end of buffer', you could use some config such as: (global-set-key (quote beginning-of-buffer)) Here you are using the same keys but without the for the additional shift.īut I prefer the use of M-up and M-down (Meta with the arrow keys). (global-set-key (kbd "M-.") 'end-of-buffer) ![]() You can fix that issue with: (global-set-key (kbd "M-,") 'beginning-of-buffer) I personally find the default key options of M- to be awkward as they require the use of the shift key. ![]() If you only ever use the terminal version of Emacs then everything is plain sailing, more or less, from now on. Make sure that checkbox is ticked and lo and behold your option key now works correctly as the Emacs Meta key. Well there's a sneaky little keyboard config option in the Terminal Preferences (Terminal/Preferences/Keyboard) known as 'Use Option as Meta key'. So, how to get around this conflict between Option and Meta in the terminal? There is thus a conflict here where Mac wants to use the option key as, well, the option key, and Emacs wants to use it as the Meta key. So, for example, to execute a command in Emacs you would use M-x where M is the Meta key, which is the option key on Mac. Both Ctrl and Alt keys, or C and M as they are usually designated in Emacs are the two most important keys in Emacs. On PC type keyboards the option key is actually the alt key and is also next to the Ctrl key which makes it very convenient for Emacs users. Another complication.Īnyway, the option key is normally designated as the very important Meta key in Emacs. ![]() In other countries this may well be different. The problem at this point, if you are running Emacs in a terminal, is that the key combination you use to insert a '#' character is the Mac option key followed by the '3' key, also marked '£' and '#' if you are in the UK. (global-set-key (kbd "M-3") '(lambda () (interactive) (insert "#")))Īh, so now we have a working '#' character at least! Or do we? Terminal Emacs emacs file: get hash key working on Apple Mac! The easiest solution I have come across is to insert the following line of Elisp into your. When you start using Emacs on the Mac, one of the first issues you run into is how to get the darn '#' character to work! It seems like such a basic thing. This article assumes you know a bit about Emacs such as the importance of the Control and Meta keys as used for correct Emacs operation. I also used to be an avid user of Aquamacs before I had problems with upgrading it, so a cross-Emacs configuration is certainly a very nice thing to have. This is tricky with the terminal version of Emacs, especially when you have split frames. Although I mostly use Emacs in the terminal, there have been a number of occasions where working with the Desktop (Cocoa) version of Emacs is useful - mainly when I wanted to copy and paste large blocks of code to another app. For example, things might be simpler if you only ever use Terminal Emacs. A rite of passage, and some would say trial by fire, of working with Emacs on Mac, is getting your keyboard configuration set up correctly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |