help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reuse frame with emacsclient and/or use shell aliases when finding f


From: Robert Thorpe
Subject: Re: Reuse frame with emacsclient and/or use shell aliases when finding files
Date: Fri, 30 May 2014 23:47:46 +0100

Jacob Gerlach <jacobgerlach@gmail.com> writes:
> What I think that I want to do is figure out how to reuse an existing
> GUI frame if it exists. In other words, if I run `emacsclient -c
> foofile' from my shell and I already have a frame open, I would like
> foofile to open in that frame (and have the option to split the frame
> if possible). If no frame is open (i.e. just the server), I would 
> like the normal behavior of opening a new frame.

You want the default behaviour of emacsclient then.  In that case don't add
"-c" to the emacsclient command.  I'm sure you tried that though.  I'm
not sure why it doesn't work on your setup.  Do you have (server-start)
in your init file?  Are you using emacs --daemon?

> I realize that another (perhaps better option) is to use emacs as my
> shell. I'm experimenting with this but I am not sold yet.
>
> Another problem, and the reason I'm opening multiple files from the
> shell in the first place (instead of from within emacs), is that I
> mostly navigate around between different projects using shell aliases.
> Is there any way to use those aliases so that when I find-file I don't
> have to manually navigate to the desired directory?

You could setup bookmarks with C-x r m that have the same names as the
aliases.  You can bookmark a dired buffer in a certain directory and
recalling the bookmark will return you there.

> Any other recommendations that come to mind to migrate work from the
> shell to emacs are welcome.

Well, if you do use an Emacs shell then when you press C-x C-f it will
default to your current directory.  Suppose you do M-x shell and you
have a bash alias 'alias pro1="cd ~\Projects\FooCorp\MainProject"'.  If you
type "pro1 RET" it'll take you to the directory.  Then C-x C-f, C-x d,
etc will default to \Projects\FooCorp\MainProject.  "Shell" and "Term"
modes don't replace the shell they run it as a sub-process, only
"Eshell" replaces it with a different shell.

BR,
Robert Thorpe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]