emacs - 尽管安装了 sml-mode,但 Emacs 无法识别 SML 语法
问题描述
我已经在 Emacs(版本 26.2)中安装了包sml-mode(版本 6.9),但是当我尝试打开一个 .sml 文件时,我在 minibuffer 中收到以下错误:File mode specification error: (invalid-read-syntax ?)
. 因此,编辑器无法识别 SML 语法,这一点也很明显,因为当前模式显示的Fundamental
模式不是SML
.
这些是我设置环境的步骤:
- 我首先在
usr/local/sml
. - 我尝试安装预设
sml-mode
包(Mx list-packages)。然而这并没有成功。 sml-mode-6.9.el
然后,我在我的机器上从https://elpa.gnu.org/packages/sml-mode.html下载了内容,并将其安装在 Emacs 上(Mx package-install-file)。- Emacs 中的包列表在包旁边显示Installed
sml-mode
,但显然不起作用。
使用 Mx toggle-debug-on-error 提供以下堆栈跟踪:
Debugger entered--Lisp error: (invalid-read-syntax "?")
read(#<buffer *load*>)
eval-buffer(#<buffer *load*> nil "/home/Roberto/.emacs.d/elpa/sml-mode-6.9/sml-mode.el" nil t) ; Reading at buffer position 9890
load-with-code-conversion("/home/Roberto/.emacs.d/elpa/sml-mode-6.9/sml-mode.el" "/home/Roberto/.emacs.d/elpa/sml-mode-6.9/sml-mode.el" nil t)
sml-mode()
set-auto-mode-0(sml-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(t t)
find-file-noselect-1(#<buffer test.sml> "~/test.sml" nil nil "~/test.sml" nil)
find-file-noselect("~/test.sml" nil nil t)
find-file("~/test.sml" t)
funcall-interactively(find-file "~/test.sml" t)
call-interactively(find-file nil nil)
command-execute(find-file)
解决方案
错误消息表明文件中的位置 9890 存在错误。就在 lambda 字符旁边:
'(("fn" . ?λ)
由于这是文件中的第一个非 ASCII 字符,我猜该文件是用乱码编码或其他东西下载的。不知道为什么M-x list-packages
不适合你——我想你可以通过手动编辑文件来解决这个问题。与Github上的这个版本进行比较,看看哪些字符应该出现在那里。
推荐阅读
- c# - 无法在 C++/WinRT Xaml Islands 项目中使用来自 C# WinRT 组件的 Xaml 组件
- javascript - 在 Typescript 中过滤整数数组 - Angular 2
- c# - Xamarin Forms 中的全局资源
- python - 将时间转换为数据时间格式,保持“AM/PM”
- html - CSS Dropcap Bootstrap 5
- python - 在 PySpark 中使用列条件替换空值
- sql - 计算具有相同 id 的列的值的存储过程
- built-in - 如何覆盖 Autodesk 内置查看器扩展
- python - 有没有办法识别列表中的 IP 地址或 MAC 地址?
- embedded - 如何在 PCB 上组装后对 esp32 进行编程