-
Notifications
You must be signed in to change notification settings - Fork 7
/
osx.haml
83 lines (65 loc) · 3.7 KB
/
osx.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
%h1 OS X
%h2 Control and Command keys
Mac keyboards conveniently have separate Control, Meta (a.k.a. Option or Alt)
and Command (⌘) keys. You have the traditional Emacs bindings on Control and
Meta, and the OS X bindings on Command.
As recommended previously, you should strongly consider re-binding Caps Lock
to Control, system-wide. Go to System Preferences > Keyboard > Modifier Keys.
On a laptop's smaller keyboard there is no Control key for the right hand. Good
ergonomic practice is to use a right-hand Control key with a left-hand normal
key, instead of stretching your left hand. You can use the open-source
[KeyRemap4MacBook]( http://pqrs.org/macosx/keyremap4macbook/index.html) to bind
your Return key to an additional Control—but only when held down; hitting it
once still registers as Return. Try it! It's not as crazy as it sounds.
KeyRemap4MacBook, despite its name, works on any recent Mac.
After you have passed the initial learning curve and are used to the Emacs
bindings for opening, saving, copying, cutting, pasting, and undo, you may want
to re-bind the Command keys to be additional Meta keys, simply to offer a
larger target for your fingers:
.titlebar<
init.el
.window<
:preserve
(setq mac-command-modifier 'meta)
(global-set-key (kbd <span class="string">"M-`"</span>) 'other-frame)
(The second line keeps the very useful ⌘-\` behavior.)
-#
Rebinding Command in this way won't work when running Emacs inside a terminal,
as the terminal program will intercept the Command keybindings.
If you choose to leave the Command modifier alone, you might want to rebind
`⌘-q` because it is so close to the frequently-used `M-q`. Or at least make
Emacs prompt before quitting:
.window<
:preserve
(setq confirm-kill-emacs 'y-or-n-p)
%h2 System-wide PATH
When you start Emacs.app from the Finder (or the Dock, or Spotlight) the
environment doesn't contain customizations from your `.bash_profile` or
`.bashrc` files. If you run a shell inside Emacs (`M-x shell`) that shell
*will* load your `.bashrc`, but other Emacs commands like `shell-command`,
`grep` and `compile` won't.
You can modify Emacs's environment directly in your init file:
.window<
:preserve
(setenv <span class="string">"PATH"</span> (concat (getenv <span class="string">"HOME"</span>) <span class="string">"/bin:"</span>
<span class="string">"/opt/local/bin:"</span>
(getenv <span class="string">"PATH"</span>)))
You can also set environment variables to apply to any OS X application in your
login session, by creating the file `~/.MacOSX/environment.plist`:
.titlebar<
\~/.MacOSX/environment.plist
.window<
:preserve
<?xml <span class="bold">version</span>=<span class="string">"1.0"</span> <span class="bold">encoding</span>=<span class="string">"UTF-8"</span>?>
<!DOCTYPE plist PUBLIC <span class="string">"-//Apple//DTD PLIST 1.0//EN"</span>
<span class="string">"http://www.apple.com/DTDs/PropertyList-1.0.dtd"</span>>
<<span class="bold">plist</span> <span class="bold">version</span>=<span class="string">"1.0"</span>>
<<span class="bold">dict</span>>
<<span class="bold">key</span>>PATH</<span class="bold">key</span>>
<<span class="bold">string</span>>/usr/bin:/bin:/usr/sbin:/sbin</<span class="bold">string</span>>
</<span class="bold">dict</span>>
</<span class="bold">plist</span>>
%h2 Running Emacs from the command line
If you're using Emacs.app installed by macports, you can find the command-line
version in `/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs`. (Useful
when you need to run Emacs with certain command-line switches, like `-Q`).