Emacs 行编号性能

Bar*_*lly 6 emacs performance line-numbers

我已经尝试linum过并且nlinum. 两者对于超过 100k 行的文件的性能都很糟糕。

$ for x in {1.100000}; do echo $x; done > 100k.txt
$ emacs -q 100k.txt
M-x load-library linum
M-x linum-mode
M-> ;; it's not too bad to go to end of file
M-< ;; now this completely locks up emacs
Run Code Online (Sandbox Code Playgroud)

与编辑器相同的操作joe是瞬时的。

除了关闭大文件的行号(正是您想要使用行号导航的文件类型 - 我想在串联的 Javascript 文件中查找错误行)之外,还有其他解决方案吗?

或者只是使用不同的编辑器?

jua*_*eon 5

我认为您发现了一个错误,您可以报告(report-emacs-bug)它。根据泰勒的评论,它可能已经解决了。

同时可能对您有帮助的事情...... line-number-modegoto-line以及narrow-to-region这个廉价的-number-my-lines-in-a-tmp-buffer技巧:

(shell-command-on-region (point-min) (point-max)
    (concat "grep -n ^ " buffer-file-name)
    (get-buffer-create "*tmp-linum*") nil t)
Run Code Online (Sandbox Code Playgroud)