我希望 Emacs 能够在 ansi-term 缓冲区上触发与M-x command RET
字符模式相关的标准行为。
我实际上曾经有这个功能,但由于某种原因,它在最近几天消失了,即使我没有升级 Emacs(尽管我可能无意中修改了我的 init 文件)
另外,我有以下曾经工作的钩子(在窗口之间切换),但它不再起作用了。
(global-set-key (kbd "M-J") 'windmove-left) ; move to left window
(global-set-key (kbd "M-L") 'windmove-right) ; move " "
(global-set-key (kbd "M-I") 'windmove-up) ; move " "
(global-set-key (kbd "M-K") 'windmove-down) ; move " "
(add-hook 'term-mode-hook
(lambda()
(define-key term-raw-map (kbd "M-J") 'windmove-left)
(define-key term-raw-map (kbd "M-L") 'windmove-right)
(define-key term-raw-map (kbd "M-I") 'windmove-up)
(define-key term-raw-map (kbd "M-K") 'windmove-down)
(define-key term-raw-map (kbd "M-F") 'toggle-maximize-buffer)
))
更新:
如果我在打开任何 ansi-term(lookup-key term-raw-map (read-kbd-macro "\C-x"))
之前term-send-raw
进行评估,我会得到: ,但如果我在打开 ansi-term之后评估它,我会得到:
(keymap #^[nil nil keymap
#^^[3 0 pop-global-mark nil list-buffers term-send-raw list-directory eval-last-sexp find-file nil nil indent-rigidly ...] #^^[1 0 #^^[2 0
#^^[3 0 pop-global-mark nil list-buffers term-send-raw list-directory eval-last-sexp find-file nil nil indent-rigidly ...] nil nil nil nil nil nil nil nil nil ...] nil nil nil nil nil nil nil nil nil ...] nil nil nil nil nil nil nil ...] (67108912 . text-scale-adjust) (67108925 . text-scale-adjust) (67108909 . text-scale-adjust) (67108907 . text-scale-adjust) (67108896 . pop-global-mark) (C-left . previous-buffer) (left . previous-buffer) (C-right . next-buffer) (right . next-buffer))
这是预期的行为吗?