3

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 ?

haknick
  • 145
  • 4
  • 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 Oct 11 '15 at 02:57

1 Answers1

7

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)
  (term-line-mode))

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

Iqbal Ansari
  • 7,468
  • 1
  • 28
  • 31
  • 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 Jun 09 '22 at 14:43