all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Load specific files at startup?
@ 2008-08-09  3:55 ssecorp
  2008-08-09  6:40 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ssecorp @ 2008-08-09  3:55 UTC (permalink / raw)
  To: help-gnu-emacs

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?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Load specific files at startup?
  2008-08-09  3:55 Load specific files at startup? ssecorp
@ 2008-08-09  6:40 ` Peter Dyballa
  2008-08-09  6:41 ` ken
       [not found] ` <mailman.16163.1218264049.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2008-08-09  6:40 UTC (permalink / raw)
  To: ssecorp; +Cc: help-gnu-emacs


Am 09.08.2008 um 05:55 schrieb ssecorp:

> 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?


See whether session.el and desktop.el do what you want.

--
Greetings

   Pete

It's not the valleys in life I dread so much as the dips.
				– Garfield







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Load specific files at startup?
  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>
  2 siblings, 1 reply; 5+ messages in thread
From: ken @ 2008-08-09  6:41 UTC (permalink / raw)
  To: GNU Emacs List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 08/08/2008 11:55 PM ssecorp 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?

Except for the menu for different projects, this does what you're asking
for.  I've been using it for years.  Perhaps it could be hacked a bit to
provide a menu.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Save the current emacs session for the next emacs session.

;; automatically save the desktop to a user-specified file periodically,
like auto-save
(defun desktop-save-in-home-dir ()
~  "save current emacs desktop in file in home directory"
~       (if (buffer-file-name)          ;; do only for real files
~           (let (find-file-hooks       ;; must - do not loop on this
function
~                 kill-buffer-hook)     ;; must - do not loop on this
function
~               (desktop-save "~/")
~               ))
~       nil)

(add-hook 'find-file-hooks  'desktop-save-in-home-dir t)
(add-hook 'kill-buffer-hook 'desktop-save-in-home-dir t)

(defun desktop-auto-save ()
~   "Added to auto-save-hook so the desktop is not lost."
~   (desktop-save "~/")
;   (message "Wrote desktop.")
~   )

(add-hook 'auto-save-hook 'desktop-auto-save t)

;; load the desktop on startup
(desktop-load-default)
;; automatically save the desktop on exit.
(setq desktop-enable t)

;;Manually, just do M-x desktop-read to load the last saved desktop.
;;; end auto-saving of desktop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


- --
Please note that I will be changing this email address soon.  The PGP
signature should ensure for everyone that, though the email address
will be different, I will be the same person.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFInTwL8CeNiFrQkecRArqIAJ9g3zcOnysptPI/KsydhhN3bFRWuACdF8Hs
Il7spZh9iXlnafk16073a80=
=Je9P
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Load specific files at startup?
  2008-08-09  6:41 ` ken
@ 2008-08-09  9:24   ` Peter Dyballa
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2008-08-09  9:24 UTC (permalink / raw)
  To: gebser; +Cc: GNU Emacs List

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]


Am 09.08.2008 um 08:41 schrieb ken:

> ;; automatically save the desktop on exit.
> (setq desktop-enable t)


   This variable is an alias for `desktop-save-mode'.
   This variable is obsolete since 22.1;
   use `desktop-save-mode' instead.

--
Greetings

   Pete

To most people solutions mean finding the answers. But to chemists  
solutions
are things that are still all mixed up.



[-- Attachment #2: Signierter Teil der Nachricht --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Load specific files at startup?
       [not found] ` <mailman.16163.1218264049.18990.help-gnu-emacs@gnu.org>
@ 2008-08-11 10:19   ` Xah
  0 siblings, 0 replies; 5+ messages in thread
From: Xah @ 2008-08-11 10:19 UTC (permalink / raw)
  To: help-gnu-emacs

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/^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-11 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.