0

Currently using Emacs on Windows Subsystem for Linux (WSL).
I have this alias for emacsclient executable:

alias e='emacsclient -n'

Which I run very often when I am on the terminal (I use ConEmu or terminator).

The problem is that whenever I execute it, Emacs windows is not brought to front.
So I have to search for it with Alt+TAB...
Which I find a bit annoying when I have a bunch of windows opened.

Is there a way to bring Emacs to front when running emacsclient ?

Drew
  • 75,699
  • 9
  • 109
  • 225
nephewtom
  • 2,219
  • 17
  • 29

1 Answers1

1

This is a kind of quirky way of achieving it, but it worked for me.
Having frame-title-format set to its original value:

(setq frame-title-format '(multiple-frames "%b"
                                           ("" invocation-name "@" system-name)))

shows this on wmctrl utility to interact with X-Windows manager:

$ wmctrl -l
0x00e00003  0 ES-00002604 /bin/bash
0x0120001d  0 ES-00002604 emacs@ES-00002604

So, writing this short bash script e.sh:

#!/bin/bash
emacsclient -n $1
wmctrl -a nephewtom

And having this alias defined:

alias e='e.sh'

Allows me to work like this:

enter image description here

nephewtom
  • 2,219
  • 17
  • 29