I'm trying to write some buffer switching function (which in itself may be a fool's errand, but I digress...) - and it looks a little like this
(defun swk--quit-buffer (original-buffer) (switch-to-buffer (original-buffer)) (kill-buffer "*tmp*") (local-unset-key "q")) (defun swk-switcheroo () (interactive) (let ((temp-buf-name "*tmp*") (current-buffer-name (buffer-name))) (get-buffer-create temp-buf-name) (switch-to-buffer temp-buf-name) (local-set-key "q" (lambda () (interactive) (swk--quit-buffer current-buffer-name)))))
My aim is to be able to temporarily bind "q" to this window, to simulate special-mode's "quittable" buffer. Sure enough, the "q" key works once, but I get the message:
Symbol's value as variable is void current-buffer-name
Ideally, I want to replace the current buffer with the result of invoking swk-switcheroo - and then reinstate the original buffer when the user presses "q".