如何修复"源文件比字节编译文件更新"错误?

Dod*_*gie 5 emacs elisp

我收到了错误

源文件`〜/ .emacs.d/elpa/cmake-mode-20110824/cmake-mode.el'比字节编译的文件更新

当我尝试在cmake模式下打开CMakeLists.txt文件时.

我的.emacs包含(部分)以下内容:

(setq load-path (cons 
             (expand-file-name "~/.emacs.d/elpa/cmake-mode-20110824") 
             load-path))
(require 'cmake-mode)
(setq auto-mode-alist
      (append '(("CMakeLists\\.txt\\'" . cmake-mode)
            ("\\.cmake\\'" . cmake-mode))
              auto-mode-alist))
Run Code Online (Sandbox Code Playgroud)

回溯:

Debugger entered--Lisp error: (wrong-type-argument char-table-p nil)
  char-table-parent(nil)
  cmake-mode()
  set-auto-mode-0(cmake-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer CMakeLists.txt> "~/CMakeLists.txt" nil nil   "~/CMakeLists.txt" (19923691 2049))
  find-file-noselect("~/CMakeLists.txt" nil nil t)
  find-file("~/CMakeLists.txt" t)
  call-interactively(find-file nil nil)
Run Code Online (Sandbox Code Playgroud)

我很困惑为什么会发生这种错误.免责声明:我是emacs和elisp noob.

abo*_*abo 3

问题可能出在你的内部cmake-mode,它已经过时了。修复方法如下:

  1. 删除上面的所有设置
  2. 确保您有emacs24
  3. 在你的~/.emacs

    (package-initialize)
    (add-to-list 'package-archives
      '("melpa" . "http://melpa.milkbox.net/packages/"))
    
    Run Code Online (Sandbox Code Playgroud)
  4. M-x package-list-packages。查找cmake-modeC-s. 标记安装并i使用 进行安装x