简体   繁体   English

由于缓冲区“ido.last”,emacs不会关闭

[英]emacs won't close because of buffer “ido.last”

When I try to close emacs I get the message 当我尝试关闭emacs时,我收到了消息

"buffer ido.last modified; kill anyway?" “缓冲ido.last修改;杀死无论如何?”

and whatever I answer, emacs stays open. 无论我回答什么,emacs都会保持开放状态。 But I can't open this buffer and the ido.last file doesn't exist. 但我无法打开此缓冲区并且ido.last文件不存在。 How can I get my emacs closed? 如何关闭我的emacs?

If you've used emacs as another user, as root for instance, it's possible that the .ido.last file is owned by root and hence you aren't allowed to remove or save it. 如果您使用emacs作为另一个用户,例如root,则.ido.last文件可能由root拥有,因此您不能删除或保存它。

When you get the "buffer .ido.last modified"-question just remove the .ido.last file before you answer yes (if you're using emacs within a shell, just Cz, remove file and then resume with %). 当你得到“buffer .ido.last modified”-question时,只需删除.ido.last文件,然后再回答是(如果你在shell中使用emacs,只需要Cz,删除文件,然后用%继续)。 Then the .ido.last file will be written to disk with you as the owner. 然后.ido.last文件将作为所有者写入磁盘。

IDO tries to save a file called ido.last into ~/.emacs.d directory. IDO尝试将名为ido.last的文件保存到~/.emacs.d目录中。 But, in your case IDO seems to be unable to do so. 但是,在你的情况下,IDO似乎无法这样做。 Maybe your ~/.emacs.d directory is read-only for a particular reason, or your disk is full, etc. So IDO raise an error that prevent your emacs to close. 也许您的~/.emacs.d目录由于特定原因是只读的,或者您的磁盘已满,等等。因此IDO会引发一个错误,阻止您的emacs关闭。

If you don't use IDO, try to remove this kind of lines from your .emacs : 如果您不使用IDO,请尝试从.emacs中删除此类行:

(require 'ido)
(ido-mode t)

Like Jérôme Radix said, IDO gives that error when unable to save the ido.last file, and the error prevents emacs from closing. 就像ido.last所说,IDO在无法保存ido.last文件时会出现错误,并且该错误会阻止emacs关闭。

The default location for IDO to save the file is into ~/.emacs.d directory, but this can be overridden by setting the variable ido-save-directory-list-file . IDO保存文件的默认位置是~/.emacs.d目录,但可以通过设置变量ido-save-directory-list-file来覆盖它。 This means you should check the value of this variable (eg, Mx describe-variable ) to see where IDO is trying to save a file, and figure out why it can't save the file. 这意味着您应该检查此变量的值(例如, Mx describe-variable )以查看IDO尝试保存文件的位置,并找出无法保存文件的原因。

Possible reasons include: 可能的原因包括:

  1. The directory or file is read-only. 目录或文件是只读的。
  2. The directory does not exist. 该目录不存在。 IDO will not create the directory for you. IDO不会为您创建目录。
  3. The directory or file is owned by another user. 目录或文件归其他用户所有。
  4. The disk is full. 磁盘已满。

Add this code (eg. to your .emacs.el , init.el , etc.) to fix the issue with ido preventing emacs from exiting when the ido.last file is not writable: 添加此代码(例如,您的.emacs.elinit.el等)以修复ido阻止ido.lastido.last文件不可写时退出的问题:

(defun ido-kill-emacs-hook ()
      (ignore-errors (ido-save-history)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM