Emacsの中断をキーにバインドする方法

Emacsの中断をキーにバインドする方法

これは私の.emacsファイルにロードされた.elファイルからのものです。どう思いますか?

;;; Sun keyboard bindings

;; the below line does not work:
;; when <cancel> is pressed, the minibuffer echoes "Quit"
;; but that is the only thing it does

;; (global-set-key [cancel] 'keyboard-quit)

;; Note: I got the 'keyboard-quit from C-h c and then C-g
;; (C-g is the normal way for me to abort)

;; Those work, so it has probably something to do
;; with the peculiarities of 'keyboard-quit, rather than
;; the actual keybinding (or?)

(global-set-key [SunProps] 'describe-variable)
(global-set-key [SunFront] 'next-buffer)
(global-set-key [SunOpen] 'list-buffers)
(global-set-key [XF86Copy] 'clipboard-kill-ring-save)
(global-set-key [XF86Paste] 'x-clipboard-yank)
(global-set-key [XF86Cut] 'clipboard-kill-region)

ベストアンサー1

Control+はG他の操作(通常の入力を読むことを除く)を行うときにEmacsを中断する必要があるため、Emacsコアにハードコードされており、通常の方法を使用してバウンスすることはできません。機能がありますが、set-quit-charASCII文字としてのみ機能します。

(set-quit-char QUIT)

Specify character used for quitting.
QUIT must be an ASCII character.

This function only has an effect on the controlling tty of the Emacs
process.

簡単に言えば、必要なタスクを実行するにはEmacsにパッチを適用して再コンパイルする必要があります。

しかし得ることができます一部あなたは何が欲しいですか?そうすれば

(define-key local-function-key-map [cancel] [7]) ; 7 is C-g

thencancelのように動作する必要がありますC-gが、Emacsが通常の入力を読み取る場合にのみ可能です。そのように長時間実行されているElisp機能を妨げることはありませんC-g。ただし、C-x C-fミニバッファなどから入力を読み出すコマンドはキャンセルされます。

おすすめ記事