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

Prevent using interactive command line-move-visual if possible? #189

Open
4 of 5 tasks
kaushalmodi opened this issue Nov 17, 2017 · 1 comment
Open
4 of 5 tasks
Labels

Comments

@kaushalmodi
Copy link

Conforming Bugs

Please tell us below:

  • basic information
    • OS name: RHEL 6.6
    • Versions: Emacs (latest emacs-26 branch build as of today), Nim compiler (Nim Compiler Version 0.17.3 (2017-11-15), git hash: 39c304f8822b350472d584f72ca8f220bde20f7f), and nimsuggest (same as nim).
  • Are you using latest version of nim-mode? Yes
  • Are there message related to nim-mode in *Messages* buffer? N/A
  • Did you read README.md? Yes
  • Is your problem related to nimsuggest-mode? (company-mode, flycheck, or el-doc) No

And describe your problem:

Use of visual-line-move in nim-mode exposed an emacs bug and causes crashes when doing org-comment-dwim in a nim SRC_BLOCK in an Org file (debbugs # 29326).

The Lisp backtrace explains the interaction between org-mode and nim-mode:

Lisp Backtrace:
"line-number-display-width" (0xffff37e0)
"line-move-visual" (0xffff4030)
"line-move" (0xffff4780)
"let" (0xffff4b80)
"condition-case" (0xffff4e70)
"nim-line-move" (0xffff5030)
"not" (0xffff5300)
"if" (0xffff54a0)
"progn" (0xffff5640)
"if" (0xffff57e0)
"save-excursion" (0xffff59c0)
"catch" (0xffff5be0)
"nim-line-empty-p" (0xffff5da0)
"or" (0xffff60c0)
"if" (0xffff6260)
"let" (0xffff64f0)
"save-excursion" (0xffff66d0)
"nim-get-empty-line-indent" (0xffff6890)
"cons" (0xffff6b50)
"list" (0xffff6ce0)
"setq" (0xffff6ed0)
"nim-smie-indent-calculate" (0xffff7090)
"and" (0xffff73a0)
"let*" (0xffff7590)
"nim-indent-calculate-indentation" (0xffff7750)
"and" (0xffff7a70)
"let*" (0xffff7c60)
"save-excursion" (0xffff7e40)
"let" (0xffff80d0)
"nim--indent-line-core" (0xffff8290)
"nim-indent-line" (0xffff8650)
"indent-according-to-mode" (0xffff8da0)
"comment-dwim" (0xffff9640)
"funcall-interactively" (0xffff9638)
"call-interactively" (0xffff9af8)
"org-comment-dwim" (0xffffa360)
"funcall-interactively" (0xffffa358)
"call-interactively" (0xffffa840)
"command-execute" (0xffffb028)

While the emacs bug was clearly present (and later fixed in emacs-26/90add182), Eli had these comments:

The trigger was the call to line-move-visual in nim-mode. So you need
to do something that causes that function to be called by nim-mode,
when Org does the indent thing. I think this doesn't happen
frequently because most modes used in source snippets in Org buffers
don't call line-move-visual (why would they? that function is for
interactively moving cursor vertically).

@yuutayamada
Copy link
Contributor

Thank you for conforming the bug. I'm assuming line-move function calls the line-move-visual function in nim-mode and I think it could be changed line-move-1 instead. I'll check when I have time. (indent stuff is kinda vulnerable part in nim-mode and may take some time to fix indentation test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants