On Tue, Jan 20 2015, David Bremner <david@tethera.net> wrote: > Tomi Ollila <tomi.ollila@iki.fi> writes: > >> This is second draft patch of (first being) >> >> id:1405026779-29966-1-git-send-email-tomi.ollila@iki.fi >> >> I saw potential problem with only supporting emacsclient(1) in >> the version David sent: >> id:1421598115-4889-1-git-send-email-david@tethera.net >> >> (no emacs server running and no tty -- new X client not started) >> > > I don't understand what use case is failing for you. I think I tested > all 4 combinations of DISPLAY set and unset and emacs server running and > not running. Do you somehow want to run the notmuch-emacs-mua script > from a process not attached to a terminal (from cron?). It seems that you have done good testing and I just failed to test using exactly the same options you have: emacsclient -c -a '' .zshrc Works as one'd expect to work successfully in all cases, DISPLAY set/unset and emacs-server running or not (now deleting 6 lines of text below that was based on wrong assumtions...) // 6 lines of text deleted ... :) // So, the question goes into deciding whether the magic of starting emacs server to the user if it is not running -- something that many users would not anticipate/desire (I am one of those)... Running emacs via emacsclient has subtle differences to just running emacs the "regular" way -- while testing I just had problems exiting the emacsclient session without exiting the whole emacs -- I exited the whole emacs and next time paid attention to minibuffer message saying c-x 5 0 exits the session... Now that I got the tests work as David would have expected me to do those, the frame emacs started looked different that my emacs frames have when starting "normally" -- there was extra toolbar in the frame (I have inhibited all menu and toolbars in my normal setup). Just that it behaves differently is suspicious. Therefore, IMO it is clearer to run "regular" emacs unless user is explicitly running emacs-server and can anticipate the behaviour differences when running emacsclient there. >> In case emacsclient(1) is used and no --no-window-system, '-c' arg is >> given to emacsclient like in the version David sent. >> >> (this means that if emacs is not running on X, user may get this message: >> "emacsclient: could not get terminal name" -- we need to document user >> to give -nw (--no-window-system) option then) > > As I wrote above, I'm missing what the tradeoff is. The version I sent > works fine (at least for me) in the case where DISPLAY is not set and > --no-window-system is not given (i.e. it's implied if DISPLAY is not > set). Ok, my tests failed colossally here. Sorry. First, I forgot to have -a '' there (for comparison) and secondly I closed stdout before running emacsclient (bug in the script). That's what you get after almost 3 hours of vigorous hacking there; the manual test coverage is probably not the best possible... > > d Tomi