【问题标题】:Emacs: can't open load file for windows.el, possible char encoding errorEmacs:无法打开 windows.el 的加载文件,可能的字符编码错误
【发布时间】:2014-04-20 08:41:54
【问题描述】:

我正在尝试从这里安装Windows Modehttp://www.emacswiki.org/emacs/WindowsMode,并且在初始化时加载windows.el 文件时遇到问题,其中迷你缓冲区告诉我Cannot open load file: windows。保存文件后,我将其添加到我的初始化文件中:

(add-to-list 'load-path "~/workspace/emacs/.emacs.d/elisp/windows.el")
(require 'windows)
(win:startup-with-window)
(define-key ctl-x-map "C" 'see-you-again)

这是我保存文件的地方:

[lucas@lucas-ThinkPad-W520]~/workspace/emacs/.emacs.d/elisp$ ls -la
total 296
drwxr-xr-x  4 lucas lucas   4096 Apr 20 01:06 .
drwxr-xr-x 14 lucas lucas   4096 Apr 20 01:14 ..
-rw-r--r--  1 lucas lucas  31502 Mar 29 21:40 multi-term.el
-rw-r--r--  1 lucas lucas  35201 Apr 20 01:01 revive.el
drwxr-xr-x  3 lucas lucas   4096 Mar  9 14:57 theme-changer
drwxr-xr-x  3 lucas lucas   4096 Mar 29 01:05 themes
-rw-r--r--  1 lucas lucas 115222 Apr 20 01:06 windows2.el
-rw-r--r--  1 lucas lucas  96830 Apr 20 01:01 windows.el

我怀疑字符编码在windows.el 文件(链接上的完整文件)顶部列为-*- coding: euc-jp -*-。最初保存这个文件给了我一个错误(见下文),提示我指定编码。我尝试将文件保存为euc-jp,然后再次保存为utf-8,但我仍然收到Cannot open load file... 错误。

这是我在尝试保存时收到的消息:

These default coding systems were tried to encode text
in the buffer `windows2.el':
  (japanese-iso-8bit-unix (13580 . 65533) (13581 . 65533) (13582
  . 65533) (13583 . 65533) (13584 . 65533) (13585 . 65533) (13586
  . 65533) (13587 . 65533) (13588 . 65533) (13589 . 65533) (13590
  . 65533))
However, each of them encountered characters it couldn't encode:
  japanese-iso-8bit-unix cannot encode these: � � � � � � � � � � ...

Click on a character (or switch to this window by `C-x o'
and select the characters by RET) to jump to the place it appears,
where `C-u C-x =' will give information about it.

Select one of the safe coding systems listed below,
or cancel the writing with C-g and edit the buffer
   to remove or modify the problematic characters,
or specify any other coding system (and risk losing
   the problematic characters).

  utf-8 gb18030 utf-7 utf-16 utf-16be-with-signature
  utf-16le-with-signature utf-16be utf-16le iso-2022-7bit utf-8-auto
  utf-8-with-signature utf-7-imap utf-8-emacs

假设编码是问题的根源,我如何设置我的 emacs 以兼容这些编码?

【问题讨论】:

  • 作为替代方案,您可以考虑使用 Emacs 24.4(或在不久发布之前的开发快照)。您可以使用 Emacs 桌面来保存和恢复框架和窗口配置。不用台式机也可以做到这一点。

标签: emacs encoding


【解决方案1】:

load-path 是一个目录列表,可在其中查找 elisp 库。

使用这个:

(add-to-list 'load-path (expand-file-name "~/workspace/emacs/.emacs.d/elisp"))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2011-09-14
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    相关资源
    最近更新 更多