0

I usually have multiple instances of doom emacs running (one for every project).

I use this line in my config to save the session of each instance after 10 seconds idle time.

(run-with-idle-timer 10 t #'doom-save-session)

This leaves me with a bunch of stored session:

> ls -la ~/.emacs.d/.local/etc/workspaces

.rw-r--r-- 39k peter 16 Jun 19:48 autosave
.rw-r--r-- 39k peter 16 Jun 19:48 autosave1
.rw-r--r-- 39k peter 16 Jun 19:44 autosave2
.rw-r--r-- 39k peter 16 Jun 19:44 autosave3

Now the problem is, that I can't see which session belongs to which project.

Does anyone know how I can use a better template for the filenames? E.g.: auto--PROJECT_ROOT_DIR--NUMBER:

.rw-r--r-- 39k peter 16 Jun 19:48 auto--home-peter-projects-foo--1
.rw-r--r-- 39k peter 16 Jun 19:48 auto--home-peter-projects-bar--1
.rw-r--r-- 39k peter 16 Jun 19:44 auto--home-peter-projects-foo--2
.rw-r--r-- 39k peter 16 Jun 19:44 auto--home-peter-projects-bar--2

1 Answer 1

0

Got my feet wet with lisp and hacked this code togehter. It works fine so far:

;; Save project session on 10 sec idle
(run-with-idle-timer 10 t #'project-save-session)

;; and every 180 sec, period
(run-at-time 180 t #'project-save-session)

;; Save session with project root dir in file name:
(defun project-save-session ()
  (setq base_path "/home/peter/.emacs.d/.local/etc/workspaces/auto--")
  (setq project_root (directory-file-name (projectile-project-root)))
  (setq project_root_escaped (replace-regexp-in-string "/" "-" project_root))
  (setq full_path (concat base_path project_root_escaped))
  (doom/save-session full_path))







Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.