无法在 xemacs 中重新绑定键 Cz

发布于 2024-09-17 10:25:45 字数 679 浏览 4 评论 0原文

由于某种原因,“Cz”被映射到 suspend-or-iconify-emacs,我似乎无法让它重新绑定到不那么烦人的东西。 (我喜欢使用 ctrl-z 进行撤消,但什么都不做至少比每次不小心按下按键时暂停要好)

我尝试过以交互方式进行操作: Mx global-set-key,然后将键 Cz 设置为命令:撤消
Mx describe-key-briefly 给我 Cz 运行命令 suspend-or-iconify-emacs

我尝试进入暂存缓冲区并评估: (global-set-key (kbd "Cz") 'undo)(global-set-key "\Cz" 'undo),当然是在我的 .xemacs/init.el 文件。

似乎没有什么可以真正重新绑定密钥。

这是在 XEmacs 21.5 的 Fundamental 模式下发生的。关于如何解决这个问题有什么想法吗?

编辑:好的,这是一个通过重新定义要撤消的挂起函数来解决问题的技巧:

(defun suspend-or-iconify-emacs () (interactive) (undo))

我实际上不能不再暂停 emacs,但这对我来说实际上没问题。

For some reason, "C-z" is mapped to suspend-or-iconify-emacs and I can't seem to get it to rebind to something less annoying. (I like using ctrl-z for undo, but doing nothing would at least be better than suspending every time I accidentally hit the key)

I've tried doing it interactively:
M-x global-set-key, then Set key C-z to command: undo.
M-x describe-key-briefly gives me C-z runs the command suspend-or-iconify-emacs

I've tried going to the scratch buffer and evaluating:
(global-set-key (kbd "C-z") 'undo) and (global-set-key "\C-z" 'undo), and it is of course in my .xemacs/init.el file.

Nothing seems to actually rebind the key.

This is happening on XEmacs 21.5, in Fundamental mode. Any ideas on how to troubleshoot this?

edit: Ok here is a hack that gets around the problem by redefining the suspend function to undo:

(defun suspend-or-iconify-emacs () (interactive) (undo))

I can't actually suspend emacs anymore, but that's actually ok with me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

太阳哥哥 2024-09-24 10:25:45

尝试评估一下:(

(define-key global-window-system-map [(control z)] 'undo)

假设您没有在 tty 模式下运行 XEmacs,但我猜您不是,如果您想图标化:-))

我使用 Ch b 来找出要修改的 *-map 。

Try evaluating this:

(define-key global-window-system-map [(control z)] 'undo)

(assuming that you aren't running XEmacs in tty-mode, but I guess you are not, if you want to iconify :-))

I used C-h b to find out what *-map to modify.

若水般的淡然安静女子 2024-09-24 10:25:45

我的 .emacs 中有以下代码:

(global-set-key (kbd "C-z") 'eshell)

它将启动一个 eshell,并且它可以工作。

Cz 组合在 Unix/Linux 上是相当标准的,如果您在终端中使用 vi、lynx 或 mutt 工作并按下 Cz,程序将暂停,您将返回 shell。发出“fg”命令将再次弹出程序。由于 Emacs 有自己的 shell,我喜欢在 Emacs 中按 Cz 时生成它。

您还可以添加以下钩子,它将在 eshell 中重新映射 Cz。这样,在 eshell 中按 Cz 即可返回到正在编辑的缓冲区。

(add-hook 'eshell-mode-hook
  (lambda ()
    (local-set-key (kbd "C-z") 'bury-buffer)))

I have the following code in my .emacs:

(global-set-key (kbd "C-z") 'eshell)

It will start an eshell, and it works.

The C-z combination is pretty standard on Unix/Linux, if you're working in a terminal with e.g. vi, lynx or mutt and presses C-z the program will suspend and you will be back in the shell. Issuing the 'fg' command will pop the program back again. As Emacs has its own shell, I like spawning that when pressing C-z in Emacs.

You can also add the following hook, that will remap C-z in the eshell. That way pressing C-z in the eshell with get you back to the buffer you were editing.

(add-hook 'eshell-mode-hook
  (lambda ()
    (local-set-key (kbd "C-z") 'bury-buffer)))
总以为 2024-09-24 10:25:45

将其放在 .xemacs/init.el 的末尾

(global-set-key (kbd "C-z") 'undo)

或者您的键盘或操作系统可能配置错误。

执行 Ch k Cz 来查看 xemacs 是否确实收到 Cz 密钥。

Put that at the end of your .xemacs/init.el :

(global-set-key (kbd "C-z") 'undo)

Or maybe you have a misconfigured keyboard or operating system.

Do C-h k C-z to see if xemacs really receives a C-z key.

独闯女儿国 2024-09-24 10:25:45

我也遇到了同样的问题。我希望它映射到 isearch-forward,但它却不断向前移动一个字符。

我终于通过添加解决了我的问题

(global-unset-key [?\C-f])
(global-set-key [?\C-f] 'isearch-forward) 

显然问题是Cf(和Cz)是一个“真正的”键,也就是说,它是终端可以识别的东西(Cz是ASCII 0x06,0x1a),所以你需要“?\ ”在“CF”前面。

这是我唯一要做的工作。

HTH

(编辑:我应该注意我使用 emacs,而不是 xemacs)

I had the same problem with C-f. I wanted it to map to isearch-forward, but instead it kept moving one character forward.

I finally solved my problem by adding

(global-unset-key [?\C-f])
(global-set-key [?\C-f] 'isearch-forward) 

Apparently the issue is that C-f (and C-z) is a "real" key, that is, it's something that a terminal recognizes (it's ASCII 0x06, 0x1a for C-z), so you need the "?\" in front of "C-f".

This is the only thing I got to work.

HTH

(EDIT: I should note that I use emacs, not xemacs)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文