Skip to content

# in .emacs_workgroup causes parsing error #113

Open

Description

@chipschap

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.

Activity

  1. redguardtoo commented on Mar 6, 2022

    @redguardtoo
    Collaborator

    thanks , could you send me a pull request?

  2. chipschap commented on Mar 6, 2022

    @chipschap
    Author
  3. redguardtoo commented on Mar 6, 2022

    @redguardtoo
    Collaborator

    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.

  4. chipschap commented on Mar 6, 2022

    @chipschap
    Author
  5. redguardtoo commented on Mar 7, 2022

    @redguardtoo
    Collaborator

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

  6. chipschap commented on Mar 7, 2022

    @chipschap
    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!

  7. redguardtoo commented on Mar 8, 2022

    @redguardtoo
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions