首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我的term-mode-hook没有选择line mode?

为什么我的term-mode-hook没有选择line mode?
EN

Stack Overflow用户
提问于 2011-07-25 21:29:47
回答 1查看 1.2K关注 0票数 4

我写了这个elisp函数:

代码语言:javascript
复制
(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的定义如下:

代码语言:javascript
复制
(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)))

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-26 01:23:23

我无法让" term -line-mode“在任何术语钩子中按您希望的方式工作;但是,如果您建议使用"ansi-term”函数,它确实可以工作:

代码语言:javascript
复制
(defadvice ansi-term (after advice-term-line-mode activate)
  (term-line-mode))
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6816877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档