【问题标题】:Emacs can't reset Ctrl-d key behaviourEmacs 无法重置 Ctrl-d 键行为
【发布时间】:2013-01-20 03:46:24
【问题描述】:

我想改变 Ctrl-d 键的行为。所以它会向后删除一个单词。我创建了一个函数:

(defun backward-delete-word (arg)
      "Delete characters backward until encountering the beginning of a word.
With argument ARG, do this that many times."
      (interactive "p")
      (delete-region (point) (progn (backward-word arg) (point))))

然后将其插入emacs.d:

(global-set-key (kbd "\C-d") 'backward-delete-word)

它在基本模式下工作,但在 php 模式下它只是删除下一个字符。当我点击

Ctrl-h k Ctrl-d

Emacs 给出了这个:

C-d runs the command c-electric-delete-forward, which is an
interactive compiled Lisp function in `cc-cmds.el'.

It is bound to C-d.

(c-electric-delete-forward ARG)

不知何故,它被重置为另一个功能。如何找出它被重置的位置并让它与我的函数一起使用?

【问题讨论】:

    标签: emacs


    【解决方案1】:

    我没有php-mode,所以我不能肯定,但是php-mode-map 中的绑定可能会被覆盖(作为主要模式映射,它的优先级高于全局映射)。

    您可以使用 Ch b 列出所有可用的键绑定并在输出缓冲区中查找 C-dc-electric-delete-forward 以查看绑定是在哪个键映射中定义的。

    假设 php-mode-map 覆盖 C-d 绑定,您可以使用禁用它

    (define-key php-mode-map (kbd "C-d") nil)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-04
      • 1970-01-01
      • 2013-03-17
      • 2012-10-09
      相关资源
      最近更新 更多