1

I'm using OSX 10.9, iTerm2, Emacs Prelude, and Clojure with all the modes that entails most relevantly, smartparens. Good so far.

The short version is: has anybody out there found a harmonious way to use all of this together with OSX Mission Control?

The longer version goes: I want to be able to use commands like sp-forward-slurp-sexp, which has a default keybinding of C-<right>, better known as the default OS-level shortcut for "switch Spaces right via Mission Control." I can re-map that fairly easily (say, to C-Shift-<right>) -- but now, I discover that C-<right> actually seems to be sending something like M-[1;4A. Instead of triggering sp-forward-slurp-sexp, you get sp-wrap-with-pair "[". Uhm.

I dug up this dissertation on re-mapping keys, which is very thorough, but also involves re-mapping rather a deal of stuff, then disabling the parts of paredit that are listening for the M-[ command. While this technically seems to work, I actually rather like having sp-wrap-with-pair enabled. Perhaps a better option would be to embrace the theoretically equivalent C-( -- except iTerm2 only interprets that as a literal 9, and C-) as 0. This SO post chews on this problem, and gets as far as a tantalizing comment suggesting that C-( and C-) simply be re-mapped to escape sequences that emacs can map back to C-( and C-) -- but frankly, I haven't a clue how to figure out what escape sequences those should be.

Bringing it all home: has anybody found a way to use all of these tools (Mission Control, iTerm2, Emacs Prelude, smartparens) together without having to re-wire or disable parts of some or most of them? Or: who has the most elegant re-wiring? Anybody figured out the C-)-to-escape-sequence-back-to-C-) trick yet?

Edit

Stabbing in the dark, I've done the following: 1. Set iTerm to send an escape sequence for the keyboard shortcut Ctrl-Shift-0 (C-S-)) of SPRTPRN. 2. Put this in my emacs config:

(define-key input-decode-map "\eSPRTPRN" [C-right-paren])
(global-set-key [C-right-paren] (kbd "C-)"))

...it does not work, but I've a hunch I'm getting closer. I think.

Edit, Again

I realized something: the notion that Shift doesn't work here doesn't make sense to me. At least on my emacs install, M-< and M-> jump to the beginning and end of a buffer, respectively -- and to use those commands, I have to actually press Meta-Shift-<. Huh.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Gastove
  • 896
  • 2
  • 10
  • 21
  • How about using `start-process` and write `osascript / apple-script` to control Mission Control instead of system wide shortcuts that conflict with Emacs? (e.g., "tell application ... mission control .. do the hokey-pokey and turn yourself around . . .") And, of course, disable any keyboard shortcuts in System Preferences (Keyboard) that are conflicting. – lawlist Dec 01 '13 at 22:41
  • That could work -- but of course, the nice part about the system wide stuff is... it works system-wide. For those times when I'm not Emacs'ing. – Gastove Dec 01 '13 at 22:46
  • Would be pretty sweet if I could get Mission Control to do the hokey-pokey, tho. – Gastove Dec 01 '13 at 22:47
  • You could pick uncommon system-wide shorcuts -- e.g., control+option+command+right-arrow – lawlist Dec 01 '13 at 22:48
  • That works for getting Mission Control out of the way -- but now I still have to figure out how to get the dang command _in to emacs_. I still get `C-)` sending just `9`. – Gastove Dec 01 '13 at 22:52
  • How about using `control+c )`, instead of just `control+)`? `(global-set-key (kbd "C-c )") "hello-world")`. I don't know if you're going to be able to use `C-)` all by itself. – lawlist Dec 02 '13 at 03:01
  • 3
    Why run Emacs inside iTerm? That seems to be the source of all your trouble! – Stefan Dec 02 '13 at 14:54
  • @stefan I'm not sure how iTerm is the problem? The native OSX terminal app doesn't do any better. Are you asking why I run it in a terminal at all? – Gastove Dec 10 '13 at 17:44
  • @lawlist So, this does work -- but it's *really* unweildy. So, technically an answer, but I'd still love to find something better. – Gastove Dec 10 '13 at 17:45
  • @Gastove: yes, I'm asking why run in a terminal at all? – Stefan Dec 11 '13 at 20:41
  • @stefan oh man. I am not real excited about getting in to the "emacs in a terminal vs. not" debate, to be honest. I work in terminals, they support my needs, and in all other ways I have a happy workflow. I'd like to leave it at that. Besides -- I'm sure there's a way to get what I'm trying to do done. – Gastove Dec 11 '13 at 21:05

0 Answers0