我使用连接到 FreeBSD 计算机ssh [ip] -X
,并且 emacs 启动得很好,但是发生这种情况并且所有图标都是带有红色 X 的小纸片:
> emacs
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'document-new' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'document-open' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'window-close' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'document-save' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'edit-undo' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'edit-cut' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'edit-copy' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'edit-paste' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
(emacs:22812): GdkPixbuf-WARNING **: Bug! loader 'png' didn't set an error on failure
(emacs:22812): Gtk-WARNING **: Error loading theme icon 'edit-find' for stock: Internal error: Image loader module 'png' failed to complete an operation, but didn't give a reason for the failure
有谁知道为什么会发生这种情况? GVIM 加载得很好。
答案1
也许运行 Emacs 的机器上的 GTK 配置有问题? Qt 中心论坛上的某人发现,当它与 Qt 小部件工具包链接时,似乎可以为 GdkPixbuf 库中的类似警告提供解决方案 [Qt中心]
这篇文章似乎建议以 root 用户身份在运行 Emacs 的计算机上运行:
update-mime /usr/share/mime/
update-mime-database /usr/share/mime/
gtk-update-icon-cache /usr/share/icons/<ThemeName>
就我个人而言,我想假设这些 shell 命令可以在 Ubuntu 上的软件包安装后脚本期间运行。不过,也许这已经是一个功能了。有一个手册页在 Ubuntu 上可用于gtk-update-icon-cache
shell 命令。
或者,是否可以在没有 GTK 的情况下构建 Emacs? Debian维护指南提供有关 从源代码构建 Debian 软件包的debian/rules
文件和 Debian命令的文档。 debuild
Debian 类型发行版上的源包可以通过apt-get
[检索搭建教程] 在 Emacs Wiki 上,还有关于从源代码构建 Emacs 的文档 [构建Emacs]
答案2
我的猜测是您的 FreeBSD 系统上没有安装这些图标的 PNG 文件。具体来说,我的 FreeBSD 10 系统(可以与 ssh -X 配合使用)有:
/usr/local/share/icons/gnome/24x24/actions/document-new.png
/usr/local/share/icons/gnome/24x24/actions/document-open.png
/usr/local/share/icons/gnome/24x24/actions/document-save.png
/usr/local/share/icons/gnome/24x24/actions/edit-copy.png
/usr/local/share/icons/gnome/24x24/actions/edit-cut.png
/usr/local/share/icons/gnome/24x24/actions/edit-find.png
/usr/local/share/icons/gnome/24x24/actions/edit-paste.png
/usr/local/share/icons/gnome/24x24/actions/edit-undo.png
/usr/local/share/icons/gnome/24x24/actions/window-close.png
/usr/local/share/icons/gnome/24x24/apps/system-file-manager.png
初始路径可能不同,所以我会locate
在基本名称上执行 a,例如locate edit-find.png
。
另外,truss -o /tmp/truss.out emacs
一旦你陷入其中,就立即退出。然后运行:
grep 'png"' /tmp/truss.out
它应该告诉你是否找到了 png。如果没有,这些文件属于 gnome-icon-theme-3.6.2,因此安装该文件时可能会调整版本号。