Bug
In this code:
|
(let* ((ovl (make-overlay (match-beginning 0) (match-end 0))) |
|
(marker-string "*hideshowvis*") |
|
(doit |
|
(if hideshowvis-ignore-same-line |
|
(let (begin-line) |
|
(setq begin-line |
|
(save-excursion |
|
(goto-char (match-beginning 0)) |
|
(line-number-at-pos (point)))) |
|
(save-excursion |
|
(goto-char (match-beginning 0)) |
|
(ignore-errors |
|
(progn |
|
(funcall hs-forward-sexp-func 1) |
|
(> (line-number-at-pos (point)) begin-line))))) |
|
t))) |
We see that an overlay is created on line 143. On lines 146-158, if hideshowvis-ignore-same-line is t then we might not actually use the overlay just created, by setting doit to false.
When we don't use the overlay, we also don't later on set the property hideshowvis-hs on the overlay, which is done on line 168 within the when doit block.
This causes the code to sometimes create overlays without putting the hideshowvis-hs property on them.
When recomputing the overlays, the first step is to remove all the old overlays, on this line:
|
(remove-overlays (point-min) (point-max) 'hideshowvis-hs t) |
However, it only removes the overlays with the hideshowvis-hs property. The overlays for which doit was not true will never get deleted, and this causes the number of overlays to balloon, leading to major slowdowns in the buffer.
Testing
- Open a buffer with hideshowvis enabled and type
M-: (length (overlay-lists)). You will see how many overlays there are.
M-x revert-buffer to reload the buffer. This will recompute the hideshowvis.
- Again
M-: (length (overlay-lists)). You will see that there are many more overlays now.
If you do this test with hideshowvis-ignore-same-line set to t then it will not balloon the number of overlays because they will all get marked with the hideshowvis-hs property.
Solution
Very simple: In the case of doit false, don't make an overlay in the first place!
Bug
In this code:
hideshowvis/hideshowvis.el
Lines 143 to 158 in e48500e
We see that an overlay is created on line 143. On lines 146-158, if
hideshowvis-ignore-same-lineistthen we might not actually use the overlay just created, by settingdoitto false.When we don't use the overlay, we also don't later on set the property
hideshowvis-hson the overlay, which is done on line 168 within thewhen doitblock.This causes the code to sometimes create overlays without putting the
hideshowvis-hsproperty on them.When recomputing the overlays, the first step is to remove all the old overlays, on this line:
hideshowvis/hideshowvis.el
Line 141 in e48500e
However, it only removes the overlays with the
hideshowvis-hsproperty. The overlays for whichdoitwas not true will never get deleted, and this causes the number of overlays to balloon, leading to major slowdowns in the buffer.Testing
M-: (length (overlay-lists)). You will see how many overlays there are.M-x revert-bufferto reload the buffer. This will recompute the hideshowvis.M-: (length (overlay-lists)). You will see that there are many more overlays now.If you do this test with
hideshowvis-ignore-same-lineset totthen it will not balloon the number of overlays because they will all get marked with thehideshowvis-hsproperty.Solution
Very simple: In the case of doit false, don't make an overlay in the first place!