Consider terminal emacs in EDITOR_CALLBACKS before graphical (#36346)
Since the regex r"\bemacs" matches the cmd `emacs -nw`, the regex
r"\bemacs\b.*\s(-nw|--no-window-system)\b" should be considered in the
EDITOR_CALLBACKS list before it.
Without this change, when JULIA_EDITOR="emacs -nw", julia tries to
open the editor with run(...; wait=false) which causes the error:
emacs: standard input is not a tty
or for emacsclient:
emacsclient: could not get terminal name
emacsclient: error executing alternate editor ""