aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2018-01-07 15:20:49 +0000
committerWilfred Hughes <me@wilfred.me.uk>2018-01-07 15:20:49 +0000
commit7970efb1dbd1f4e71064e981a42c6bf7503a167e (patch)
treee612e6b85ebd97675082082712ea73e453f23d9d
parentd668714a84166609bedd92f061b8e913cde902ac (diff)
Fix buffer cleanup
The refactoring in 53dd618 checked that 'created' was t before we actually set 'created'.
-rw-r--r--helpful.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/helpful.el b/helpful.el
index cb3476f..0dc2b09 100644
--- a/helpful.el
+++ b/helpful.el
@@ -90,11 +90,11 @@ To disable cleanup entirely, set this variable to nil. See also
(buf-name (format "*helpful %s: %s*"
(helpful--kind-name symbol callable-p)
symbol))
- (buf (get-buffer buf-name))
- (created nil))
+ (buf (get-buffer buf-name)))
(unless buf
- ;; If we have too many buffers, kill the least recently used.
- (when (and created (numberp helpful-max-buffers))
+ ;; If we need to create the buffer, ensure we don't exceed
+ ;; `helpful-max-buffers' by killing the least recently used.
+ (when (numberp helpful-max-buffers)
(let* ((buffers (buffer-list))
(helpful-bufs (--filter (with-current-buffer it
(eq major-mode 'helpful-mode))
@@ -106,8 +106,7 @@ To disable cleanup entirely, set this variable to nil. See also
;; before we create a new one.
(-each excess-buffers #'kill-buffer)))
- (setq buf (get-buffer-create buf-name))
- (setq created t))
+ (setq buf (get-buffer-create buf-name)))
;; Initialise the buffer with the symbol and associated data.
(with-current-buffer buf