我已经在Emacs (版本26.2)中安装了软件包sml-模式(Version6.9),但是当我试图打开一个.sml文件时,在小型缓冲区中会出现以下错误:File mode specification error: (invalid-read-syntax ?)。因此,编辑器没有识别SML语法,这也清楚地表明,当前模式显示的是Fundamental模式而不是SML模式。
以下是我建立环境的步骤:
usr/local/sml中安装了smlnj。sml-mode包(M列表包)。然而,这并没有奏效。sml-mode-6.9.el中下载了https://elpa.gnu.org/packages/sml-mode.html的内容,并在Emacs上安装了它( my包-安装-文件)。sml-mode包旁边的包,但显然无法工作。使用M切换-调试-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)发布于 2019-09-13 14:58:10
错误消息显示文件中的位置9890有错误。就在lambda的角色旁边:
'(("fn" . ?λ)由于这是文件中的第一个非ASCII字符,所以我想该文件是用乱码编码或其他什么方式下载的。不知道为什么M-x list-packages不适合您--我想您可以通过手工编辑文件来解决这个问题。与这个版本是关于Github的相比,可以看到哪些字符应该出现在那里。
发布于 2019-09-12 12:56:47
也许M-x package-list-packages确实成功地安装了sml-mode,但后来没有加载。
您能验证目录~/.emacs.d/elpa/sml-mode-6.9是否存在吗?
我对sml-mode的唯一配置是包安装程序添加了什么:
(require 'package)
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(package-initialize)
...
(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
(quote
(... sml-mode ...))))这应该会到达文件~/.emacs.d/elpa/sml-mode-6.9/sml-mode-autoloads.el,在打开正确类型的文件时使sml-mode加载。
也许,您还能验证sml-mode在您的.emacs文件中类似地提到过吗?
我成功地使用了Emacs 25和sml-mode-6.7,除了你所做的,什么也没有做。如果我升级到sml-mode-6.9,这个设置仍然可以工作。不幸的是,我无法测试它是否也适用于Emacs 26。不幸的是,我不能说如果在25和26之间有任何的包经理的差异,可以在这里发挥。
https://stackoverflow.com/questions/57906918
复制相似问题