Giter Club home page Giter Club logo

Comments (7)

gpakosz avatar gpakosz commented on June 21, 2024

Hello @Nicholas-Autio-Mitchell,

While in a tmux pane, can you execute this command?

$ tmux lsk | grep -E 'prefix\s+e\s+'

Can you also try to set EDITOR to only emacs?

from .tmux.

Nicholas-Autio-Mitchell avatar Nicholas-Autio-Mitchell commented on June 21, 2024

Hi @gpakosz , here is the unedited output

 π ▶ tmux lsk | grep -E 'prefix\s+e\s+'
bind-key    -T prefix       e                      new-window -e "EDITOR=emacs -nw --no-splash" -n "#{TMUX_CONF_LOCAL}" sh -c "case \"\\${EDITOR:-vim}\" in *vim) \\${EDITOR:-vim} -c \":set syntax=tmux\" \"\\$TMUX_CONF_LOCAL\";; *) \"\\$EDITOR\" \"\\$TMUX_CONF_LOCAL\";; esac && \"\\$TMUX_PROGRAM\" \\${TMUX_SOCKET:+-S \"\\$TMUX_SOCKET\"} source \"\\$TMUX_CONF\" \\; display \"\\$TMUX_CONF_LOCAL sourced\""

Here is me trying EDITOR=emacs:

 π ▶ echo $EDITOR
emacs -nw --no-splash
 π ▶ EDITOR="emacs"
 π ▶ echo $EDITOR
emacs
 π ▶ tmux lsk | grep -E 'prefix\s+e\s+'
bind-key    -T prefix       e                      new-window -e "EDITOR=emacs -nw --no-splash" -n "#{TMUX_CONF_LOCAL}" sh -c "case \"\\${EDITOR:-vim}\" in *vim) \\${EDITOR:-vim} -c \":set syntax=tmux\" \"\\$TMUX_CONF_LOCAL\";; *) \"\\$EDITOR\" \"\\$TMUX_CONF_LOCAL\";; esac && \"\\$TMUX_PROGRAM\" \\${TMUX_SOCKET:+-S \"\\$TMUX_SOCKET\"} source \"\\$TMUX_CONF\" \\; display \"\\$TMUX_CONF_LOCAL sourced\""

Executing <prefix> e still has no effect.

from .tmux.

Nicholas-Autio-Mitchell avatar Nicholas-Autio-Mitchell commented on June 21, 2024

I notice in the output of tmux lsk | grep -E 'prefix\s+e\s+' above, after changing to EDITOR=emacs, the command still uses emacs -nw --no-splash. I have killed/restarted the tmux server, and also edited by ~/.bashrc to ensure the change to EDITOR is already there in the new session, but it still records the original EDITOR value.

Ok, realised tmux takes the value of EDITOR from the parent shell, before tmux itself starts up. 🤦 Made the correct change, and it seems to have fixed the issue! 🎉

Just trying a few more things to make sure it is the case...

from .tmux.

Nicholas-Autio-Mitchell avatar Nicholas-Autio-Mitchell commented on June 21, 2024

It seems adding any argument at all the emacs command in EDITOR causes the issue. Could it be a problem with escaping the command when tmux reads it?

from .tmux.

Nicholas-Autio-Mitchell avatar Nicholas-Autio-Mitchell commented on June 21, 2024

I tried wrapping emacs -nw --no-splash inside a function emacs_fn and set EDITOR=emacs_fn. It still doesn't work, so not likely an issue with escaping the command etc.

Additionally, I have had EDITOR=emacs -nw --no-splash set for years... I also didn't pull any updates from oh my tmux recently, so perhaps it is coming from elsewhere. My only guess is an emacs or emacs dependency update, but couldn't find a possible reason after a quick search now. Unless you have more ideas, I will assume it isn't an issue to resolve here.

As always, thanks for your help @gpakosz !

from .tmux.

gpakosz avatar gpakosz commented on June 21, 2024

Can you please try setting EDITOR='emacs -nw --no-splash' again with the gh-744 branch?

This implies quitting tmux etc like you noticed above

from .tmux.

Nicholas-Autio-Mitchell avatar Nicholas-Autio-Mitchell commented on June 21, 2024

The changes to quotes when reading the $EDITOR env var (made in gh-744) do fix the issue.

I had an older config on a different machine, where I still used EDITOR='emacs -nw --no-splash', so could compare three versions. Here is a summary:

# Works: an old tmux.conf (unknown commit)
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c '${EDITOR:-vim} "$TMUX_CONF_LOCAL" && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'

# Fails: current master
bind e new-window -n "#{TMUX_CONF_LOCAL}" -e "EDITOR=$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) "$EDITOR" "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'

# Works: gh-744
bind e new-window -n "#{TMUX_CONF_LOCAL}" -e EDITOR="$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'

from .tmux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.