Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
09-07-2011, 12:44 PM
|
#1
|
Member
Registered: Jun 2011
Posts: 82
Rep:
|
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.
|
|
|
09-07-2011, 02:01 PM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,850
|
Let me try.
In your ~/.bash_profile put this line
in your ~/.bashrc, put
Quote:
alias emacs='emacs-gui-version' or whatever it's called.
|
As for sudo bash, it avoids the password stage of su.
|
|
|
09-07-2011, 04:06 PM
|
#3
|
Member
Registered: Jun 2011
Posts: 82
Original Poster
Rep:
|
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).
|
|
|
09-08-2011, 02:42 AM
|
#4
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,850
|
Let me try again:
Quote:
echo "alias emacs='emacs-nw' " >>~/.bash_profile
echo "alias emacs='emacs-gui-version' " >> ~?.bashrc
|
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.
|
|
|
09-08-2011, 07:57 AM
|
#5
|
Member
Registered: Jun 2011
Posts: 82
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 02:29 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|