Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
403 stars 44 forks source link

Unable to create/handle persp-mode #96

Open hjpotter92 opened 6 years ago

hjpotter92 commented 6 years ago

I have gone through the discussions in issues #9 and #18. I have cleared all obsolete packages, made sure that I am using persp-mode and persp-mode-projectile-bridge.

When I enable persp-mode and try to create/switch buffer (using C-c p s), it raises the following:

Debugger entered--Lisp error: (void-function make-persp-internal)
  make-persp-internal(:name ".files")
  persp-add-new(".files")
  persp-frame-switch(nil)
  funcall-interactively(persp-frame-switch nil)
  call-interactively(persp-frame-switch nil nil)
  command-execute(persp-frame-switch)

I have a self compiled emacs 26.1 running with -Q and --debug-init flags.

hjpotter92 commented 6 years ago

In addition to that error, after I closed and started emacs in normal mode, I receive yet another large traceback:

Debugger entered--Lisp error: (void-function make-persp-internal)
  make-persp-internal(:name ".files")
  persp-add-new(".files" #<hash-table equal 1/10 0x2c63671>)
  #f(compiled-function (name dbufs dwc &optional dparams weak auto hidden) #<bytecode 0x2c61f9d>)(".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil)
  apply(#f(compiled-function (name dbufs dwc &optional dparams weak auto hidden) #<bytecode 0x2c61f9d>) (".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil))
  persp-from-savelist-0((def-persp ".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil) #<hash-table equal 1/10 0x2c63671> nil)
  #f(compiled-function (pd) #<bytecode 0x2c62381>)((def-persp ".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil))
  mapcar(#f(compiled-function (pd) #<bytecode 0x2c62381>) ((def-persp nil nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 35) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 444) (start . 1)))) (def-params nil) t nil nil) (def-persp ".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil)))
  persps-from-savelist-0(((def-persp nil nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 35) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 444) (start . 1)))) (def-params nil) t nil nil) (def-persp ".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil)) #<hash-table equal 1/10 0x2c63671> "/home/hjpotter92/.emacs.d/persp-confs/persp-auto-save" nil nil)
  persps-from-savelist(((def-persp nil nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 35) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 444) (start . 1)))) (def-params nil) t nil nil) (def-persp ".files" nil (def-wconf (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 72) (min-pixel-width . 90) (min-pixel-height-ignore . 36) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 18) (min-pixel-width-safe . 18)) leaf (pixel-width . 1362) (pixel-height . 643) (total-width . 151) (total-height . 36) (normal-height . 1.0) (normal-width . 1.0) (buffer "*Messages*" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 2 t nil 0 t) (vscroll . 0) (dedicated) (point . 487) (start . 1)))) (def-params nil) nil nil nil)) #<hash-table equal 1/10 0x2c63671> "/home/hjpotter92/.emacs.d/persp-confs/persp-auto-save" nil nil)
  persp-load-state-from-file()
  #f(compiled-function () #<bytecode 0x2b665f9>)()
  apply(#f(compiled-function () #<bytecode 0x2b665f9>) nil)
  timer-event-handler([t 23409 15441 776113 nil #f(compiled-function () #<bytecode 0x2b665f9>) nil nil 401000])

This is my configuration for persp-mode:


(use-package persp-mode
  :no-require t
  :init
  (progn
    (persp-mode t))
  :config
  (progn
    (use-package persp-mode-projectile-bridge
      :ensure t
      :config
      (progn
        (with-eval-after-load "persp-mode-projectile-bridge-autoloads"
          (add-hook 'persp-mode-projectile-bridge-mode-hook
                    #'(lambda ()
                        (if persp-mode-projectile-bridge-mode
                            (persp-mode-projectile-bridge-find-perspectives-for-all-buffers)
                          (persp-mode-projectile-bridge-kill-perspectives))))
          (add-hook 'after-init-hook
                    #'(lambda ()
                        (persp-mode-projectile-bridge-mode 1))
                    t))))))
seagle0128 commented 5 years ago

Same issue here. Any update, please?

seagle0128 commented 5 years ago

@hjpotter92 You can try my workaround in https://github.com/seagle0128/.emacs.d/commit/4b87e7cf00d0a343ed75928d18aee59cd81b6465 : redefine persp-add-new in :config section.

I think the root cause is use-pcakge needs autoloads and delayed load the package, but persp-mode needs byte-compilation and load immediately. :no-require keyword is deprecated currently. (maybe :demand or other keywords work? I am not sure)

Anyway, the workaround works well for me now.