pashinin / workgroups2

Workgroups2 - Emacs session manager
http://workgroups2.rtfd.org/
GNU General Public License v3.0
295 stars 42 forks source link

~/.emacs_workgroups is corrupt sometimes #29

Closed redguardtoo closed 10 years ago

redguardtoo commented 10 years ago

Here is one file, maybe some # character?

[cl-struct-wg-session "0GEA0XVF0TZ6AHBC-JUTXJ" nil t nil "~/.emacs_workgroups" "1.0.1" ([cl-struct-wg-workgroup "0GEA0XVF0UOKGRE8-JUUEM" "First workgroup" t nil [c    l-struct-wg-wconfig "0GEA1DA8CNEOBSDS-27JF6B" nil ((fullscreen)) nil nil 239 67 nil nil [cl-struct-wg-wtree nil nil (0 1 239 66) ([cl-struct-wg-win nil nil (0 1 11    9 66) 1221 1 0 nil t nil "0GEA0Y1MHB7S7EZ4-UG0QE"] [cl-struct-wg-win nil nil (119 1 239 66) 17078 16675 0 nil nil nil "0GEA15WY6AMW59TC-1FRV6V"])]] nil nil nil ("0    GEA1AZ85CYDA474-239XSS" "0GEA19C75G3BDSWW-1X73D3" "0GEA18LX8QW1CK5S-1U4MDK" "0GEA18JLIFNC6K40-1SNRGJ" "0GEA15WY6AMW59TC-1FRV6V" "0GEA17QWK6IA0D48-1O1EYH" "0GEA17QO    436E8T4O-1NZW3D" "0GEA170L8ZYQCXA0-1LKVVP" "0GEA15YPDYPVJS6W-1GBETG" "0GEA157X5CZG2GQG-1DQQ1A" "0GEA13LE2DXB7B48-1AR8PY" "0GEA13LE1SCXJAG0-1AR6I7" "0GEA12WLALVJGZV    S-15PPAO" "0GEA12JJ0H9KDBXS-147P3X" "0GEA0YSOIE7T2YHC-VSAO8" "0GEA0Y1MHB7S7EZ4-UG0QE" "0GEA0XZUD2L9EJ5C-RA53T" "0GEA0XZPIFUY39A8-R0PAK" "0GEA0XZMFZZJ9FI8-QC6SP" "0    GEA0XVF0ULP8XRC-JUUAG" "0GEA0XVQE5BG7BW0-PZ0OO")]) ([cl-struct-wg-buf "0GEA19C75G3BDSWW-1X73D3" "*Kill Ring*" nil 1 nil ((major-mode . browse-kill-ring-mode) nil n    il nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA18LX8QW1CK5S-1U4MDK" "*Packages*" nil 84172 1 ((major-mode . package-menu-mode) nil nil nil nil nil nil nil    ) nil nil] [cl-struct-wg-buf "0GEA15YPDYPVJS6W-1GBETG" "*helm-mode-describe-package*" nil 18 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil     nil] [cl-struct-wg-buf "0GEA18JLIFNC6K40-1SNRGJ" "*helm-mode-basic-save-buffer*" nil 19 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil]     [cl-struct-wg-buf "0GEA12JJ0H9KDBXS-147P3X" "*helm-mode-find-function*" nil 15 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struc    t-wg-buf "0GEA17QWK6IA0D48-1O1EYH" "*helm imenu*" nil 19 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA170L8ZYQ    CXA0-1LKVVP" "*helm-mode-org2blog/wp-login*" nil 19 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA157X5CZG2GQG-    1DQQ1A" "*helm-mode-org-set-tags*" nil 14 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA13LE1SCXJAG0-1AR6I7" "     *popwin-empty*" nil 1 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0XZMFZZJ9FI8-QC6SP" "*helm recentf*" nil 9     nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA12WLALVJGZVS-15PPAO" "*helm-mode-moz-load-js-file-and-send-it*" n    il 94 nil ((major-mode . fundamental-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0XZPIFUY39A8-R0PAK" "marmalade.el" "/home/cb/projs/emacs-ar    chive/marmalade.el" 86913 437 ((major-mode . emacs-lisp-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0XZUD2L9EJ5C-RA53T" "gnu.el" "/home/cb/p    rojs/emacs-archive/gnu.el" 205 nil ((major-mode . emacs-lisp-mode) nil nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0YSOIE7T2YHC-VSAO8" "work.org" "/ho    me/cb/org/work/work.org" 35695 35475 ((major-mode . org-mode) (mark-ring 35475 34911 34778 137 137 1837) nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA1    7QO436E8T4O-1NZW3D" "tar-mode.el" "/usr/share/emacs/24.3/lisp/tar-mode.el" 16307 51267 ((major-mode . emacs-lisp-mode) (mark-ring 1867 1840 1763 1924 1867 1840 176    3 2082 2082 135 135 2475 4322 26226) nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0XVF0ULP8XRC-JUUAG" "*scratch*" nil 297 334 ((major-mode . lisp-inter    action-mode) (mark-ring 397) nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA0XVQE5BG7BW0-PZ0OO" "*Messages*" nil 1 1 ((major-mode . fundamental-mode) (ma    rk-ring 1 1 1) nil nil nil nil nil nil) nil nil] [cl-struct-wg-buf "0GEA13LE2DXB7B48-1AR8PY" "*Help*" nil 1 1 ((major-mode . help-mode) (mark-ring 1 1) nil nil nil     nil nil nil) (wg-deserialize-help-mode-buffer ("/usr/share/emacs/24.3/lisp/emacs-lisp/" ((describe-variable package-archives #<buffer package.el>) ((1 describe-va    riable package-archives #<buffer package.el>) (1 describe-variable package-directory-list #<buffer package.el>) (1 describe-variable package-user-dir #<buffer pack    age.el>) (1 describe-variable package-alist #<buffer package.el>) (504 describe-variable package-load-list #<buffer package.el>) (1 describe-package w3m) (31155 de    scribe-variable package-archive-contents #<buffer package.el>) (57 describe-function list-packages) (40 describe-function package-list-packages) (563 describe-vari    able tar-update-datestamp #<buffer *Help*>) (753 describe-function tar-mode)) nil))) nil] [cl-struct-wg-buf "0GEA1AZ85CYDA474-239XSS" "init-elpa.el" "/home/cb/.ema    cs.d/init-elpa.el" 1972 1926 ((major-mode . emacs-lisp-mode) (mark-ring 1869 1404 1322 4175 1972 1926 1869 1404 4175 1972 1926 1869 1404 4175 1972 1926) nil nil ni    l nil nil nil) nil nil] [cl-struct-wg-buf "0GEA15WY6AMW59TC-1FRV6V" "package.el" "/usr/share/emacs/24.3/lisp/emacs-lisp/package.el" 17078 17246 ((major-mode . emac    s-lisp-mode) (mark-ring 18469 37927 22158 22354 22354 25189 27328 27305 50746 44309 45009 43903 45009 43903 45009 43903) nil nil nil nil nil nil) nil nil] [cl-stru    ct-wg-buf "0GEA0Y1MHB7S7EZ4-UG0QE" "README.org" "/home/cb/projs/emacs-archive/README.org" 1221 1477 ((major-mode . org-mode) (mark-ring 1299 628 39) nil nil nil ni    l nil nil) nil nil])]
pashinin commented 10 years ago

I've met this problem. It's rare (for me) and I don't know yet what caused it. But the fix (manually) was really simple: You can replace #(...) in session file with nil. That worked for me.

I see that in your file there is not only one # occurence

redguardtoo commented 10 years ago

I'm not familiar with this part of elisp. but there is some doc on http://www.gnu.org/software/emacs/manual/html_node/elisp/Streams-Intro.html#Streams-Intro , does this help? quoted:

However, these two operations are not precisely inverse to each other. There are three kinds of exceptions:

    Printing can produce text that cannot be read. For example, buffers, windows, frames, subprocesses and markers print as text that starts with ‘#’; if you try to read this text, you get an error. There is no way to read those data types.
    One object can have multiple textual representations. For example, ‘1’ and ‘01’ represent the same integer, and ‘(a b)’ and ‘(a . (b))’ represent the same list. Reading will accept any of the alternatives, but printing must choose one of them.
    Comments can appear at certain points in the middle of an object's read sequence without affecting the result of reading it. 
pashinin commented 10 years ago

Printing can produce text that cannot be read ...

Seems to be the exact problem. Well, I'm experimenting with the code. I changed the code which might caused the bug. Also removed some code for old versions of Emacs. Need more time to test it all.

pashinin commented 10 years ago

Will you try to use a "test" branch: https://github.com/pashinin/workgroups2/tree/test for some time and tell if the bug is still appearing?

redguardtoo commented 10 years ago

ok

didoarellano commented 10 years ago

It still happens for me on the test branch. I've been able to reproduce the error consistently by opening a *Help* buffer, saving the workgroup session, and then relaunching Emacs.

redguardtoo commented 10 years ago

not resolved

pashinin commented 10 years ago

Thank you, @didoarellano, but I can't reproduce it (works for me). Tell me please Emacs version and (just for example) what is in a help bufer (function name). Maybe the problem is in saving local variables.

@redguardtoo, the same here? help-mode?

As I cannot reproduce it now - you can comment out block for help-mode in https://github.com/pashinin/workgroups2/blob/test/src/workgroups-specialbufs.el#L32 workgroups-specialbufs.el and tell if it is only 1 mode problem.

redguardtoo commented 10 years ago

yes On Feb 25, 2014 9:46 PM, "Sergey Pashinin" notifications@github.com wrote:

Thank you, @didoarellano https://github.com/didoarellano, but I can't reproduce it (works for me). Tell me please Emacs version and (just for example) what is in a help bufer (function name). Maybe the problem is in saving local variables.

@redguardtoo https://github.com/redguardtoo, the same here? help-mode?

As I cannot reproduce it now - you can comment out block for help-mode in https://github.com/pashinin/workgroups2/blob/test/src/workgroups-specialbufs.el#L32workgroups-specialbufs.el and tell if it is only 1 mode problem.

Reply to this email directly or view it on GitHubhttps://github.com/pashinin/workgroups2/issues/29#issuecomment-35995568 .

redguardtoo commented 10 years ago

I'm just thinking if it can easily be work arounded by replace "#" with nil manually, why not just replace "#" before saving in elisp?

pashinin commented 10 years ago

@redguardtoo, replacing all these symbols? Well, what if it exists somewhere in a string... If so - this is not a good a hack. I disabled this mode for now so that nobody broke their files.

pashinin commented 10 years ago

Reproduced:

help-xref-stack-item is a variable defined in `help-mode.el'.
Its value is (describe-variable help-xref-stack-item #<buffer *Help*>)

Ideas how to fix this? It's a value of a variable help-xref-stack-item that is saved and executed on restore:

(describe-variable help-xref-stack-item #<buffer *Help*>)
Invalid read syntax: "#"

Optional "buffer" parameter is needed to restore help buffer for a local variable correctly.

redguardtoo commented 10 years ago

I think you can ignore all these buffers, in really world I usually just care about files opened. just pick a random opened file as a place holder for the sub-window.

didoarellano commented 10 years ago

Running master with the disabled help buffer handling now and so far so good. I was actually already working on advising wg-save-session to kill all help buffers before saving. Like @redguardtoo, I don't really care if help buffers are restored either.

This is way late but in case it's still useful, I was running Emacs 24.3.1 and wg-default-session-file (anything really but just an example) open in the *Help* buffer.

Wish I could help more but my Elisp-fu is weak.

pashinin commented 10 years ago

I also don't care much about help (or such) buffers. Someone may still like this feature. Ok, close it.

redguardtoo commented 2 years ago

386c11e review and fixed bugs about special buffers (Chen Bin)