In case it's relevant, I'm on a Mac, running OSX 10.12 and Carbon Emacs 24.3.1.
If I open a file using /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n filepath
the Emacs window comes to the top and gets focus unless opening the file triggers a minibuffer prompt (such as Symbolic link to Hg-controlled source file; follow link? (yes or no)
.
Is there a way to configure Emacs to grab focus and raise its window in these cases as well?
(raise-frame)
did not work, but(x-focus-frame nil)
did; and (empirically and fromemacsclient --help
) I can't use plain filepath to open a file if I also use-e
. What worked for me:emacsclient -n -e "(progn (x-focus-frame nil) (find-file \"$1\"))"
– Joshua Goldberg Nov 03 '17 at 14:36(raise-frame)
, I'm editing the answer. – Manoel Vilela Nov 03 '17 at 21:21-e
? Like-e '(x-focus-frame nil)' filepath
. Maybe can be a version problem, but I used the 25.4.1, 26.0 and 27.0 and don't have any problem about that. – Manoel Vilela Nov 04 '17 at 04:26