Git Product home page Git Product logo

Comments (5)

gcv avatar gcv commented on August 16, 2024

(persp-state-load "/path/to/persp-state-file.el") should work from a startup file. There was a PR for giving persp-state-load default argument values which would make it work from a hook (#120), but it was never taken over the finish line.

from perspective-el.

ikbenlike avatar ikbenlike commented on August 16, 2024

I tried (persp-state-load persp-state-default-file) in my init.el, but it doesn't seem to load the saved perspectives. It also doesn't seem to error at all, so it's hard for me to tell what's wrong. Loading the perspectives with keybinds still works in either case.

Also, as far as I can tell from the code here in the repo, persp-state-load does take a default value similar to persp-state-save, but I'm not very good at elisp so that might not be correct

from perspective-el.

gcv avatar gcv commented on August 16, 2024

persp-state-load only takes a default when called interactively (i.e. with a keybinding or from M-x). The PR I linked above was an attempt to have it also take a default when called non-interactively (i.e. from Lisp code).

I wonder if (persp-state-load persp-state-default-file) failed for you in init.el because you called it before loading and initializing perspective.el? Please try the code from eval-expression (M-: in vanilla Emacs) after startup. That works for me.

from perspective-el.

ikbenlike avatar ikbenlike commented on August 16, 2024

running it through eval-expression does indeed work - however, from my understanding, perspective.el would already be loaded by the time it tries to run that line in my init.el, since I can succesfully add the save hook on the previous line, like so:

(use-package perspective
  :bind
  ("C-x C-b" . persp-list-buffers)
  :custom
  (persp-mode-prefix-key (kbd "C-z"))
  :init
  (persp-mode))

(add-hook 'kill-emacs-hook #'persp-state-save)
(persp-state-load persp-state-default-file)

from perspective-el.

ikbenlike avatar ikbenlike commented on August 16, 2024

After some more testing I found out that I can auto-load the stored perspectives on startup in this way:

(add-hook 'after-init-hook
		  (lambda ()
			(persp-state-load persp-state-default-file)))

It appears simply putting the line (persp-state-load persp-state-default-file) at the end of the init.el file also works; however, I didn't notice because the default splash screen kept popping up. After I disabled the splash both of these options seem to behave the same. Two differences with desktop.el seem to be that perspective.el doesn't circumvent the splash and doesn't seem to save the emacs window size. The former is easily fixed, and the latter is not really a problem to me personally.

from perspective-el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.