Toh*_*iko 5 emacs performance show-hide
我使用hide-show来折叠文本的某些部分,并使用下面的代码显示隐藏线的数量.
但是,当文件足够大(例如C++或LaTeX)并且我崩溃所有区域(从而创建了数十个叠加层)时,Emacs变得非常缓慢到无法使用的程度.即使将标记从一行移动到另一行也需要半秒钟左右.
有没有办法解决这个问题?
(defun display-code-line-counts (ov)
(overlay-put ov 'display
(format "...%d..."
(count-lines (overlay-start ov)
(overlay-end ov))
))
(overlay-put ov 'face '(:foreground "red" :box (:line-width 1 :style none)))
)
(setq hs-set-up-overlay 'display-code-line-counts)
Run Code Online (Sandbox Code Playgroud)
编辑:原因是emacs变得非常慢是因为linum minor模式创建了数千个(隐藏)叠加层,这些叠加层与hide-show一起折叠.有没有办法来解决这个问题?还是更好的行号模式?