Home » Questions » Computers [ Ask a new question ]

Using C-M-% to do a query-replace-regexp in Emacs running in Mac terminal

Using C-M-% to do a query-replace-regexp in Emacs running in Mac terminal

I am trying to do a regular expression search-and-replace in Emacs, running in the Terminal program on my MacBook Pro, which is running OS X 10.6.2. As far as I know, this can be done by pressing C-M-% (I am assumimg this means Ctrl+Alt+Shift+5. Please correct me if I am wrong, since I am only starting to learn Emacs). However, when I do that, it doesn't work.

Asked by: Guest | Views: 316
Total answers/comments: 1
Guest [Entry]

"Have you tried <esc> C-%? It works for me.

The escape key is often mapped to meta (and alt (option on a mac) is not always mapped to meta). The only thing is that you don't hold it down like a shifting key, you just hit it.

BTW--If you are used to using alt as meta, the follow on question is ""How do I map alt to meta in the mac terminal?"" Which I believe has been asked on Stack Overflow long ago: Option or Command key as Meta key for LispBox on Macintosh suggests putting (setq mac-command-modifier 'meta) in your .emacs file."