查看大文件时如何提高emacs的性能?

goo*_*nsu 22 emacs

查看大文件时,Emacs有时会挂起.但它很快(global-font-lock-mode -1).

我正在使用Prelude的分支.

Emacs版本:24.3 cocoa系统:OS X 10.8.4

更新:我发现(setq jit-lock-defer-time 0.05)是一种提高滚动速度的方法.

Tre*_*son 31

为了帮助处理大文件,我已经安装了自己的find-file-hook基本模式(避免字体锁定),关闭撤销,并使缓冲区只读以避免任何意外更改(对大文件进行不必要的备份).

(defun my-find-file-check-make-large-file-read-only-hook ()
  "If a file is over a given size, make the buffer read only."
  (when (> (buffer-size) (* 1024 1024))
    (setq buffer-read-only t)
    (buffer-disable-undo)
    (fundamental-mode)))

(add-hook 'find-file-hook 'my-find-file-check-make-large-file-read-only-hook)
Run Code Online (Sandbox Code Playgroud)

显然可以根据需要调整阈值.

  • 只需在检查大小足够后使用`(linum-mode -1)`,如果没有,添加`(font-lock-mode -1)`就可以了. (3认同)
  • 谢谢你。但我也想编辑这个文件。你可以看到我上面对“大”文件的描述。 (2认同)

Ale*_*iev 17

如果您需要处理非常大的文件,可以使用View Large Files包,它允许"以块的形式查看,编辑和搜索大型文件".之后require荷兰国际集团的包打开大文件M-x vlfi.