在Mac上使用XQuartz打开安装在远程服务器上的emacs时,将元素更改为选项键

我的问题是这样的:首先,我通过使用Mac上的Terminal.app通过ssh -Ylogin到远程服务器。 然后打开安装在远程服务器上的emacs

emacs 

由于我在使用ssh时添加了-Y选项,因此在安装在Mac上的XQuartz中打开了emacs。

此时,问题出现了:选项键不被视为Meta,只有ESC键被视为Meta。 但是我想用选项键作为Meta。

我该如何解决?

看看http://www.emacswiki.org/emacs/MetaKeyProblems

具体这个部分。

然后,您可以使用选项/ alt键作为元键从X11窗口(Applications / Utilities / X11.app)运行emacs。 此外,可以使用xmodmap命令将命令键重新映射到仅在X11下的“控制”。 这具有允许命令键与其他Mac应用程序预期行为的优点。 xmodmap也可以确保Alt / Option键被设置为emacs中的Meta键。 你可以用下面的〜/ .xmodmap文件来做这件事(以感叹号开头的行是注释,可以省略):

 ! undo any meta keys already set clear Mod1 ! keycodes 63 and 71 are the left and right COMMAND buttons adjacent to the spacebar; set them to be control keys keycode 63=Control_L keycode 71=Control_R ! keycodes 66 and 69 are the option/alt keys; assign them as Meta keys keycode 66=Meta_L keycode 69=Meta_R ! now tell X11 that the Meta keys act as the Mod1 (meta) modier key; that is, when they are pressed with KEY, it is the same as hitting M-KEY add Mod1 = Meta_L Meta_R ! tell X11 that the Control keys are Control modifiers, so when pressed with u (for example) it is the same as hitting Cu add Control = Control_L Control_R 

使用上述文件与命令

 xmodmap ~/.xmodmap 

在启动emacs之前(例如,如果您使用xterm的登录shell选项,则从/ etc / bashrc启动,例如X11 / Application / Customize for terminal中的xterm -ls)。