2011-07-25 7 views
4

私はこのelispの関数を書いた:私のterm-mode-hookがラインモードを選択しないのはなぜですか?

(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-line-mode)を(message "foo")に置き換えると、メッセージバッファにメッセージが表示されます。

のlisp/term.elにおける用語インラインモードの定義は次のとおりです。

(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))) 

私が間違って何をしているのですか?

答えて

5

「用語ラインモード」を任意の用語フックで機能させることができませんでした。ただし、「ansi-term」機能にアドバイスすると機能します。

(defadvice ansi-term (after advice-term-line-mode activate) 
    (term-line-mode)) 
関連する問題