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

# in .emacs_workgroup causes parsing error #113

Open
chipschap opened this issue Mar 4, 2022 · 7 comments
Open

# in .emacs_workgroup causes parsing error #113

chipschap opened this issue Mar 4, 2022 · 7 comments

Comments

@chipschap
Copy link

chipschap commented Mar 4, 2022

This is a re-opening of a bug from back in 2014. I saved an org-agenda file which resulted in this string in the workgroup file:

#<buffer etc.

This gave a syntax read error whenever trying to create or open a new workgroup. It turns out the '#' needs to be escaped and then all is well.

This hackish rewrite of wg-write-sexp-to-file appears to fix the issue. It could surely be done better but it works for me.

(defun wg-write-sexp-to-file (sexp file)
"Write a printable (and human-readable) representation of SEXP to FILE."
(with-temp-buffer
(wg-insert-and-indent sexp)
;;; rjn
(goto-char (point-min))
(while (search-forward " #<" nil t)
(replace-match " \#<" nil t))
;;; rjn
(write-file file)))

The space in " #<" is necessary to avoid re-doing previous edits on future invocations.

I hope this will be of some use.

@redguardtoo
Copy link
Collaborator

thanks , could you send me a pull request?

@chipschap
Copy link
Author

chipschap commented Mar 6, 2022 via email

@redguardtoo
Copy link
Collaborator

redguardtoo commented Mar 6, 2022

I might need a bit more understanding about below code,

(while (search-forward " #<" nil t)
  (replace-match " \#<" nil t))

Why this code work?

A minimum case to reproduce the problem is also very helpful.

@chipschap
Copy link
Author

chipschap commented Mar 6, 2022 via email

@redguardtoo
Copy link
Collaborator

redguardtoo commented Mar 7, 2022

It's because there is no wg-deserialize-org-agenda-mode-buffer,
image

@chipschap
Copy link
Author

Ah, thank you, I see, and this is symptomatic of a bigger problem with buffers not visiting a file. However, a user (like me!) who may create a workgroup with Org Agenda or similar will then have the .emacs_workgroups file made unreadable because of the bare "#" character in front of "<buffer Org Agenda>". This seems like harsh punishment to lose all the saved workspaces!

@redguardtoo
Copy link
Collaborator

342fc30 store buffer name instead of buffer object (Chen Bin)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants