I am currently using visual-fill-column-mode and visual-line-mode in emacs with the following:

(add-hook 'visual-line-mode-hook 'visual-fill-column-mode)
(global-visual-line-mode t)
(define-key visual-line-mode-map [remap kill-line] nil)

This enable both mode everywhere, but I would like:

  • visual-line-mode to be enable everywhere but in terminal (e.g. ansi-term)
  • visual-fill-column-mode to be enable only in "text" and "programming"

Currently I have the following hook for ansi-term but it does not work:

(defun my-term-hook ()
  (visual-fill-column-mode nil)
  (visual-line-mode nil))
(add-hook 'term-load-hook 'my-term-hook)

And I don't on which hook I could bind those mode to enable them in all programming mode (I know about text-mode-hook for text mode)?

1 Answer 1


You can use text-mode-hook for all text modes and prog-mode-hook for all programming language modes.

Of course, "all" should be takes with a grain of salt. Some modes does not inherit from the standard modes, in which case please contact the maintainer and report that as a bug.

  • Thanks, prog-mode-hook solve my problem.
    – Holt
    Apr 15, 2016 at 12:29

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.