如何发送M-。到Emacs的终端(多学期)

时间:2013-03-01 15:54:31

标签: emacs terminal ansi-term

我正在尝试将命令M-.(即<ALT> .)发送到Emacs中multi-term中运行的终端。作为参考,M-.通常被绑定在终端中插入上一个命令的最后一个参数(即yank-last-arg / insert-last-argument

我有以下设置:

(require 'multi-term)
(multi-term-keystroke-setup)
(setq multi-term-program "/home/john/sw/zsh/bin/zsh")

(setq term-bind-key-alist
    (list
    ( cons "C-c C-j" 'term-line-mode)
    ( cons "C-c C-k" 'term-char-mode)
    ( cons "C-p"  'term-send-raw)
    ( cons "C-n"  'term-send-raw)
    ( cons "C-a"  'term-send-raw)
    ( cons "C-e"  'term-send-raw)
    ( cons "M-b"  'term-send-backward-word)
    ( cons "M-f"  'term-send-forward-word)
    ( cons "M-d"  'term-send-forward-kill-word)
    ( cons "C-k"  'term-send-raw)
))
)

# Make sure yanking works:
(add-hook 'term-mode-hook (lambda ()
                            (define-key term-raw-map (kbd "C-y") 'term-paste)))

我尝试过添加:

( cons "M-."  'term-send-raw)

但它似乎没有做任何事情。

如果它有用,这里的命令列表似乎有一个术语前缀,并在term.el中定义

term-send-M-x
term-send-backspace
term-send-backward-kill-word
term-send-backward-word
term-send-del
term-send-down
term-send-end
term-send-eof
term-send-forward-kill-word
term-send-forward-word
term-send-home
term-send-input
term-send-insert
term-send-invisible
term-send-left
term-send-next
term-send-prior
term-send-quote
term-send-raw
term-send-raw-meta
term-send-reverse-search-history
term-send-right
term-send-up

1 个答案:

答案 0 :(得分:3)

我没有multi-term来测试它,但您可以尝试使用term-send-raw-meta代替term-send-raw

(setq term-bind-key-alist
    (list (cons "C-c C-j" 'term-line-mode)
          ; ...
          (cons "M-."  'term-send-raw-meta)))