The byte compiler just gave me this message
1103:24:Warning: assignment to free variable `orig-win-config
on this bit of code:
;; create window config store and restore functions ;; credit to @lawlist on stackoverflow for this embedded setup (setq mysetup (lambda () ;; store original window configuration (set (make-local-variable 'orig-win-config) (current-window-configuration)) ;; bind q to the window restore function (local-set-key "q" (lambda () (interactive) ;; q is shared by all Help-mode buffers ;; so guard those that did not set up orig-win-config (when (boundp 'orig-win-config) (set-window-configuration orig-win-config)) (kill-buffer (current-buffer))))))
The code runs in a
defmacro that displays a temporary buffer window in Help-mode. The code creates a local function variable
mysetup that can be called in the Help mode hook, to remember the original window configuration so the original configuration can be restored when the temporary help buffer is dispatched with "q".
The byte compiler apparently thinks that the
(make-local-variable 'orig-win-config) statement creates a free variable that should not be assigned to this way.
Is there a way to change my syntax to keep the byte compiler happy, and to create/assign to the variable in a more correct way?
This question seems similar, but is not quite the same because it works with a
(defun argument in the argument list, not a new variable in a
(defmacro. So I don't know what to make of the info in that question.