如何持久隐藏 Emacs 中的工具栏?

Jon*_*nas 27 linux toolbar emacs

我已经在 Linux Mint 8 上安装了 emacs23。我想隐藏工具栏,我可以用Options > Show/Hide > Tool-bar. 但是下次我启动 emacs 时工具栏又回来了。我怎样才能持久地隐藏它?

mic*_*ael 45

将以下内容添加到您的 init 文件(~/.emacs_emacs~/.emacs.d/init.el):

(tool-bar-mode -1)
Run Code Online (Sandbox Code Playgroud)


via*_*Zah 8

Emacs 有一个很好的内置定制界面。

选择Options › Customize Emacs › Specific Option,开始输入tool,然后点击TAB以查看以 开头的选项tool。选择tool-bar-mode即可。切换其值以将其关闭,然后按Save for future sessions

  • Sanoj:如果您不知道任何 lisp,最好的解决方法是创建一个空的 .emacs,然后一次复制一部分旧的 .emacs,并确保 *Messages 中没有出现错误* 在启动时为您重新添加的每个部分缓冲。或者您可以放一个“;” 在行之前将它们注释掉,并按照类似的过程取消对一小部分的注释,并确保重新启动时没有错误。 (4认同)

vin*_*hvs 7

仅供以后参考。

~/.emacs文件,隐藏工具栏、菜单栏和滚动条

;; Disabling things
;;-----------------------------------------------------------------------
(menu-bar-mode -1) 
(toggle-scroll-bar -1) 
(tool-bar-mode -1) 

;;Note: If, after turning any of these off, you want to re-enable them for a single emacs window, you can do so by pressing Meta-x and then typing the command at the M-x prompt. (Copied from Web)
;;Example:
;;M-x tool-bar-mode
;;will turn the toolbar back on. 
;;-----------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

现在,您的 emacs 将如下所示


小智 6

我同意迈克尔的看法。但是如果你只在你的.emacs文件中添加这一行,那么在命令行模式下运行emacs时就会出现错误。因此,更好的解决方案可能是将以下内容添加到您的 .emacs 文件中:

(if window-system
    (tool-bar-mode -1)
)
Run Code Online (Sandbox Code Playgroud)

这样,只有在 GUI 中运行工具栏时才会隐藏工具栏。命令行模式下的 Emacs 似乎没有工具栏。