Open contrapunctus-1 opened 1 month ago
The contents of my parinfer debug file -
Options:
Options { cursor_x: Some(0), cursor_line: Some(7), prev_cursor_x: None, prev_cursor_line: None, prev_text: None, selection_start_line: None, changes: [], partial_result: false, force_balance: false, return_parens: false, comment_char: ';', string_delimiters: ["\""], lisp_vline_symbols: false, lisp_block_comments: false, guile_block_comments: false, scheme_sexp_comments: false, janet_long_strings: false }
Response:
Answer { text: "CHICKEN\n(c) 2008-2021, The CHICKEN Team\n(c) 2000-2007, Felix L. Winkelmann\nVersion 5.3.0 (rev e31bbee5)\nlinux-unix-gnu-x86-64 [ 64bit dload ptables]\n\nType ,? for help.\n#;1> ", success: true, error: None, cursor_x: Some(0), cursor_line: Some(7), tab_stops: [], paren_trails: [ParenTrail { line_no: 3, start_x: 27, end_x: 28 }, ParenTrail { line_no: 4, start_x: 43, end_x: 44 }], parens: [] }
Options:
Options { cursor_x: Some(0), cursor_line: Some(7), prev_cursor_x: None, prev_cursor_line: None, prev_text: None, selection_start_line: None, changes: [], partial_result: false, force_balance: false, return_parens: false, comment_char: ';', string_delimiters: ["\""], lisp_vline_symbols: false, lisp_block_comments: false, guile_block_comments: false, scheme_sexp_comments: false, janet_long_strings: false }
Response:
Answer { text: "CHICKEN\n(c) 2008-2021, The CHICKEN Team\n(c) 2000-2007, Felix L. Winkelmann\nVersion 5.3.0 (rev e31bbee5)\nlinux-unix-gnu-x86-64 [ 64bit dload ptables]\n\nType ,? for help.\n#;1> ", success: true, error: None, cursor_x: Some(0), cursor_line: Some(7), tab_stops: [], paren_trails: [ParenTrail { line_no: 3, start_x: 27, end_x: 28 }, ParenTrail { line_no: 4, start_x: 43, end_x: 44 }], parens: [] }
Normally I would attach a backtrace, but parinfer-rust-mode
seems to be performing some heavy wizardry that prevents M-x toggle-debug-on-error
from providing one.
EDIT: It's because it uses pre-command-hook
.
Thanks for taking the time to report this; however, I don't consider this a bug.
parinfer
needs access to the entire file or buffer to work and the file or buffer that it's working in needs to be a valid lisp file. This means that parinfer-rust-mode
supports things like buffers that contain read-only text or have a mix of sexps and plain text.
I'm open to pull requests if someone wants to make a new minor mode that makes this work.
On the other hand, if all you're looking for is something to auto balance parens, I would recommend electric-pair-mode
instead.
Minimal init.el -
Steps
Error in pre-command-hook (parinfer-rust--check-for-issues): (text-read-only)
GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-06-30, modified by Debian parinfer-rust-mode v0.9.0
EDIT - This seems to be an issue in SLIME and Sly REPLs too.