无法在Mac OS X中的Emacs中映射Ctrl +减号 [英] Can't map Ctrl + minus in Emacs in Mac OS X

查看:126
本文介绍了无法在Mac OS X中的Emacs中映射Ctrl +减号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Ctrl + minus(C--)映射到Emacs 24.3中(从 http:// emacsformacosx .com )在Mac OS X 10.8.4中,但我无法让它工作。似乎有一些非常全球的键绑定减少字体大小,我似乎无法覆盖。任何人都可以告诉我我在做错什么?

I'm trying to map Ctrl + minus ("C--") to undo in Emacs 24.3 (from http://emacsformacosx.com) in Mac OS X 10.8.4, but I can't get it to work. There seems to be some very global key binding for decreasing the font size, which I can't seem to override. Can anyone tell me what I'm doing wrong?

我的.emacs中有以下内容。

I have the following in my .emacs.

(global-set-key (kbd "C--") 'undo)    ;; Doesn't work
(global-set-key (kbd "C-u") 'undo)    ;; Just for testing, does work

当我按Ctrl + U,它触发撤消,但当我按Ctrl +减号,减小字体大小。可能只是我应该使用C--以外的东西,但它看起来应该是有效的。我检查了密钥绑定(通过C-h b),那里有C-u必须撤消,但C--绑定到文本缩放。可能有可能找到这个键被绑定并得到一些线索,但我的Emacs-fu太弱了。

When I press Ctrl+U, it triggers undo, but when I press Ctrl+minus, it decreases the font size. It might be simply that I should use something other than "C--", but it looks like it should work. I checked the key bindings (via C-h b) and there, C-u is bound to undo, but C-- is bound to text-scale-decrease. It would probably be possible to find where that key is bound and get some clue, but my Emacs-fu is too weak.

我使用的图形版本的Emacs而不是终端版本。

I'm using the graphical version of Emacs, not the terminal version.

推荐答案

有了这些类型的问题我通常是
尝试 f1 k < kbd>,并且紧跟组合之后,我遇到问题,在您的情况下,
C -
应该发生两件事之一:

With these type of problems I usually try f1 k and right after the key combination that I'm having a problem with, C-- in your case. One of two things should happen:


  1. 没有任何事情 - 这意味着快捷方式正在截获
    操作系统的级别。

  2. 它给出了一个被调用的函数的描述。
    这可能是由您的主要模式或其中一种次要模式设置的。
    所以你也应该调查这个,以及通过参考
    搜索这个函数,这是你的情况下的 text-scale-reduce
    找到 global-set-key local-set-key define-key
    与此函数,或者注释它,或更好的只是
    调用相同的功能与相同的快捷方式和 nil 在您的〜/ .emacs

  1. Nothing happens - this means that the shortcut is being intercepted at the level of the operating system.
  2. It gives you a description of a function that's being called. It's probable that it was set by either your major mode or one of the minor modes. So you should investigate that as well, searching though the references to this function, which is text-scale-decrease in you case. After you find either global-set-key, or local-set-key or define-key with this function, either comment it out, or better just call the same function with same shortcut and nil in your ~/.emacs.



UPD:如何取消设置密钥



当您发现要加载的某些源时入门套件正在设置密钥
,您只需要以相同的方式取消设置:

UPD: how to unset a key

When you find that some source that you're loading e.g. starter-kit is setting the key, you just need to unset it later in the same way:


  1. 如果设置为(global-set-key(kbdC--)'text-scale-reduced)
    你用(global-set-key(kbdC--)nil)取消设置

  2. 如果被设置为(define-key markdown-mode-map(kbdC--)'text-scale-descrease)
    你将其设置为(define-key markdown-mode-map(kbdC--)nil)

  3. 如果设置与

  1. If it was set with (global-set-key (kbd "C--") 'text-scale-decrease), you unset it with (global-set-key (kbd "C--") nil).
  2. If it was set with (define-key markdown-mode-map (kbd "C--") 'text-scale-descrease), you unset it with (define-key markdown-mode-map (kbd "C--") nil).
  3. If it was set with

(add-hook'markdown-mode-hook
(lambda()(local-set-key(kbdC--)' -scale-descrease))

(add-hook 'markdown-mode-hook (lambda()(local-set-key (kbd "C--") 'text-scale-descrease))

您未设置

(add-hook'markdown-mode-hook
(lambda()(local-set-key(kbdC--)nil))

(add-hook 'markdown-mode-hook (lambda()(local-set-key (kbd "C--") nil))

这篇关于无法在Mac OS X中的Emacs中映射Ctrl +减号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆