commit 496e0de35ec616ddd21ced3cfea94d9f34b1e662 parent 5479fd763be78cb4a006b7599188c04c4cd84faf Author: Tomas Hlavaty <tom@logand.com> Date: Sun, 3 Oct 2021 21:56:26 +0200 simplify btap--memoize-thunk Diffstat:
M | emacs-btap.el | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/emacs-btap.el b/emacs-btap.el @@ -133,14 +133,13 @@ handles the btap action." (defun btap-try-missing () (signal 'btap-try-missing (list "Nothing at point to browse"))) -(let ((void (list nil))) - (defun btap--memoize-thunk (thunk) - (let ((z void)) - (lambda () - (when (eq z void) - (setq z (funcall thunk) - thunk nil)) - z)))) +(defun btap--memoize-thunk (thunk) + (let (z) + (lambda () + (when thunk + (setq z (funcall thunk) + thunk nil)) + z))) (defun btap () "Browse thing at point. See also the variable `btap-try-functions'."