note: This question might have been asked before ( I think I saw it somewhere), but a quick search did not reveal anything.
I would like to tell the difference when a command is run from a shell.
Emacs can be initialized with the -nw
flag to disable the gui window, and I want this to be the default behaviour. However if emacs
is run from a non-shell environment, ( e.g. from the Open With
in your filemanager, a desktop configured hotkey, or even from bashrun ), it should not be called with the -nw
flag.
update: This should be a global change, running sudo emacs
in Terminal should'nt suddenly open a gui. Where do I make these changes?
bashrun
doesn't read~/.bashrc
. If the manual is wrong, you can say "unalias emacs" in $XDG_CONFIG_HOME/bashrun/rc to remove the alias forbashrun
. – Warren Young Nov 03 '10 at 18:09.bashrc
; if they don't they almost certainly have an equivalent configuration file you could put the same line in – Michael Mrozek Nov 03 '10 at 23:29emacs
fromsh
, it opened a gui instead. – Stefan Nov 04 '10 at 05:01ln -s .bashrc .whateverrc
. Or use.profile
, etc. – Michael Mrozek Nov 04 '10 at 14:32.profile
will work if/bin/sh
is Bash or another shell that understands aliases, but that is not the case on all systems. That said, I don't see why it really matters./bin/sh
exists for running shell scripts, not for interactive use, which use of X implies. If you have a shell script you wrote for use interactively, instead of trying to shoehorn my solution into working for/bin/sh
, just put#!/bin/bash
or whatever at the top instead. – Warren Young Nov 04 '10 at 16:36