Bad-ptr / persp-mode.el

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

persp-mode ignores old buffer-predicate in new frame? #41

Closed bmag closed 8 years ago

bmag commented 8 years ago

I'm trying to use a custom non-persp-mode-related buffer-predicate frame parameter together with persp-mode. From what I understand, this should be enough:

(push '(buffer-predicate . my-predicate) default-frame-alist)
(set-frame-parameter nil 'buffer-predicate 'my-predicate) ; I'm not sure if this is needed
(persp-mode)

And now C-x <right> (next-buffer) and friends should consider both persp-mode's predicate and my custom predicate. However, if I create a new frame, the command next-buffer ignores my custom predicate in the new frame.

Reproduction recipe:

(setq persp-auto-resume-time -1)

(defun my-test-func (buffer)
  (message "Test: %s" buffer)
  t)

(push '(buffer-predicate . my-test-func) default-frame-alist)
(set-frame-parameter nil 'buffer-predicate 'my-test-func)
(require 'persp-mode)
(persp-mode)

Observed values: In first frame:

In second frame:

Expected values: In first frame: I don't know what to expect In second frame: buffer-predicate should contain a call to my-test-func, according to the code in persp-set-frame-buffer-predicate:

(case old-pred
  ;; --- snipped ---
  (t
   (if persp-frame-buffer-predicate
       #'(lambda (b)
           (and
            (funcall persp-frame-buffer-predicate b)
            (funcall old-pred b)))
     old-pred)))
Bad-ptr commented 8 years ago

Yes, you are right. This needs to be fixed.

Bad-ptr commented 8 years ago

Hope this will work for most cases 255273b33f2246aaa82ea95900e71b3647b0664b .

bmag commented 8 years ago

It seems to work, thank you :smiley: