greghendershott / racket-mode

Emacs major and minor modes for Racket: edit, REPL, check-syntax, debug, profile, and more.

Home Page:https://www.racket-mode.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when editing a file in `#lang s-exp handin-server/checker`

samth opened this issue · comments

I think the problem is the combination of #lang-mode head and #lang s-exp. The stack trace is:


Showing all blocks ... done
{racket-back-end-/-stderr} symbol->string: contract violation
  expected: symbol?
  given: #<syntax:#(struct:lines-of-text                                 ((listof posn?) ((submission-eval) `(visible ,lop)))))) 11652 28077 255 529 10 #(struct:lines-of-text               (when (somewhere (lambda (x) (member x ops)) fn) 4338 11652 127 255 8 #(s...
  context...:
{racket-back-end-/-stderr} /home/samth/sw/racket-mode/racket/hash-lang.rkt:712:2: fallback
   /home/samth/sw/racket-mode/racket/hash-lang.rkt:693:0: read-lang-info*
   /home/samth/sw/racket-mode/racket/hash-lang.rkt:216:5
((alist-get 'racket-mode package-alist))
((emacs-version "29.1")
 (system-type gnu/linux)
 (x-gtk-use-system-tooltips t)
 (major-mode help-mode)
 (racket--el-source-dir "/home/samth/sw/racket-mode/")
 (racket--rkt-source-dir "/home/samth/sw/racket-mode/racket/")
 (racket-program "~/bin/racket")
 (racket-command-timeout 10)
 (racket-path-from-emacs-to-racket-function identity)
 (racket-path-from-racket-to-emacs-function identity)
 (racket-browse-url-function racket-browse-url-using-temporary-file)
 (racket-documentation-search-location "https://docs.racket-lang.org/search/index.html?q=%s")
 (racket-xp-after-change-refresh-delay 1)
 (racket-xp-mode-lighter
  (:eval
   (racket--xp-mode-lighter)))
 (racket-xp-highlight-unused-regexp "^[^_]")
 (racket-repl-buffer-name-function nil)
 (racket-submodules-to-run
  ((test)
   (main)))
 (racket-memory-limit 2048)
 (racket-error-context medium)
 (racket-repl-history-directory "~/.emacs.d/racket-mode/")
 (racket-history-filter-regexp "\\`\\s *\\'")
 (racket-images-inline t)
 (racket-imagemagick-props nil)
 (racket-images-keep-last 100)
 (racket-images-system-viewer "display")
 (racket-pretty-print t)
 (racket-use-repl-submit-predicate nil)
 (racket-pretty-print t)
 (racket-indent-curly-as-sequence t)
 (racket-indent-sequence-depth 0)
 (racket-pretty-lambda nil)
 (racket-smart-open-bracket-enable nil)
 (racket-module-forms "\\s(\\(?:module[*+]?\\|library\\)")
 (racket-logger-config
  ((racket-mode . debug)
   (cm-accomplice . warning)
   (GC . info)
   (module-prefetch . warning)
   (optimizer . info)
   (racket/contract . error)
   (racket-mode-debugger . info)
   (sequence-specialization . info)
   (* . fatal)))
 (racket-show-functions
  (racket-show-pseudo-tooltip)))
(enabled-minor-modes
 (auto-composition-mode)
 (auto-compression-mode)
 (auto-encryption-mode)
 (auto-fill-mode)
 (auto-save-mode)
 (blink-cursor-mode)
 (buffer-read-only)
 (electric-indent-mode)
 (file-name-shadow-mode)
 (font-lock-mode)
 (global-eldoc-mode)
 (global-font-lock-mode)
 (global-paren-face-mode)
 (indent-tabs-mode)
 (isearch-fold-quotes-mode)
 (line-number-mode)
 (menu-bar-mode)
 (mouse-wheel-mode)
 (override-global-mode)
 (semantic-minor-modes-format)
 (shell-dirtrack-mode)
 (show-paren-mode)
 (tooltip-mode)
 (transient-mark-mode))
(disabled-minor-modes
 (abbrev-mode)
 (auto-fill-function)
 (auto-save-visited-mode)
 (buffer-face-mode)
 (button-mode)
 (cl-old-struct-compat-mode)
 (column-number-mode)
 (comint-fontify-input-mode)
 (compilation-minor-mode)
 (compilation-shell-minor-mode)
 (completion-in-region-mode)
 (context-menu-mode)
 (cursor-face-highlight-mode)
 (defining-kbd-macro)
 (diff-auto-refine-mode)
 (diff-minor-mode)
 (eldoc-mode)
 (electric-layout-mode)
 (electric-quote-mode)
 (global-prettify-symbols-mode)
 (global-semantic-highlight-edits-mode)
 (global-semantic-highlight-func-mode)
 (global-semantic-show-parser-state-mode)
 (global-semantic-show-unmatched-syntax-mode)
 (global-semantic-stickyfunc-mode)
 (global-visual-line-mode)
 (horizontal-scroll-bar-mode)
 (hs-minor-mode)
 (isearch-mode)
 (jit-lock-debug-mode)
 (lock-file-mode)
 (lost-selection-mode)
 (next-error-follow-minor-mode)
 (overwrite-mode)
 (paragraph-indent-minor-mode)
 (paren-face-mode)
 (prettify-symbols-mode)
 (racket-hash-lang-repl-mode)
 (racket-smart-open-bracket-mode)
 (racket-xp-mode)
 (read-extended-command-mode)
 (semantic-highlight-edits-mode)
 (semantic-highlight-func-mode)
 (semantic-mode)
 (semantic-show-parser-state-mode)
 (semantic-show-unmatched-syntax-mode)
 (semantic-stickyfunc-mode)
 (sh-electric-here-document-mode)
 (shell-highlight-undef-mode)
 (size-indication-mode)
 (tab-bar-history-mode)
 (tab-bar-mode)
 (temp-buffer-resize-mode)
 (text-scale-mode)
 (tool-bar-mode)
 (treesit-explore-mode)
 (treesit-inspect-mode)
 (undelete-frame-mode)
 (url-handler-mode)
 (use-hard-newlines)
 (vc-dir-git-mode)
 (view-mode)
 (visible-mode)
 (visual-line-mode)
 (window-divider-mode)
 (xref-etags-mode))

I tried to test this out with just #lang s-exp racket/base but racket-mode seems to hang when I type the e in base there (it times out with this: racket--cmd/await: Command (hash-lang indent-amount 3 25 25) from #<buffer x.rkt> to "racket-back-end-/" timed out after 10 seconds)

Thanks, starting to investigate.

It looks like the info proc for s-exp, when given the 'module-language-key, is returning that syntax value, as opposed to a symbol or #f like I'm expecting. That causes the exception.

Thereafter, the hash-lang object is borked, so that when you edited the line to #lang s-exp racket/base and pressed RET, the indent-line thing was borked too (thus the freeze). (At that point, you would need to toggle the buffer out of racket-hash-lang-mode and back, to reset the hash-lang object. Or kill the buffer.)

The fix might be as simple as handling info procs like this returning syntax by doing syntax->datum on them. But I'll think it over.