tmate-io / tmate

Instant Terminal Sharing
https://tmate.io/
Other
5.64k stars 300 forks source link

`source-file` does not take the same arguments as tmux version #253

Open trevorwhitney opened 3 years ago

trevorwhitney commented 3 years ago

It appears the source-file function takes different arguments in tmate vs tmux. This is causing a problem as I use the -q argument in my tmux config, so tmate errors when trying to load it.

From man tmate:

 source-file path
               (alias: source)
         Execute commands from path.

From man tmux:

 source-file [-nqv] path ...
               (alias: source)
         Execute commands from one or more files specified by path (which may be glob(7) patterns).  If -q is given, no error will be returned if path does not exist.  With -n, the file is parsed but no commands are executed.  -v shows the parsed commands and line numbers if possible.

Versions of each:

$ tmate -V                                                                                                                                                                                                                                                                                          
tmate 2.4.0
$ tmux -V                                                                                                                                                                                                                                                                                           
tmux 3.1c

Is there a specific reason for this discrepancy?

jkirk commented 1 year ago

I also stumbled over this problem. The problem seems to be that tmate was forked before tmux v2.3 in which the source-file -q option got introduced: https://github.com/tmux/tmux/commit/fdd368a2945f1f5cbd1cd2a858c00ebffdbf7e46

tmate 'didn't catch up with tmux' so a lot of key bindings fail with tmate: #108, #272, ...

It also doesn't seem to be possible to use an alternative system configuration file: tmate always loads /etc/tmux.conf, even if -f is given.

jkirk commented 1 year ago

JFI, we currently work around this problem with something like this:

if-shell "! (env | grep -q TMUX=/tmp/tmate)" \
  "source-file -q ~/.tmux.conf.local"

See: grml/grml-etc-core@a4aa1466