justinbarclay / parinfer-rust-mode

Simplifying how you write Lisp
https://shaunlebron.github.io/parinfer/
GNU General Public License v3.0
227 stars 16 forks source link

Issues with `org-mode` source block, when in `ident` mode #51

Closed lebensterben closed 2 years ago

lebensterben commented 3 years ago

Suppose

* Foo
#+BEGIN_SRC elisp
(when (> 1 2)
  "y")
#+END_SRC

If I format the region, #+BEGIN_SRC elisp and #+END_SRC would be indented according to its level. For example:

* Foo
  #+BEGIN_SRC elisp
(when (> 1 2)
  "y")
  #+END_SRC

Then parinfer would erroneously think the line #+END_SRC is a part of the buffer. And since it's indented, it becomes

* Foo
  #+BEGIN_SRC elisp
(when (> 1 2)
  "y"
  #+END_SRC)
justinbarclay commented 3 years ago

Hi, thanks for the bug report.

If I understand what you're saying, you're using ord-edit-special to open the code block in a new buffer and then have parinfer-rust-mode format said buffer? If so, I'm not sure how this is a bug in parinfer-rust-mode. parinfer-rust-mode operates on the entire buffer that it is given. So, if org-mode is adding the #+END_SRC line into the elisp buffer then it's going to treat that as some lisp code and enforce the parinfer rule set on it.

lebensterben commented 3 years ago

you're using ord-edit-special to open the code block in a new buffer and then have parinfer-rust-mode format said buffer

Nope, I'm editing the code block just in the buffer of the org file.

justinbarclay commented 3 years ago

I'm not sure how parinfer-rust-mode is running in org-mode when you aren't editing it in a specific source code buffer.

Are you running it as a minor mode for org-mode?

lebensterben commented 2 years ago

Sorry I haven't respond to you in a timely manner. This is not reproducible now so it can be safely closed.