How can I get emacs -nw when I call emacs from a terminal but GUI emacs elsewhere?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I get emacs -nw when I call emacs from a terminal but GUI emacs elsewhere?
Title says pretty much everything. When I call emacs from the terminal, I want to have the terminal-based version of emacs, not have a separate window with the GUI version. However, if I call it using Gnome Do, or from the applications menu, I want to have the GUI version.
Could anyone help me?
Thanks in advance
EDIT: Another doubt: Is there any difference between typing 'sudo bash' or 'su'?
Cheers
Last edited by Blackened Justice; 09-07-2011 at 12:46 PM.
I don't have a .bash_profile in my home folder...
As a simple temporary solution I have made a simple script and put it in the /usr/local/sbin folder, the first in the $PATH variable.
#!/bin/bash
/usr/bin/emacs -nw
It works if I just call emacs, but I can't pass any arguments (most importantly the filename).
Make sure to fix the second line with the correct binary. I'm not an emacs type - I'm not even a vi type. Those commands will add a line if the file is there, and create it if it isn't.
Thank you for the suggestion, I read the .bashrc file and figured out what to do. I created a .bash_aliases file, as suggested, and put the "alias emacs='emacs -nw'" line on it. It now works perfectly, if I call it from the terminal I get the terminal version and if I call it from pretty much everywhere else, I get the GUI version.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.