2

I quite like tmux and Aquamacs. I've recently been interested in how to integrate the two together. As far as I know, one cannot run Aquamacs within a terminal even with the Aquamacs CLI tool, so the next natural option is to run tmux in Aquamacs via something like Emacs' shell mode. Unfortunately, I've been running into some bottlenecks in doing this. Namely, running tmux from shell mode throws an error:

$ tmux attach -t 0 # same thing happens by just running `$ tmux`
tmux attach -t 0
open terminal failed: terminal does not support clear

I've been searching for Aquamacs / tmux integration, but haven't found much. It seems like most folks are content to just use Emacs in the shell within tmux, but unfortunately this isn't an option for Aquamacs as stated above.

EDIT:

It seems that the error stated below in the comments (open terminal failed: can't find terminfo database) also happens in vanilla Emacs, even on Linux.

GDP2
  • 1,340
  • 9
  • 25
  • 1
    `shell` is a "limited" terminal (limited to replace some of the terminal functionality with Emacs-style functionality). I believe that if you try `M-x term` with `tmux`, that'll work. – wvxvw Feb 06 '16 at 09:20
  • @wvxvw Interesting, I didn't know about `term`. However, I'm getting another error upon running `tmux`: `open terminal failed: can't find terminfo database`. Btw, I'm using zsh if that makes any difference. I've also tried setting the `$TERM` variable to screen-256color and xterm-color, but that seems to have no effect. – GDP2 Feb 06 '16 at 16:18
  • It works here with Bash, but I'm not a pro / don't really know what terminfo database even is. So, sorry :( – wvxvw Feb 06 '16 at 18:33
  • @wvxvw Np, thanks for the suggestion anyway. – GDP2 Feb 06 '16 at 18:39
  • @GDP2 - Does Auqamacs use the new package manager? If so `multi-term` package is reasonable alternative to `tmux`. Once `multi-term` is installed, you can call with `M-x multi-term`. Does that help? – Melioratus Mar 03 '16 at 17:22
  • @Melioratus Thanks for the suggestion. I've tried out `multi-term`, but found it to be problematic with Emacs / Aquamacs in a few regards. For example, the key bindings of my shell and the key bindings of *macs conflict with each other, e.g., `C-y`. Pasting things into `multi-term` doesn't seem to work well with `cmd-v` either. I know that I could just remap bindings to fix this problem, but I really don't feel like messing with my muscle memory. (btw, yes Aquamacs does use the new package manager) – GDP2 Mar 06 '16 at 05:38
  • @Melioratus I realize now that running `tmux` in some sort of terminal emulator in *macs would cause the same problems as `multi-term` did, but now I'm just hoping for a way around that w/out resorting to a lot of configuration and/or hackery. – GDP2 Mar 06 '16 at 05:44
  • @Melioratus Never mind all that I said about key binding issues with `multi-term`; I found out that it has `term-unbind-key-list` and `term-bind-key-alist` variables to manage key bindings between Emacs and the terminal. More info here: https://www.emacswiki.org/emacs/MultiTerm. – GDP2 Mar 08 '16 at 19:05

1 Answers1

0

So, I solved this particular issue in both vanilla Emacs and Aquamacs by running TERM=screen-256color before running tmux. Apparently $TERM was set to eterm-color, thus causing the problem with tmux. A caveat for tmux in *macs, though: I did notice that sometimes I could see tmux rendering things slowly because I could see the point cascading across the screen after some commands, which was mildly annoying.

Additionally, I've tried out Melioratus's suggestion for using the multi-term package and have found that it works pretty well. Granted, it needs some configuration to work well with multiple windows (i.e., panes within a frame), but I've found that winner-mode and windmove might mitigate this.

Also, I found a blog post here which might help start off with multi-term (but haven't read too much of it yet): http://rawsyntax.com/blog/learn-emacs-zsh-and-multi-term/. Personally, I'm not leaving tmux for multi-term for the time being, but I think that I'll be using both and leveraging the ability to use the terminal in *macs to see what good can come of it.

GDP2
  • 1,340
  • 9
  • 25