Skip to content

(require 'compile) fixes issue loading the mode #14

@switch-to-gitlab

Description

@switch-to-gitlab

Hello,

I'm not the worlds most proficient emacs user, so you can take this all with that grain of salt, but I struggled with an issue and found a solution so I thought I'd share just in case it helps anyone else.

I tried following the steps in the README but whenever I opened a ReScript file, the package wouldn't load with the following error in the minibuffer: "Symbol's value as variable is void: compilation-error-regexp-alist-alist".

For a minimum reproduction, I stripped my init.el down to just this:

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

;; rescript
(customize-set-variable
  'lsp-rescript-server-command
    '("rescript-language-server" "--stdio"))
(with-eval-after-load 'rescript-mode
  ;; Tell `lsp-mode` about the language server
  (require 'lsp-rescript)
  ;; Enable `lsp-mode` in rescript-mode buffers
  (add-hook 'rescript-mode-hook 'lsp-deferred)
  ;; Enable display of type information in rescript-mode buffers
  (require 'lsp-ui)
  (add-hook 'rescript-mode-hook 'lsp-ui-doc-mode))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   '(lsp-rescript company lsp-ui lsp-mode)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

This reproduced the issue for me with the same void variable error as above.

I searched the error and found this issue on a different project which suggested adding (require 'compile) might help, and so without hardly the vaguest sense of what that line does, I stuck it in the line below my ;; rescript comment, and suddenly the mode started working as expected for me.

Since I don't know what I'm doing I can hardly recommend any specific course of action for this project but at a minimum this troubleshooting measure might merit a note in the README file? Just a suggestion.

Thank you for working on this project. It is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions