Bad-ptr / persp-mode.el

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

(invalid-function lambda) when using `def-auto-persp' #61

Closed terlar closed 7 years ago

terlar commented 7 years ago

Since the latest update there seems to have been some change introduced that breaks this, if I roll-back to the latest release version 2.9.4 there is no issue, but if I use the latest package version from MELPA I get a backtrace during start.

My config block for auto-persp:

  (defvar after-find-file-hook nil)
  (advice-add 'find-file :after
    (lambda (&rest args) (run-hooks 'after-find-file-hook)))

  (def-auto-persp "projectile"
    :parameters '((dont-save-to-file . t))
    :hooks '(after-find-file-hook)
    :switch 'frame
    :predicate
    (lambda (_buffer)
      (when (and (buffer-file-name) (projectile-project-p))
        t))
    :get-name-expr
    (lambda ()
      (projectile-project-name)))

I have also tried to prefix the lambda with #' or ', but none of these works. Did something change in the latest version, is this not the way to do this anymore?

Thanks for a great package :+1:

Bad-ptr commented 7 years ago

Hmm. Really, this is a bug. As a workaround you can try this(it must work even after I'll fix this bug):

(def-auto-persp "projectile"
    :parameters '((dont-save-to-file . t))
    :hooks '(after-find-file-hook)
    :switch 'frame
    :predicate
    '((lambda (_buffer)
        (when (and (buffer-file-name) (projectile-project-p))
          t)))
    :get-name-expr
    (lambda ()
      (projectile-project-name)))
Bad-ptr commented 7 years ago

Must be fixed in d38f7546a070b1a4f8c1fcd617d00e3767d716b0