我写了这个elisp函数:
(defun run (command)
"Open a terminal running a command."
(interactive "sCommand: ")
(if (buffer-exists (concat "*" command "*" )) (kill-buffer (concat "*" command "*")))
(let ((term-mode-hook (cons (lambda () (term-line-mode)) term-mode-hook)))
(ansi-term (cons "sh" (cons "-i" (list "-c" command))) command)))这工作得很好,除了新的ansi-term buffer保持在char模式(这是默认模式),所以据我所知,term-line-mode调用没有做任何事情。如果我将(term-line-mode)替换为(消息"foo"),我确实在消息缓冲区中看到了该消息。
lisp/term.el中的term-line-mode的定义如下:
(defun term-line-mode ()
"Switch to line (\"cooked\") sub-mode of term mode.
This means that Emacs editing commands work as normally, until
you type \\[term-send-input] which sends the current line to the inferior."
(interactive)
(when (term-in-char-mode)
(use-local-map term-old-mode-map)
(term-update-mode-line)))我做错了什么?
发布于 2011-07-26 01:23:23
我无法让" term -line-mode“在任何术语钩子中按您希望的方式工作;但是,如果您建议使用"ansi-term”函数,它确实可以工作:
(defadvice ansi-term (after advice-term-line-mode activate)
(term-line-mode))https://stackoverflow.com/questions/6816877
复制相似问题