I'm trying to run mutt in ansi-term in the GUI on OS X. The refresh rate is really slow for some reason, so when I try to navigate between emails the result is pretty much unreadable. Has anyone found a workaround for this / is there a dedicated emacs mutt front end? Also, apparently this problem is way old. https://www.reddit.com/r/emacs/comments/bk8pd/best_emacs_mail_client_for_a_mutt_user/

  • Not an answer, but since you're taking the trouble to use Emacs, why not go the whole way and use one of the various email package options (gnus, mu4e, etc.)? It will probably be a great deal more streamlined and integrated than trying to force mutt to run through ansi-term within Emacs.
    – Dan
    Commented Aug 31, 2015 at 22:41
  • Mutt runs in a separate process and thus doesn't lock the UI while refreshing messages. It also seems like the type of thing an enterprising chap somewhere would have written a front end for (like top-mode for top) or something. Commented Aug 31, 2015 at 22:49
  • fair enough. However, if you were to use mu4e or gnus with something like offlineimap, it would resolve a lot of the locking up issue (which I agree is super annoying).
    – Dan
    Commented Aug 31, 2015 at 23:13

1 Answer 1


The bi-directional text support introduced in Emacs 24 interacts badly with term.el when large numbers of spaces or tabs are inserted, and many applications clear the screen (often drawing a new background colour) by writing WIDTHxHEIGHT spaces (which, if the terminal’s dimensions are sufficiently large, may take several seconds).

The workaround is to prevent Emacs from guessing the text direction in term-mode, and simply enforce a left-to-right direction:

;; Terminal buffer configuration.
(add-hook 'term-mode-hook 'my-term-mode-hook)
(defun my-term-mode-hook ()
  ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20611
  (setq bidi-paragraph-direction 'left-to-right))

This workaround is enabled by default in term-mode for Emacs 25.1 (and current pre-releases thereof), so manually configuring term-mode-hook should only be necessary for Emacs 24.x.

The root of the problem has been fixed in the Emacs master branch (such that the workaround is not needed at all). That fix should be included in either Emacs 25.2 or 25.3.

I've also updated https://www.emacswiki.org/emacs/AnsiTermHints with the same information.

For the sake of searchability, here are the names of the applications I'm aware of which trigger this problem. These are mostly (if not all) curses- or ncurses-based -- presumably this method of screen refresh is a commonly-used curses function -- and so it is highly probable that many other curses applications will do the same thing.

  • alsamixer
  • dialog
  • dpkg-reconfigure
  • lynx
  • mc (midnight commander)
  • mutt

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.