helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit 7970efb1dbd1f4e71064e981a42c6bf7503a167e
parent d668714a84166609bedd92f061b8e913cde902ac
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sun,  7 Jan 2018 15:20:49 +0000

Fix buffer cleanup

The refactoring in 53dd618 checked that 'created' was t before we
actually set 'created'.

Diffstat:
Mhelpful.el | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git 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