Skip to content

Commit 07a8027

Browse files
authored
Do not add lines to kill-ring when trimming the gnuplot buffer (#72)
I noticed that when the number of lines in the gnuplot comint buffer exceeds the maximum amount of lines, the extra lines are killed using kill-line, which causes the kill-ring to be polluted with those lines. This commit replaces kill-ring by delete-region, which does not have this side effect. The while loop also has been replaced by dotimes for clarity.
1 parent 116cad8 commit 07a8027

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

gnuplot.el

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,13 +1357,12 @@ This keeps that buffer from growing excessively in size. Normally,
13571357
this function is attached to `gnuplot-after-plot-hook'"
13581358
(if (> gnuplot-buffer-max-size 0)
13591359
(with-current-buffer gnuplot-buffer
1360-
(let ((nlines (count-lines (point-min) (point-max)))
1361-
(kill-whole-line t))
1362-
(while (> nlines gnuplot-buffer-max-size)
1360+
(let (gnuplot-lines (count-lines (point-min) (point-max)))
1361+
(dotimes (tmp (- gnuplot-lines gnuplot-buffer-max-size))
13631362
(goto-char (point-min))
1364-
(kill-line)
1365-
(setq nlines (1- nlines)))
1363+
(delete-region (line-beginning-position) (1+ (line-end-position))))
13661364
(goto-char (point-max))))))
1365+
13671366
(add-hook 'gnuplot-after-plot-hook 'gnuplot-trim-gnuplot-buffer nil nil)
13681367

13691368

0 commit comments

Comments
 (0)