Got line-mode to work as for this: in term-mode, how do I run regular emacs commands?

Now how do I make it the default ?

  • I don't use that library, but how about?: (add-hook 'term-mode-hook 'term-line-mode) Either evaluate that statement after adding it to your .emacs file or restart Emacs.
    – lawlist
    Commented Oct 11, 2015 at 2:57

1 Answer 1


Looking at term.el it seems char mode is enabled right after running term-mode (and hence term-mode-hook) as such enabling term-line-mode in term-mode-hook would not work. The only option I can think of is advicing the function term and ansi-term, like so

(defun my-enable-term-line-mode (&rest ignored)

(advice-add 'ansi-term :after #'my-enable-term-line-mode)
(advice-add 'term :after #'my-enable-term-line-mode)

However you loose all the goodness of term in line mode, if you are looking for line-mode behaviour I think you will be better served by shell (M-xshellRET) or even better eshell.

  • This is wonderful. From here, I'm able to switch between line-mode and char-mode using C-x C-j and C-x C-k.
    – taranaki
    Commented Jun 9, 2022 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.