alphapapa / burly.el

Save and restore frames and windows with their buffers in Emacs
GNU General Public License v3.0
301 stars 14 forks source link

window--state-put-2: Wrong type argument: stringp, nil #20

Open gnuvince opened 3 years ago

gnuvince commented 3 years ago

I saved a window configuration in burly (two erlang-mode buffers, magit-status, M-x shell, and a text buffer) and I get this error when I invoke burly-open-bookmark:

window--state-put-2: Wrong type argument: stringp, nil
alphapapa commented 3 years ago

Please provide the backtrace.

gnuvince commented 3 years ago
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  get-buffer(nil)
  window--state-put-2(nil 1057)
  window-state-put((((min-height . 12) (min-width . 30) (min-height-ignore . 9) (min-width-ignore . 15) (min-height-safe . 3) (min-width-safe . 6) (min-pixel-height . 120) (min-pixel-width . 180) (min-pixel-height-ignore . 90) (min-pixel-width-ignore . 90) (min-pixel-height-safe . 30) (min-pixel-width-safe . 36)) hc (pixel-width . 1920) (pixel-height . 1057) (total-width . 320) (total-height . 106) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (leaf (pixel-width . 640) (pixel-height . 1057) (total-width . 106) (total-height . 106) (normal-height . 1.0) (normal-width . 0.3333333333333333) (parameters (burly-url . "emacs+burly+bookmark://samsung_ads.erl?filename=%2...")) (buffer #<buffer samsung_ads.erl> (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 249) (start . 1)) (prev-buffers ("magit: rtb-gateway" 1 152))) (leaf (pixel-width . 640) (pixel-height . 1057) (total-width . 107) (total-height . 106) (normal-height . 1.0) (normal-width . 0.3333333333333333) (parameters (burly-url . "emacs+burly+bookmark://samsung_ads_tests.erl?filen...")) (buffer #<buffer samsung_ads_tests.erl> (selected . t) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1)) (prev-buffers ("samsung_ads_tests.erl" 1 1) ("magit: rtb-gateway" 1 152))) (vc (last . t) (pixel-width . 640) (pixel-height . 1057) (total-width . 107) (total-height . 106) (normal-height . 1.0) (normal-width . 0.3333333333333333) (combination-limit) (leaf (pixel-width . 640) (pixel-height . 353) (total-width . 107) (total-height . 36) (normal-height . 0.3339640491958373) (normal-width . 1.0) (parameters (burly-url . "emacs+burly+bookmark://magit: rtb-gateway?front-co...")) (buffer #<buffer magit: rtb-gateway> (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 152) (start . 1)) (prev-buffers ("samsung_ads.erl" 1 249) ("magit: rtb-gateway" 1 152))) (leaf (pixel-width . 640) (pixel-height . 352) (total-width . 107) (total-height . 35) (normal-height . 0.3330179754020814) (normal-width . 1.0) (parameters (burly-url . "emacs+burly+bookmark://scratch.txt?filename=%22~%2...")) (buffer #<buffer scratch.txt> (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 14592) (start . 13912)) (prev-buffers ("scratch.txt" 13895 14592) ("magit: rtb-gateway" 1 152))) (leaf (last . t) (pixel-width . 640) (pixel-height . 352) (total-width . 107) (total-height . 35) (normal-height . 0.3330179754020814) (normal-width . 1.0) (parameters (burly-url . "emacs+burly+name://?*shell*")) (buffer nil (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 14472) (start . 12304)) (prev-buffers ("magit: rtb-gateway" 1 152))))) #<window 6>)
  burly--windows-set(#s(url :type "emacs+burly+windows" :user nil :password nil :host nil :portspec nil :filename "?%28%28%28min-height%20.%2012%29%20%28min-width%20..." :target nil :attributes nil :fullness nil :silent nil :use-cookies t :asynchronous t))
  burly-open-url("emacs+burly+windows:?%28%28%28min-height%20.%2012%...")
  burly-bookmark-handler(("Burly: rtb-gw" (url . "emacs+burly+windows:?%28%28%28min-height%20.%2012%...") (handler . burly-bookmark-handler)))
  bookmark-handle-bookmark("Burly: rtb-gw")
  bookmark--jump-via("Burly: rtb-gw" pop-to-buffer-same-window)
  bookmark-jump("Burly: rtb-gw")
  burly-open-bookmark("Burly: rtb-gw")
  (progn (burly-open-bookmark "Burly: rtb-gw"))
  eval((progn (burly-open-bookmark "Burly: rtb-gw")) t)
  elisp--eval-last-sexp(t)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x1fcd1fdd9685>)(t)
  apply(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x1fcd1fdd9685>) t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)
  command-execute(eval-print-last-sexp)
alphapapa commented 3 years ago

The backtrace elides some of the values, so it's not possible to see what's going on here.

Anyway, the problem is probably related to your trying to restore buffers that don't have Emacs bookmark support, like shell buffers. See if you can C-x r m on the shell buffer, then kill the buffer and try to load that bookmark. If it doesn't work (and I suspect it won't), that's probably the problem here.

Burly should give a more useful error when that happens, though.

gnuvince commented 3 years ago

Yep, you appear to be correct, this is what I get when I try to save a bookmark in M-x shell:

bookmark-buffer-file-name: Buffer not visiting a file or directory
alphapapa commented 3 years ago

Okay, is that an error being signaled or just a message being printed?

gnuvince commented 3 years ago

That's printed out in *Messages*

alphapapa commented 3 years ago

Thanks. Please try that branch. It should give a useful warning message and allow the remaining buffers to be restored.

Assuming that is so, the next step will be to try to handle buffers like shell ones better when saving a layout. I'm not sure how to do that, though: some buffers, like *scratch*, can only be found by name, so it must be allowed to find buffers by name. But if a buffer can't be saved with an Emacs bookmark, and it's not visiting a file, then it can only be found by name--but then it might not exist when the layout is restored, like in the case of a shell buffer.

Ideally, shell buffers would gain a bookmark-make-record-function so they could be restored (at least to the working directory, I guess).

What do you think? Thanks.

alphapapa commented 11 months ago

I think this is mostly resolved, but I'll take another look before 0.4.