How to open files automatically when starting emacs?

后端 未结 4 743
再見小時候
再見小時候 2021-01-30 07:08

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 st

相关标签:
4条回答
  • 2021-01-30 07:43
    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

    0 讨论(0)
  • 2021-01-30 07:46

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

    emacs FileName

    0 讨论(0)
  • 2021-01-30 07:55

    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.

    0 讨论(0)
  • 2021-01-30 07:56

    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

    0 讨论(0)
提交回复
热议问题