Quantcast
Channel: FettesPS » bash
Viewing all articles
Browse latest Browse all 3

How to Stop Emacs from Opening a New Daemon

$
0
0

I finally got around to upgrading to the the newest stable release of Emacs. There were a few things I wanted to be able to do and rather than use outdated methods I decided it was time to upgrade to Emacs 23. I ran into a few hitches along the way but after getting them resolved I went about setting up the Emacs daemon to load quietly in the background and start using multiple emacs clients under different GNU Screen windows. I had a bit of a time figuring out how to make it so it wouldn’t try to start up another server each time I logged in via SSH or created a new Screen. I never really found a one stop answer for this, rather it was a combination of several suggestions I saw. So here’s what I came up with for my ~/.bashrc:

# Boot up the Emacs Daemon                                                                                                                                                                                 
function emacs_is_running() {                                                                                                                                                                              
    ps -ef | grep "emacs --daemon" | grep -v grep > /dev/null                                                                                                                                              
}                                                                                                                                                                                                          

# Debug                                                                                                                                                                                                           
if emacs_is_running; then                                                                                                                                                                                  
    echo Emacs daemon already running                                                                                                                                                                      
else                                                                                                                                                                                                       
    echo Launching emacs daemon                                                                                                                                                                            
    emacs --daemon                                                                                                                                                                                         
fi                                                                                                                                                                                                         
                                                                                                                                                                                                           
                                                                                                                                                                                                          
# Fix Typos, Add Shortcuts...                                                                                                                                                                                               
alias e="emacsclient -c -a nano"                                                                                                                                                                           
alias emac="emacsclient -c -a nano"                                                                                                                                                                           
alias emacs="emacsclient -c -a nano"                                                                                                                                                                       
alias emasc="emacsclient -c -a nano"        
alias pico="emacsclient -c"                                                                                                                                                                               
EDITOR="emacsclient -c -a nano"                                                                                                                                                                            
VISUAL="emacsclient -c -a nano"                                                                                                                                                                            

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images