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

Error in REPLs #97

Open
contrapunctus-1 opened this issue Jul 14, 2024 · 3 comments
Open

Error in REPLs #97

contrapunctus-1 opened this issue Jul 14, 2024 · 3 comments

Comments

@contrapunctus-1
Copy link

contrapunctus-1 commented Jul 14, 2024

Minimal init.el -

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

(package-install 'geiser)
(require 'geiser)
(package-install 'geiser-chicken)
(require 'geiser-chicken)
(package-install 'geiser-guile)
(require 'geiser-guile)

(package-install 'parinfer-rust-mode)
(require 'parinfer-rust-mode)

(add-hook 'geiser-repl-mode-hook 'parinfer-rust-mode)
(setq-default indent-tabs-mode nil)
(setq-default parinfer-rust--in-debug t)

Steps

  1. Install CHICKEN, Guile, or other Scheme implementation supported by Geiser
  2. Start Emacs with the given init.el
  3. M-x geiser-chicken, or M-x geiser-guile, etc
  4. Insert an opening parenthesis. An error is displayed -
    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.

@contrapunctus-1
Copy link
Author

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: [] }

@contrapunctus-1
Copy link
Author

contrapunctus-1 commented Jul 14, 2024

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.

@contrapunctus-1 contrapunctus-1 changed the title Error in Geiser REPLs Error in REPLs Jul 14, 2024
@justinbarclay
Copy link
Owner

justinbarclay commented Jul 16, 2024

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.

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