diff options
| author | Wilfred Hughes <me@wilfred.me.uk> | 2018-01-07 15:20:49 +0000 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2018-01-07 15:20:49 +0000 |
| commit | 7970efb1dbd1f4e71064e981a42c6bf7503a167e (patch) | |
| tree | e612e6b85ebd97675082082712ea73e453f23d9d | |
| parent | d668714a84166609bedd92f061b8e913cde902ac (diff) | |
Fix buffer cleanup
The refactoring in 53dd618 checked that 'created' was t before we
actually set 'created'.
| -rw-r--r-- | helpful.el | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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 |
