打开文件时打开没有暂存缓冲区的emacs

Nic*_*ick 6 emacs

我在Emacs中更改了一个设置.现在,每当我尝试从命令行打开文件时,它都会*scratch*在文件顶部打开一个缓冲区.有没有办法摆脱这个?或者重置我的emacs启动设置的方法?

Rob*_*loi 6

M-x customize-group
initialization
Run Code Online (Sandbox Code Playgroud)

然后,在初始缓冲区选择上,您可以选择:

  • 启动画面
  • 目录
  • 文件
  • 暂存缓冲区

最后,单击保存以备将来使用

您也可以打开/关闭它。看看这是否有帮助。

(您可能想做的另一件事是在启动时只打开一个缓冲区。我记不得这是如何完成的。如果我发现了,我会发布更新)。


Tre*_*son 3

您可以.emacs使用 重新加载文件M-x load-file ~/.emacs。还有其他方法可以做到这一点,请查看问题如何在不重新启动 Emacs 的情况下将更改加载到我的 .emacs?

如果您认为文件有问题.emacs,请尝试使用以下-q选项打开:

emacs -q somefile
Run Code Online (Sandbox Code Playgroud)

如果按预期工作,您的 .emacs 中可能有错误,调试 .emacs 的一个好方法是使用以下选项--debug-init

emacs --debug-init
Run Code Online (Sandbox Code Playgroud)

这将告诉 Emacs 提供加载 .emacs 时遇到的任何错误的堆栈跟踪,例如:

Debugger entered--Lisp error: (wrong-type-argument symbolp (car n))
 (setq (car n) 3)
 (let ((n ...)) (setq (car n) 3)) 
 eval-buffer(#<buffer  *load*<2>> nil "/home/tjackson/.emacs.tjackson.el" nil t)  ; Reading at buffer position 161460
 load-with-code-conversion("/home/tjackson/.emacs.tjackson.el" "/home/tjackson/.emacs.tjackson.el" nil nil)
 load("/home/tjackson/.emacs.tjackson.el")
 (let ((debug-on-error t)) (load user-init-file))
 (if init-file-debug (let (...) (load user-init-file)) (error (format "Problems while loading the file %s: %s" user-init-file ...)))
 (condition-case err (load user-init-file) (error (if init-file-debug ... ...)))
 (if (file-exists-p user-init-file) (condition-case err (load user-init-file) (error ...)))
 eval-buffer(#<buffer  *load*> nil "/home/tjackson/.emacs" nil t)  ; Reading at buffer position 12150
 load-with-code-conversion("/home/tjackson/.emacs" "/home/tjackson/.emacs" t t)
 load("~/.emacs" t t)
 #[nil "....."]
 command-line()
 normal-top-level()
Run Code Online (Sandbox Code Playgroud)

这通常可以向您指出可能存在问题的地方。在我上面的例子中,我使用setq不当,它看起来像是在一个let语句中,而该语句在文件中/home/tjackson/.emacs.tjackson.el。在该文件中快速搜索使我找到了错误,并且我可以修复它。