Question

I want to bind

(defun switch-to-next-frame ()
  "Select the next frame on current display, and raise it."
  (interactive)
  (other-frame 1)
  )

to M-s in emacs? I tried:

(global-unset-key "\M-s")

but it doesn't work. The problem is - M-s is a prefix key.

Edit 2:

I made myself terribly unclear. I wanted to bind to switch-to-next-frame to M-s. I tried:

 (global-set-key (kbd "M-s") 'switch-to-next-frame)

it didn't work: emacs was doing M-s- when I had been pressing M-s. I thought - the problem was the M-s being a prefix key. I tired to unbind it - but it didn't work out. Then I came here and asked this question. As I found out later - the problem was with my .emacs - when I commented out icicles it all started to work as expected.

Edit 3:

Actually dired is realy using M-s a prefix key:

M-s a           Prefix Command
M-s f           Prefix Command
M-s f C-s       dired-isearch-filenames
M-s f ESC       Prefix Command
M-s a C-s       dired-do-isearch
M-s a ESC       Prefix Command
M-s f C-M-s     dired-isearch-filenames-regexp
M-s a C-M-s     dired-do-isearch-regexp

So binding to M-s is a realy bad idea.

Was it helpful?

Solution

The following should work:

(global-set-key [(meta s)] 'switch-to-next-frame)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top