unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Load specific files at startup?
Date: Mon, 11 Aug 2008 03:19:05 -0700 (PDT)	[thread overview]
Message-ID: <26be1c22-2641-4ffb-b077-d981bac03e60@j1g2000prb.googlegroups.com> (raw)
In-Reply-To: mailman.16163.1218264049.18990.help-gnu-emacs@gnu.org

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/

      parent reply	other threads:[~2008-08-11 10:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-09  3:55 Load specific files at startup? ssecorp
2008-08-09  6:40 ` Peter Dyballa
2008-08-09  6:41 ` ken
2008-08-09  9:24   ` Peter Dyballa
     [not found] ` <mailman.16163.1218264049.18990.help-gnu-emacs@gnu.org>
2008-08-11 10:19   ` Xah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26be1c22-2641-4ffb-b077-d981bac03e60@j1g2000prb.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).