Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open files automatically when starting emacs?

Tags:

emacs

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.

like image 563
Peter Avatar asked Jun 16 '09 05:06

Peter


People also ask

What is the command to open a file from within Emacs?

Use Ctrl-x f to open a file from within Emacs. Create a new file in the same way as opening a file by specifying the new filename. The new file will not be saved unless specified. Save a file that is currently open by entering the Ctrl-x Ctrl-s command.

How do I create a .Emacs file?

To create a new file, use Control-X-Control-F, just as if the file already existed. When emacs asks you for the file name, type in the name you want your new file to have, and emacs will create the file, and display an empty buffer for you to type in. Emacs will perform file name completion for you.

Where is the .Emacs file?

When Emacs is opened from Windows Explorer, a link or cmd console it uses C:\Users\<USER>\AppData\Roaming\. emacs profile file but if you open Emacs from PowerShell console, Emacs will look for . emacs file in C:\Users\<USER> folder.


1 Answers

C-h b  

This opens the help showing the correspondence between key-bindings and elisp functions. 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

like image 76
glmxndr Avatar answered Sep 19 '22 08:09

glmxndr