Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

burly cannot restore window configuration correctly if buffer name has multibyte characters #43

Closed
ilupin opened this issue Oct 5, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@ilupin
Copy link

ilupin commented Oct 5, 2021

Below are two examples.

  1. create a buffer with a multibyte string as its name
(let ((name "āḃç"))
  (pop-to-buffer (get-buffer-create name))
  (burly-bookmark-windows "burly-test")
  (delete-other-windows)
  (burly-open-bookmark "burly-test"))

produces the following error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  get-buffer(nil)
  window--state-put-2(nil 630)
  window-state-put((((min-height . 8) (min-width . 10) (min-height-ignore . 4) (min-width-ignore . 6) (min-height-safe . 2) (min-width-safe . 2) (min-pixel-height . 144) (min-pixel-width . 90) (min-pixel-height-ignore . 72) (min-pixel-width-ignore . 54) (min-pixel-height-safe . 36) (min-pixel-width-safe . 18)) vc (pixel-width . 752) (pixel-height . 630) (total-width . 83) (total-height . 35) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (leaf (pixel-width . 752) (pixel-height . 306) (total-width . 83) (total-height . 17) (normal-height . 0.5) (normal-width . 1.0) (parameters (burly-url . "emacs+burly+name://?*scratch*")) (buffer #<buffer *scratch*> (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 311) (start . 1)) (prev-buffers ("a\304\201b\341\270\203c\303\247" 1 1))) (leaf (last . t) (pixel-width . 752) (pixel-height . 324) (total-width . 83) (total-height . 18) (normal-height . 0.5) (normal-width . 1.0) (parameters (burly-url . "emacs+burly+name://?\304\201\341\270\203\303\247")) (buffer nil (selected . t) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1)))) #<window 43 on  *temp*>)
  (progn (window-state-put state (frame-root-window)) (setq burly--window-state (window-state-get (frame-root-window) 'writable)) (setq bookmark-after-jump-hook (cons #'burly--bookmark-window-state-hack bookmark-after-jump-hook)))
  (let* ((state (condition-case nil (read (url-unhex-string query-string)) (invalid-read-syntax (display-warning 'burly "Please recreate that Burly bookmark (storage forma...") (read query-string)))) (state (burly--bufferize-window-state state))) (progn (window-state-put state (frame-root-window)) (setq burly--window-state (window-state-get (frame-root-window) 'writable)) (setq bookmark-after-jump-hook (cons #'burly--bookmark-window-state-hack bookmark-after-jump-hook))))
  (let ((query-string x9)) (let* ((state (condition-case nil (read (url-unhex-string query-string)) (invalid-read-syntax (display-warning 'burly "Please recreate that Burly bookmark (storage forma...") (read query-string)))) (state (burly--bufferize-window-state state))) (progn (window-state-put state (frame-root-window)) (setq burly--window-state (window-state-get (frame-root-window) 'writable)) (setq bookmark-after-jump-hook (cons #'burly--bookmark-window-state-hack bookmark-after-jump-hook)))))
  (let* ((window-persistent-parameters (append burly-window-persistent-parameters window-persistent-parameters)) (val (url-path-and-query urlobj)) (x9 (cdr val))) (let ((query-string x9)) (let* ((state (condition-case nil (read (url-unhex-string query-string)) (invalid-read-syntax (display-warning ... "Please recreate that Burly bookmark (storage forma...") (read query-string)))) (state (burly--bufferize-window-state state))) (progn (window-state-put state (frame-root-window)) (setq burly--window-state (window-state-get (frame-root-window) 'writable)) (setq bookmark-after-jump-hook (cons #'burly--bookmark-window-state-hack bookmark-after-jump-hook))))))
  burly--windows-set(#s(url :type "emacs+burly+windows" :user nil :password nil :host nil :portspec nil :filename "?%28%28%28min-height%20.%208%29%20%28min-width%20...." :target nil :attributes nil :fullness nil :silent nil :use-cookies t :asynchronous t))
  (cond ((member subtype '("name" "file" "bookmark")) (pop-to-buffer (burly-url-buffer url))) ((equal subtype '"frames") (burly--frameset-restore urlobj)) ((equal subtype '"windows") (burly--windows-set urlobj)) (t (let ((x1 subtype)) (error "No clause matching `%S'" x1))))
  (let* ((subtype (car (last (split-string type "+" 'omit-nulls))))) (cond ((member subtype '("name" "file" "bookmark")) (pop-to-buffer (burly-url-buffer url))) ((equal subtype '"frames") (burly--frameset-restore urlobj)) ((equal subtype '"windows") (burly--windows-set urlobj)) (t (let ((x1 subtype)) (error "No clause matching `%S'" x1)))))
  (let ((type x0)) (let* ((subtype (car (last (split-string type "+" 'omit-nulls))))) (cond ((member subtype '("name" "file" "bookmark")) (pop-to-buffer (burly-url-buffer url))) ((equal subtype '"frames") (burly--frameset-restore urlobj)) ((equal subtype '"windows") (burly--windows-set urlobj)) (t (let ((x1 subtype)) (error "No clause matching `%S'" x1))))))
  (let* ((urlobj (url-generic-parse-url url)) (x0 (aref urlobj 1))) (let ((type x0)) (let* ((subtype (car (last (split-string type "+" ...))))) (cond ((member subtype '("name" "file" "bookmark")) (pop-to-buffer (burly-url-buffer url))) ((equal subtype '"frames") (burly--frameset-restore urlobj)) ((equal subtype '"windows") (burly--windows-set urlobj)) (t (let ((x1 subtype)) (error "No clause matching `%S'" x1)))))))
  burly-open-url("emacs+burly+windows:?%28%28%28min-height%20.%208%2...")
  burly-bookmark-handler(("burly-test" (url . "emacs+burly+windows:?%28%28%28min-height%20.%208%2...") (handler . burly-bookmark-handler)))
  bookmark-handle-bookmark("burly-test")
  bookmark--jump-via("burly-test" pop-to-buffer-same-window)
  bookmark-jump("burly-test")
  burly-open-bookmark("burly-test")
  (let ((name "āḃç")) (pop-to-buffer (get-buffer-create name)) (burly-bookmark-windows "burly-test") (delete-other-windows) (burly-open-bookmark "burly-test"))
  (progn (let ((name "āḃç")) (pop-to-buffer (get-buffer-create name)) (burly-bookmark-windows "burly-test") (delete-other-windows) (burly-open-bookmark "burly-test")))
  eval((progn (let ((name "āḃç")) (pop-to-buffer (get-buffer-create name)) (burly-bookmark-windows "burly-test") (delete-other-windows) (burly-open-bookmark "burly-test"))) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
  1. create a dired buffer visiting a directory. In this case, there is no error, but the directory name is displayed as bytes
(let ((dir (expand-file-name "āḃç" temporary-file-directory)))
  (ignore-errors (make-directory dir))
  (pop-to-buffer (find-file dir))
  (burly-bookmark-windows "burly-test")
  (delete-other-windows)
  (burly-open-bookmark "burly-test"))
@alphapapa
Copy link
Owner

Thanks, I think that should fix it. Please let me know if it works for you.

@ilupin
Copy link
Author

ilupin commented Oct 5, 2021

Thank you, I think the problem described by the first example has been fixed.

However, the displaying problem can still be reproduced. Please see the screenshot below. The directory name is "āḃç", but is displayed wrongly in the dired buffer and the modeline.

(let ((dir (expand-file-name "āḃç" temporary-file-directory)))
  (ignore-errors (make-directory dir))
  (pop-to-buffer (find-file dir))
  (burly-bookmark-windows "burly-test")
  (delete-other-windows)
  (burly-open-bookmark "burly-test"))

image

alphapapa added a commit that referenced this issue Oct 5, 2021
Fixes #43.  Thanks to Liu Hui (@ilupin) for reporting.
@alphapapa
Copy link
Owner

Thanks, this most recent commit should fix that as well. Please let me know if it works for you.

@alphapapa alphapapa reopened this Oct 5, 2021
@alphapapa alphapapa added the bug Something isn't working label Oct 5, 2021
@ilupin
Copy link
Author

ilupin commented Oct 5, 2021

It works well. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants