nex3/perspective-el — Issue #11: Cannot kill perspective in emacs --daemon mode
Author: fixermark
Created: 2012-01-28 03:02:18+00:00
State: open

Greetings!

Huge fan of persp-mode; I use it all the time in my development work. I've discovered one small issue with it when using it in an emacsclient connected to a process launched from emacs --daemon. Process I used to get into that state:

> emacs --daemon --quick
> emacsclient -t

M-x load-file
M-x persp-mode
C-x x s foo
C-x x c foo

At that point, emacs fails with "wrong-type-argument hash-table-p nil"

Here's the debug dump:

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
maphash((lambda (--cl-var-- persp) (if (and ... ...) (progn ...))) nil)
(catch (quote --cl-block---cl-finish----) (maphash (lambda ... ...) (with-selected-frame frame perspectives-hash)))
(cl-block-wrapper (catch (quote --cl-block---cl-finish----) (maphash ... ...)))
(block --cl-finish-- (maphash (lambda ... ...) (with-selected-frame frame perspectives-hash)))
(catch (quote --cl-block-nil--) (block --cl-finish-- (maphash ... ...)) nil)
(cl-block-wrapper (catch (quote --cl-block-nil--) (block --cl-finish-- ...) nil))
(block nil (block --cl-finish-- (maphash ... ...)) nil)
(loop for persp being the hash-values of (with-selected-frame frame perspectives-hash) if (and (not ...) (memq buffer ...)) do (return-from persp-buffer-in-other-p (cons frame ...)))
(while (consp --cl-var--) (setq frame (car --cl-var--)) (loop for persp being the hash-values of (with-selected-frame frame perspectives-hash) if (and ... ...) do (return-from persp-buffer-in-other-p ...)) (setq --cl-var-- (cdr --cl-var--)))
(let* ((--cl-var-- ...) (frame nil)) (while (consp --cl-var--) (setq frame ...) (loop for persp being the hash-values of ... if ... do ...) (setq --cl-var-- ...)) nil)
(catch (quote --cl-block-nil--) (let* (... ...) (while ... ... ... ...) nil))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let* ... ... nil)))
(block nil (let* (... ...) (while ... ... ... ...) nil))
(loop for frame in (frame-list) do (loop for persp being the hash-values of (with-selected-frame frame perspectives-hash) if (and ... ...) do (return-from persp-buffer-in-other-p ...)))
(catch (quote --cl-block-persp-buffer-in-other-p--) (loop for frame in (frame-list) do (loop for persp being the hash-values of ... if ... do ...)) nil)
(cl-block-wrapper (catch (quote --cl-block-persp-buffer-in-other-p--) (loop for frame in ... do ...) nil))
(block persp-buffer-in-other-p (loop for frame in (frame-list) do (loop for persp being the hash-values of ... if ... do ...)) nil)
persp-buffer-in-other-p(#)
(not (persp-buffer-in-other-p buffer))
(cond ((not ...) (kill-buffer buffer)) ((eq buffer ...) (bury-buffer)) (t (bury-buffer buffer)))
persp-remove-buffer(#)
mapcar(persp-remove-buffer (#))
(progn (persp-switch name) (run-hooks (quote persp-killed-hook)) (mapcar (quote persp-remove-buffer) (persp-buffers persp-curr)) (setf (persp-killed persp-curr) t))
(unwind-protect (progn (persp-switch name) (run-hooks ...) (mapcar ... ...) (setf ... t)) (when G92002 (persp-switch G92002)))
(let ((G92002 ...) (last-persp-cache persp-last)) (unwind-protect (progn ... ... ... ...) (when G92002 ...)) (setq persp-last last-persp-cache))
(progn (let (... ...) (unwind-protect ... ...) (setq persp-last last-persp-cache)))
(with-perspective name (run-hooks (quote persp-killed-hook)) (mapcar (quote persp-remove-buffer) (persp-buffers persp-curr)) (setf (persp-killed persp-curr) t))
persp-kill(nil)
call-interactively(persp-kill nil nil)

Known workaround:
* Running persp-mode again to disable the mode clears the perspectives, and I can then re-create them by hand.

My emacs version is
M-x version
GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1) of 2011-03-04 on palmer, modified by Debian

I'd be happy to answer any questions / run any tests on this end that may be helpful!