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

Invalid read syntax: "#" #28

Open
tumashu opened this issue Mar 26, 2021 · 29 comments
Open

Invalid read syntax: "#" #28

tumashu opened this issue Mar 26, 2021 · 29 comments
Assignees
Labels
bug Something isn't working

Comments

@tumashu
Copy link

tumashu commented Mar 26, 2021

(defun burly--frameset-restore (urlobj)
  "Restore FRAMESET according to URLOBJ."
  (pcase-let* ((`(,_ . ,query-string) (url-path-and-query urlobj))
               (frameset (read (url-unhex-string query-string)))
               (frameset-filter-alist (append burly-frameset-filter-alist frameset-filter-alist)))
    ;; Restore buffers.  (Apparently `cl-loop''s in-ref doesn't work with
    ;; its destructuring, so we can't just `setf' on `window-state'.)
    (setf (frameset-states frameset)
          (cl-loop for (frame-parameters . window-state) in (frameset-states frameset)
                   collect (cons frame-parameters (burly--bufferize-window-state window-state))))
    (frameset-restore frameset)))

I think read will have problem when we have like (cursor-color . "#dcdccc")

tumashu added a commit to tumashu/burly.el that referenced this issue Mar 26, 2021
@alphapapa
Copy link
Owner

Could you share a backtrace of the error occurring, please?

@tumashu
Copy link
Author

tumashu commented Mar 27, 2021

Debugger entered--Lisp error: (invalid-read-syntax "#")
  read("[frameset 1 (24670 49106 650942 294000) nil nil ni...")
  burly--frameset-restore(#s(url :type "emacs+burly+frames" :user nil :password nil :host nil :portspec nil :filename "?%5Bframeset%201%20%2824670%2049106%20650942%20294..." :target nil :attributes nil :fullness nil :silent nil :use-cookies t :asynchronous t))
  burly-open-url("emacs+burly+frames:?%5Bframeset%201%20%2824670%204...")
  burly-bookmark-handler(("burly:frame" (url . "emacs+burly+frames:?%5Bframeset%201%20%2824670%204...") (handler . burly-bookmark-handler)))
  bookmark-handle-bookmark("burly:frame")
  bookmark--jump-via("burly:frame" pop-to-buffer-same-window)
  bookmark-jump("burly:frame")
  burly-open-bookmark("burly:frame")
  (let* ((n (- (length bookmarks) 1)) (pos (or eh-burly-bookmark-position 0)) (bookmark (nth pos bookmarks))) (burly-open-bookmark bookmark) (message "Revert to bookmark: %S" bookmark) (setq eh-burly-bookmark-position (if (>= pos n) 0 (1+ pos))))
  (if bookmarks (let* ((n (- (length bookmarks) 1)) (pos (or eh-burly-bookmark-position 0)) (bookmark (nth pos bookmarks))) (burly-open-bookmark bookmark) (message "Revert to bookmark: %S" bookmark) (setq eh-burly-bookmark-position (if (>= pos n) 0 (1+ pos)))) (burly-bookmark-windows "burly:0") (message "Create bookmark: burly:0") (setq eh-burly-bookmark-position nil))
  (let ((bookmarks (burly-bookmark-names))) (if bookmarks (let* ((n (- (length bookmarks) 1)) (pos (or eh-burly-bookmark-position 0)) (bookmark (nth pos bookmarks))) (burly-open-bookmark bookmark) (message "Revert to bookmark: %S" bookmark) (setq eh-burly-bookmark-position (if (>= pos n) 0 (1+ pos)))) (burly-bookmark-windows "burly:0") (message "Create bookmark: burly:0") (setq eh-burly-bookmark-position nil)))
  eh-burly-open-bookmark()
  funcall-interactively(eh-burly-open-bookmark)
  call-interactively(eh-burly-open-bookmark nil nil)
  command-execute(eh-burly-open-bookmark)

@tumashu
Copy link
Author

tumashu commented Mar 27, 2021

"[frameset 1 (24670 49106 650942 294000) nil nil nil nil ((((minibuffer) (undecorated . t) (override-redirect) (font . \"-fsdf-PragmataPro-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1\") (font-parameter . \"-fsdf-PragmataPro-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1\") (border-width . 0) (internal-border-width . 0) (right-divider-width . 0) (bottom-divider-width . 0) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . \"#d3d3d3\") (background-color . \"#8B8989\") (mouse-color . \"black\") (border-color . \"black\") (screen-gamma) (line-spacing . 0) (left-fringe . 0) (right-fringe . 0) (no-special-glyphs . t) (scroll-bar-foreground) (scroll-bar-background) (min-width . 0) (min-height . 0) (menu-bar-lines . 0) (tab-bar-lines . 0) (height . 10) (tool-bar-lines . 0) (title) (wait-for-wm . t) (tool-bar-position . top) (inhibit-double-buffering) (icon-type . t) (auto-raise) (auto-lower) (cursor-type) (scroll-bar-width . 16) (scroll-bar-height . 16) (alpha) (no-focus-on-map) (no-accept-focus . t) (fullscreen) (visibility) (skip-taskbar) (z-group) (keep-ratio nil) (posframe-buffer \" *company-posframe-buffer*\" . #<buffer  *company-posframe-buffer*>) (child-frame-border-width . 0) (no-other-frame . t) (desktop-dont-save . t) (display-type . color) (background-mode . dark) (cursor-color . \"#dcdccc\") (posframe-hidehandler) (posframe-parent-buffer \"*scratch*\" . #<buffer *scratch*>) (frameset--id . \"56EC-005D-2C2E-1354\") (frameset--parent-frame . \"0CBE-FB7E-4807-49E5\") (frameset--mini nil . \"9A61-ABF1-5350-2888\") (name . \"\") (width . 45) (modeline . t) (unsplittable . t) (left . 8) (top . 21) (icon-name) (display . \":0.0\") (explicit-name)) ((min-height . 10) (min-width . 60) (min-height-ignore . 1) (min-width-ignore . 2) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 210) (min-pixel-width . 540) (min-pixel-height-ignore . 21) (min-pixel-width-ignore . 18) (min-pixel-height-safe . 21) (min-pixel-width-safe . 18)) leaf (last . t) (pixel-width . 405) (pixel-height . 210) (total-width . 45) (total-height . 10) (normal-height . 1.0) (normal-width . 1.0) (parameters (mode-line-format . none) (burly-url . \"emacs+burly+name://? *company-posframe-buffer*\")) (buffer \" *company-posframe-buffer*\" (selected) (hscroll . 0) (fringes 0 0 t nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1)) (prev-buffers (\"*scratch*\" 1 3))) (((minibuffer . t) (undecorated) (override-redirect) (font . \"-fsdf-PragmataPro-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1\") (font-parameter . \"-fsdf-PragmataPro-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1\") (border-width . 0) (internal-border-width . 0) (right-divider-width . 0) (bottom-divider-width . 0) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . \"#d3d3d3\") (background-color . \"#000000\") (mouse-color . \"black\") (border-color . \"black\") (screen-gamma) (line-spacing) (left-fringe . 8) (right-fringe . 8) (no-special-glyphs) (scroll-bar-foreground) (scroll-bar-background) (menu-bar-lines . 0) (tab-bar-lines . 0) (height . 31) (tool-bar-lines . 0) (title) (wait-for-wm . t) (tool-bar-position . top) (inhibit-double-buffering) (icon-type . t) (auto-raise) (auto-lower) (cursor-type . box) (scroll-bar-width . 16) (scroll-bar-height . 16) (alpha) (no-focus-on-map) (no-accept-focus) (fullscreen . maximized) (visibility . t) (skip-taskbar) (z-group) (display-type . color) (background-mode . dark) (cursor-color . \"#dcdccc\") (hyperb:window-system . \"emacs\") (sticky) (environment) (last-focus-update) (frameset--id . \"9A61-ABF1-5350-2888\") (frameset--mini t . t) (name . \"emacs@tumashu\") (modeline . t) (unsplittable) (icon-name) (display . \":0.0\") (explicit-name . t) (width . 150) (left . 0) (top . 31)) ((min-height . 10) (min-width . 60) (min-height-ignore . 2) (min-width-ignore . 4) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 210) (min-pixel-width . 540) (min-pixel-height-ignore . 42) (min-pixel-width-ignore . 36) (min-pixel-height-safe . 21) (min-pixel-width-safe . 18)) leaf (pixel-width . 1366) (pixel-height . 641) (total-width . 151) (total-height . 30) (normal-height . 1.0) (normal-width . 1.0) (parameters (burly-url . \"emacs+burly+bookmark://burly:frame?filename=%22~%2F.emacs.d%2Felpa-27%2Fburly-20201211.58%2Fburly.el%22&front-context-string=%22%20%20%28interactive%29%0A%22&rear-context-string=%22the%20kill%20ring.%5C%22%0A%22&position=4837&defaults=%28%22burly%3Aframe%22%20%22burly.el%22%29\")) (buffer \"burly.el\" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 4837) (start . 4837)) (prev-buffers (\"*scratch*\" 1 1) (\"burly.el\" 10169 10663))) (((minibuffer . t) (undecorated) (override-redirect) (font . \"-fsdf-PragmataPro-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1\") (font-parameter . \"-fsdf-PragmataPro-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1\") (border-width . 0) (internal-border-width . 0) (right-divider-width . 0) (bottom-divider-width . 0) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . \"#d3d3d3\") (background-color . \"#000000\") (mouse-color . \"black\") (border-color . \"black\") (screen-gamma) (line-spacing) (left-fringe . 8) (right-fringe . 8) (no-special-glyphs) (scroll-bar-foreground) (scroll-bar-background) (menu-bar-lines . 0) (tab-bar-lines . 0) (height . 31) (tool-bar-lines . 0) (title) (wait-for-wm . t) (tool-bar-position . top) (inhibit-double-buffering) (icon-type . t) (auto-raise) (auto-lower) (cursor-type . box) (scroll-bar-width . 16) (scroll-bar-height . 16) (alpha) (no-focus-on-map) (no-accept-focus) (fullscreen . maximized) (visibility . t) (skip-taskbar) (z-group) (display-type . color) (background-mode . dark) (cursor-color . \"#dcdccc\") (hyperb:window-system . \"emacs\") (sticky) (environment) (last-focus-update) (frameset--id . \"8C64-700A-AFC4-4B08\") (frameset--mini t) (name . \"emacs@tumashu\") (modeline . t) (unsplittable) (icon-name) (display . \":0.0\") (explicit-name . t) (width . 150) (left . 0) (top . 31)) ((min-height . 10) (min-width . 60) (min-height-ignore . 2) (min-width-ignore . 4) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 210) (min-pixel-width . 540) (min-pixel-height-ignore . 42) (min-pixel-width-ignore . 36) (min-pixel-height-safe . 21) (min-pixel-width-safe . 18)) leaf (pixel-width . 1366) (pixel-height . 641) (total-width . 151) (total-height . 30) (normal-height . 1.0) (normal-width . 1.0) (parameters (burly-url . \"emacs+burly+bookmark://burly:frame?filename=%22~%2F.emacs.d%2Felpa-27%2Fburly-20201211.58%2Fburly.el%22&front-context-string=%22%20%20%28interactive%29%0A%22&rear-context-string=%22the%20kill%20ring.%5C%22%0A%22&position=4837&defaults=%28%22burly%3Aframe%22%20%22burly.el%22%29\")) (buffer \"burly.el\" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 4837) (start . 4837)) (prev-buffers (\"*scratch*\" 1 1) (\"burly.el\" 10169 10663))) (((minibuffer . t) (undecorated) (override-redirect) (font . \"-fsdf-PragmataPro-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1\") (font-parameter . \"-fsdf-PragmataPro-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1\") (border-width . 0) (internal-border-width . 0) (right-divider-width . 0) (bottom-divider-width . 0) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . \"#d3d3d3\") (background-color . \"#000000\") (mouse-color . \"black\") (border-color . \"black\") (screen-gamma) (line-spacing) (left-fringe . 8) (right-fringe . 8) (no-special-glyphs) (scroll-bar-foreground) (scroll-bar-background) (menu-bar-lines . 0) (tab-bar-lines . 0) (height . 31) (tool-bar-lines . 0) (title) (wait-for-wm . t) (tool-bar-position . top) (inhibit-double-buffering) (icon-type . t) (auto-raise) (auto-lower) (cursor-type . box) (scroll-bar-width . 16) (scroll-bar-height . 16) (alpha) (no-focus-on-map) (no-accept-focus) (fullscreen . maximized) (visibility . t) (skip-taskbar) (z-group) (display-type . color) (background-mode . dark) (cursor-color . \"#dcdccc\") (sticky) (environment) (hyperb:window-system . \"emacs\") (last-focus-update . t) (frameset--id . \"0CBE-FB7E-4807-49E5\") (frameset--mini t) (name . \" *Minibuf-1*\") (width . 150) (modeline . t) (unsplittable) (left . 0) (top . 31) (icon-name) (display . \":0.0\") (explicit-name)) ((min-height . 10) (min-width . 60) (min-height-ignore . 2) (min-width-ignore . 4) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 210) (min-pixel-width . 540) (min-pixel-height-ignore . 42) (min-pixel-width-ignore . 36) (min-pixel-height-safe . 21) (min-pixel-width-safe . 18)) leaf (pixel-width . 1366) (pixel-height . 641) (total-width . 152) (total-height . 31) (normal-height . 1.0) (normal-width . 1.0) (parameters (burly-url . \"emacs+burly+name://?*scratch*\")) (buffer \"*scratch*\" (selected . t) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 3) (start . 1)) (prev-buffers (\"burly.el\" 4837 4837) (\"*scratch*\" 1 1))))]"

@alphapapa alphapapa self-assigned this Mar 27, 2021
@alphapapa alphapapa added the bug Something isn't working label Mar 27, 2021
@alphapapa
Copy link
Owner

Thanks, I'm a little busy, but I'll take a look when I have time. Your PR may be a good fix, but there may be a better way that would fix the issue more generally.

@seagle0128
Copy link

Same issue here.

Debugger entered--Lisp error: (invalid-read-syntax "#")
  burly--frameset-restore(#s(url :type "emacs+burly+frames" :user nil :password nil :host nil :portspec nil :filename "?%5Bframeset%201%20%2824672%207294%20797875%200%29..." :target nil :attributes nil :fullness nil :silent nil :use-cookies t :asynchronous t))
  burly-open-url("emacs+burly+frames:?%5Bframeset%201%20%2824672%207...")
  burly-bookmark-handler(("Burly: test" (url . "emacs+burly+frames:?%5Bframeset%201%20%2824672%207...") (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")
  funcall-interactively(burly-open-bookmark "Burly: test")
  #<subr command-execute>(burly-open-bookmark record nil nil)
  ad-Advice-command-execute(#<subr command-execute> burly-open-bookmark record)
  apply(ad-Advice-command-execute #<subr command-execute> (burly-open-bookmark record))
  command-execute(burly-open-bookmark record)
  counsel-M-x-action("burly-open-bookmark")
  #f(compiled-function (x) #<bytecode 0x976502685a2fa82>)("burly-open-bookmark")
  ivy-call()
  #<subr ivy-read>("M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  ivy-posframe--read(#<subr ivy-read> "M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  apply(ivy-posframe--read #<subr ivy-read> ("M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
  #f(advice-wrapper :around #<subr ivy-read> ivy-posframe--read)("M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  apply(#f(advice-wrapper :around #<subr ivy-read> ivy-posframe--read) ("M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
  ivy-read("M-x " ("burly-open-bookmark" "burly-bookmark-frames" "kubel" "centaur-update" "transient-posframe-mode" "ivy-posframe-mode" "org-tree-slide-mode" "list-packages" "all-the-icons-insert" "list-processes" "copyit-file-pathname" "package-reinstall" "rainbow-mode" "customize-group" "eldoc-mode" "find-pdf-file" "centaur-find-pdf-file" "counsel-find-file" "calc" "esup" "centaur-update-packages" "hydra-ivy/ivy-call" "doom-modeline-mode" "tooltip-mode" "all-the-icons-ivy-rich-mode" "counsel-company" "company-box-mode" "toggle-debug-on-error" "lsp-update-server" "ivy-rich-mode" "lsp-install-server" "org-roam-server-mode" "lsp-pyright-format-buffer" "all-the-icons-ivy-rich-kill-buffer" "save-buffer-gbk-as-utf8" "display-battery-mode" "lsp-mode" "flycheck-posframe-mode" "describe-char" "checkdoc" "lsp-organize-imports" "org-capture" "org-toggle-link-display" "persp-mode" "all-the-icons-reset" "counsel-major" "package-install" "treemacs-load-theme" "grip-mode" "count-words" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  #<subr command-execute>(counsel-M-x nil nil nil)
  ad-Advice-command-execute(#<subr command-execute> counsel-M-x)
  apply(ad-Advice-command-execute #<subr command-execute> counsel-M-x)
  command-execute(counsel-M-x)

@alphapapa
Copy link
Owner

@seagle0128 Are you also using posframe, like @tumashu is?

@seagle0128
Copy link

seagle0128 commented Apr 3, 2021

@alphapapa Yes. I saw @tumashu fixed this in tumashu@8a94e91.

@alphapapa
Copy link
Owner

@seagle0128 Thanks.

Should posframe frames be completely excluded, then? Is there any reason for them to ever be saved and restored? AFAIK they're used for temporary UI popups.

@tumashu
Copy link
Author

tumashu commented Apr 4, 2021

I am posframe's maintainer, I think posframe should not be saved and restored, all posframes are only managed by posframe-show,

@alphapapa
Copy link
Owner

@tumashu Thanks, I would tend to agree. Two questions, then:

  1. Under what circumstances are posframes being saved? In other words, what is causing them to be saved? I would generally expect them to be not displayed when a Burly bookmark is made.
  2. What would be the best way to prevent posframes from being saved by Burly?

@tumashu
Copy link
Author

tumashu commented Apr 4, 2021

for speed reason, most posframes only be hide, instead of delete, so it will be saved by burly

@tumashu
Copy link
Author

tumashu commented Apr 4, 2021

posframe is a child-frame, so #24 seem to be a good idea

@sauvala
Copy link

sauvala commented Nov 7, 2021

Hi, I also see this error:

Debugger entered--Lisp error: (invalid-read-syntax "#")
  burly--frameset-restore(#s(url :type "emacs+burly+frames" :user nil :password nil :host nil :portspec nil :filename "?%5Bframeset%201%20%2824968%2018452%20641428%200%2..." :target nil :attributes nil :fullness nil :silent nil :use-cookies t :asynchronous t))
  burly-open-url("emacs+burly+frames:?%5Bframeset%201%20%2824968%201...")
  burly-bookmark-handler(("Burly: abc" (url . "emacs+burly+frames:?%5Bframeset%201%20%2824968%201...") (handler . burly-bookmark-handler)))
  bookmark-handle-bookmark("Burly: abc")
  bookmark--jump-via("Burly: abc" pop-to-buffer-same-window)
  bookmark-jump("Burly: abc")
  burly-open-bookmark("Burly: abc")
  funcall-interactively(burly-open-bookmark "Burly: abc")
  command-execute(burly-open-bookmark record)
  execute-extended-command(nil "burly-open-bookmark" nil)
  funcall-interactively(execute-extended-command nil "burly-open-bookmark" nil)
  command-execute(execute-extended-command)

To my knowledge I don't use postframe so it could be a different error?

@gagbo
Copy link

gagbo commented Nov 7, 2021

You have to go deeper in the backtrace to find the culprit.

When you check the (really) long line with the frameset in this comment you see in the middle this particular frame-local parameter:

(posframe-buffer \" *company-posframe-buffer*\" . #<buffer  *company-posframe-buffer*>)

It is when Burly tries to restore the posframe-buffer value that it reads #<buffer *company-posframe-buffer*>, triggering the "invalid read syntax" error. So if you are not using posframe you have to look for the frame-local parameter that triggers the issue and find a way to remove it from the synchronised parameters.

@TauPan

This comment was marked as resolved.

@gagbo
Copy link

gagbo commented Apr 14, 2023

It would be easier if you tried to get a smaller reproducing case instead of your real usage one I guess. Anyway, this comment still applies, it's not "posframe" that's the issue, the issue is that a variable with a #<...> value is saved. When burly tries to restore values, it needs to read values to put them back into variables, and the #<...> stuff is not readable by default.

The url encoding for #< is %23%3C, so it seems that there's a block with a lot of unreadable variables in it, running the URL inside a URL decoder will probably show you what variables have unreadable values (and should therefore be ignored by burly using the customization options)

@TauPan
Copy link

TauPan commented Apr 14, 2023

Thanks for the hint. I used url-unhex-string and it turns out that I still had persp-mode enabled, which I never got comfortable with, so I disabled it for now instead of configuring burly to ignore the variables. I guess I will mostly be using burly-bookmark-windows anyways, since I very rarely use multiple emacs frames.

@phil-s
Copy link

phil-s commented Jun 29, 2023

it's not "posframe" that's the issue, the issue is that a variable with a #<...> value is saved. When burly tries to restore values, it needs to read values to put them back into variables, and the #<...> stuff is not readable by default.

I can only reiterate that. Trying to maintain a list of known problematic cases isn't practical (and leads to frustration when the user goes to restore a bookmark and finds only then that it isn't going to work, on account of some previously-unknown case); what's necessary is to prevent such unreadable syntax being stored in bookmarks in the first place, so that the problem cannot occur.

@TauPan
Copy link

TauPan commented Jun 29, 2023

it's not "posframe" that's the issue, the issue is that a variable with a #<...> value is saved. When burly tries to restore values, it needs to read values to put them back into variables, and the #<...> stuff is not readable by default.

I can only reiterate that. Trying to maintain a list of known problematic cases isn't practical (and leads to frustration when the user goes to restore a bookmark and finds only then that it isn't going to work, on account of some previously-unknown case); what's necessary is to prevent such unreadable syntax being stored in bookmarks in the first place, so that the problem cannot occur.

Hm, would it be feasible to try to read back the bookmark expression after generating it and catch the exception and convert it into a user friendly error, so the bookmark is not even stored and the user gets a hint about what might be causing the problem?

This idea comes from a very vague understanding what's happening here, so it's likely not possible this way at all.

@alphapapa
Copy link
Owner

Maybe we can use readablep on values before saving them, and omit ones that aren't. It's defined in Emacs 29 and in compat.

alphapapa added a commit that referenced this issue Jun 29, 2023
@alphapapa
Copy link
Owner

All, please try this branch and let me know if it fixes the problem: https:/alphapapa/burly.el/compare/wip/readablep

@alphapapa
Copy link
Owner

@TauPan @phil-s @tumashu @seagle0128 @sauvala @gagbo

Please try this branch and let me know if it fixes the problem: https:/alphapapa/burly.el/compare/wip/readablep If it does, I'll push it to master and make a new release.

@phil-s
Copy link

phil-s commented Jul 12, 2023

That seems to work, except...

I managed to crash Emacs while I was testing, by running bookmark-jump for the bookmark in question a second time after having successfully visited it already; but I've attempted to reproduce the crash in new sessions, calling bookmark-jump many times, and it's been fine every time.

I don't believe the saved bookmark would have changed between tests, so I'm not sure what to make of that -- I haven't seen Emacs crash in a long time, but it's not obvious that it was anything to do with the issue at hand.

Edit: And now I've reproduced it. Not consistently, but I've made Emacs 28.2 segfault twice now. I'll need to report this upstream... I can only presume something happening in readablep is behind it. Or, as it's inconsistent, I suppose maybe it could have happened with the previous code as well... I don't know anything more right now.

@alphapapa
Copy link
Owner

@phil-s Thanks. That's very strange indeed. Please link the bug report here when you file it.

Now I'm not sure what to do about this. I don't want to release code that could make Emacs crash, which is much worse than signaling an error.

@alphapapa
Copy link
Owner

@phil-s Can you reproduce the crash on 29.1?

@phil-s
Copy link

phil-s commented Nov 23, 2023

Ah, my apologies, this fell completely off my radar. I stopped using burly once I realised that Ement.el's Notifications buffer enabled me to eliminate the use-case I'd had for wanting to bookmark and restore a complex arrangement of chat room buffers. I'll try to test it again sometime soon. Feel free to bug me about it if I forget again.

@nrvale0
Copy link

nrvale0 commented Jan 15, 2024

I hope I'm not clouding the issue here but I'm seeing similar behavior though the way I'm getting there is a bit different. I have a bookmark set to open 2-window set with "elfeed-summary" and "ytdl-list" buffers.

Here's the stack trace:

Debugger entered--Lisp error: (invalid-read-syntax "#")
  signal(invalid-read-syntax ("#"))
  burly-bookmark-handler(("Burly: elfeed + downloads" (url . "emacs+burly+frames:?%5Bframeset%201%20%2826011%201...") (handler . burly-bookmark-handler)))
  bookmark-handle-bookmark("Burly: elfeed + downloads")
  bookmark--jump-via("Burly: elfeed + downloads" pop-to-buffer-same-window)
  bookmark-jump("Burly: elfeed + downloads")
  burly-open-bookmark("Burly: elfeed + downloads")
  funcall-interactively(burly-open-bookmark "Burly: elfeed + downloads")
  command-execute(burly-open-bookmark record)
  execute-extended-command(nil "burly-open-bookmark" "bur")
  funcall-interactively(execute-extended-command nil "burly-open-bookmark" "bur")
  command-execute(execute-extended-command)

Out of curiosity I opened up ~/.emacs.d/bookmarks and the entry for "elfeed + downloads" has a ton of data in it and a lot of it it is probably wise to treat as private so I'm unable to share.

I'm open to some debugging if it will help.

thx

@alphapapa
Copy link
Owner

@nrvale0 I guess you'll need to look at what data the elfeed-summary and ytdl-list modes' bookmark functions save. Some of it may include unreadable values. The two potential solutions are to modify their bookmark functions to not include such data (if it's not necessary to include), or to add a translator function to Burly to try to transform it into readable values.

Generally I would expect that the elfeed-summary buffer should only need to include the query, which should be readable. I don't know anything about ytdl. So you should probably try to bookmark just one of those modes and see if only one of them causes the problem.

@nrvale0
Copy link

nrvale0 commented Jan 15, 2024

I will try each of them individually and report back.

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

No branches or pull requests

8 participants