nim-lang / nim-mode

An emacs major mode for the Nim programming language
137 stars 46 forks source link

Paredit doesn't work with nim-mode #254

Open antonsakhanovych opened 8 months ago

antonsakhanovych commented 8 months ago

And describe your problem:

I use paredit and I am used to keybindings that manipulate s-exp. When I enter nim-mode, however, I try to delete line with C-k and it doesn't work i get message I copied below. In the same way C-) doesn't work. Turning off the paredit helps and the error doesn't pop up.

Another big issue is that if I try to ignore the issue after some time emacs FREEZES. When I try to ignore the problem and continue on working sometimes C-k starts to work but it doesn't delete the whole line. It deletes line except the last character.

  1. Opensuse Tumbleweed
  2. Emacs version: GNU Emacs 29.1 (build 2,. x86_64-suse-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0)
  3. Latest version of nim-mode
  4. I have read the README
  5. Message buffer: wrong-type-argument number-or-marker-p nil With (debug-on-error t) when I press C-k:
    Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
    #<subr nim-mode-forward-token>()
    smie-next-sexp(#<subr nim-mode-forward-token> #<subr forward-sexp> #<subr cadr> #<subr car> halfsexp)
    smie-forward-sexp(halfsexp)
    smie-forward-sexp-command(1)
    forward-sexp()
    paredit-forward-sexps-to-kill(37 55)
    paredit-kill-sexps-on-line()
    paredit-kill(nil)
    funcall-interactively(paredit-kill nil)
    command-execute(paredit-kill)

    when I press C-)

    Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
    #<subr nim-mode-forward-token>()
    smie-next-sexp(#<subr nim-mode-forward-token> #<subr forward-sexp> #<subr cadr> #<subr car> halfsexp)
    smie-forward-sexp(halfsexp)
    smie-forward-sexp-command(1)
    forward-sexp(1)
    up-list()
    paredit-forward-slurp-into-list(nil)
    paredit-forward-slurp-sexp(nil)
    funcall-interactively(paredit-forward-slurp-sexp nil)
    command-execute(paredit-forward-slurp-sexp)

C-h k C-k:

C-k runs the command kill-visual-line (found in visual-line-mode-map),
which is an interactive native-compiled Lisp function in ‘simple.el’.

It is bound to C-k, <kp-f4> and <deleteline>.

(kill-visual-line &optional ARG)

Kill the rest of the visual line.
With prefix argument ARG, kill that many visual lines from point.
If ARG is negative, kill visual lines backward.
If ARG is zero, kill the text before point on the current visual
line.

If the variable ‘kill-whole-line’ is non-nil, and this command is
invoked at start of a line that ends in a newline, kill the newline
as well.

If you want to append the killed line to the last killed text,
use C-M-w before C-k.

If the buffer is read-only, Emacs will beep and refrain from deleting
the line, but put the line in the kill ring anyway.  This means that
you can use this command to copy text from a read-only buffer.
(If the variable ‘kill-read-only-ok’ is non-nil, then this won’t
even beep.)
  1. I don't use nimsuggest
  2. I don't have flycheck
  3. My config with which error occurs can be found here Config
  4. init.el and config.org is located at .config/emacs/