Fix: cannot bring Emacs to front window
refactor: rewrite code logic with if else also fixed cannot bring Emacs to front window when it's activate
refactor: rewrite code logic with if else also fixed cannot bring Emacs to front window when it's activate