tags:

views:

350

answers:

4

A newbie question and probably very bingable (had to use that word once :-)), but as I gather thats both ok for SO : How can you get files to open automatically when starting emacs?

I guess it sth. like executing the find file command in your .emacs but the exact notation isn't clear to me.

+1  A: 

If you're calling it from the terminal , can't you just go

emacs FileName

PSU_Kardi
+14  A: 
C-h b

This opens the help showing the correspondance between key-bindings and elisp funtions. Look for

C-x C-f

in it (you can do it by typing C-s C - x space C - f), you find find-file. Now, do

C-h f find-file

and it tells you, among other things, the syntax :

(find-file FILENAME &optional WILDCARDS)

So just try

(find-file "/path/to/your/file")

in your .emacs

subtenante
tx, all very usefull, I know it's basic, but haven't found the time to work my way in yet.
Peter
No problem, we've all been there.
subtenante
The exhibition of process here is worth at least as much as the answer itself. Nice.
dmckee
+11  A: 

Are you thinking of having it re-open files you've looked at before? The desktop package remembers files and re-opens them when you restart. Depending on your emacs version, you enable by simply adding this to your .emacs (for 22.1+ versions):

 (desktop-save-mode 1)

And after that, it's pretty much automatic. Whatever files you had open before will be re-opened (provided you start from the same directory, b/c that's where the desktop configuration file is saved) - unless you add a change that forces a single desktop for all sessions.

There are bunches of variants of that functionality, which are listed in the session management page.

Trey Jackson
tx, very usefull
Peter
+2  A: 

You could desktop-save which basically restores the last session you were working with. When you restart emacs, it looks for a saved session in your folder and loads your files. See link text

bacila