Saturday, April 09, 2005

More lost keys

First up today, some minor tweaks to my .emacs file. Moving to the beginning and end of the buffer isn't working with my normal Ctrl-Home and Ctrl-End (or rather Ctrl-Fn-Left and Ctrl-Fn-Right) bindings, and a quick Ctrl-H, K (also known as describe-key) reveals that keys are coming in as <kp-home> and <kp-end>
  (define-key global-map [C-kp-home] 'beginning-of-buffer)
  (define-key global-map [C-kp-end]  'end-of-buffer)

Next is to set up some sort of delete-right key, because I'm used to having both a backspace and a delete key on my other keyboards. Again, Ctrl-H, K reveals that the raw backspace key is giving <backspace>, and Fn-backspace is giving <kp-delete>, so in goes:

  (define-key global-map [kp-delete] 'delete-char)

At the moment, I'm still not sure whether I'm going to want the Apple/command key or the Alt key as the Emacs meta key, so I'm still bouncing between (setq mac-command-key-is-meta 't) and (setq mac-command-key-is-meta nil).

Finally for today's keyboard tweaking, I need a way of switching between insert and overwrite mode—you know, the thing which that handy key labelled "Insert" does. For the moment, I'm going to hijack the key just to the right of the right-hand command key, which Emacs tells me is <kp-enter>:

  (define-key global-map [kp-enter] 'overwrite-mode)

Now I need a way of putting all of this stuff inside a conditional, so that I can use the same .emacs across all my different machines. Looks like system-configuration is the right thing to look at—on the Powerbook it's coming out as "powerpc-apple-darwin7.4.0" (whereas my Linux box gives "i386-redhat-linux-gnu"). So
  (setq on-mac (string-match "powerpc-apple" system-configuration))
seems to do the trick.

0 Comments:

Post a Comment

<< Home