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

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

Re: Load specific files at startup?


From: Xah
Subject: Re: Load specific files at startup?
Date: Mon, 11 Aug 2008 03:19:05 -0700 (PDT)
User-agent: G2/1.0

On Aug 8, 8:55 pm, ssecorp <circularf...@gmail.com> wrote:
> How can I set emacs to open some specific files at startup, maybe even
> split the windows for me?
>
> Can I save the state of shutdown so I can reopen and just continue
> where I left off?
>
> This would be nice since I work with the same project almost the whole
> time.
>
> Could this even be set as a menu where I could have different projects
> that I could choose to load?

Peter suggested sessions.el and desktop.el.
I haven't used sessions.el, but am using desktop save mode. Here's
what i know about your question.

(desktop-save-mode t) ; enable the desktop save mode
(desktop-save t) ; alwys save desktop

; save opened files every 10 min. So in case of system crash you still
have it after restart
(run-with-timer 600 600 'desktop-save "~/")

About opening several predefined files, you can easily do it with
elisp like this:

(find-file filepath1)
(find-file filepath2)
(find-file filepath3)
...

Now if you want the above as one group of files of a project and want
to open these with just a command, you can define it like this:

(defun open-project-x ()
"open project X files"
(interactive)
(find-file filepath1)
(find-file filepath2)
(find-file filepath3)
)

to assign a shortcut to the command, do

(global-set-key (kbd "<f6>") 'open-project-x)

i haven't looked at how you define a menu command, but it should be
similar.

Similarly you can define a function to close these files. I haven't
looked at the proper way to close a buffer of a given file path... but
here's a dumb solution should work:

(defun close-project-x ()
"close project X files"
(interactive)
(find-file filepath1)
(kill-buffer)
(find-file filepath2)
(kill-buffer)
(find-file filepath3)
(kill-buffer)
)

  Xah
∑ http://xahlee.org/

reply via email to

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