I have the following code in the file1.el:
(with-current-buffer (get-buffer-create "TestBuffer") (read-only-mode -1) (erase-buffer) (make-local-variable 'source) (setq source (get-source-language)) (my-package-insert text))
In the file2.el:
(with-current-buffer "TestBuffer" (message "Source: %s" (buffer-local-value 'source (get-buffer "TestBuffer"))))
First executes the code from file1.el and then from file2.el.
I expect that the
source will be retrieved from the buffer "TestBuffer" but I get the error:
Symbol's value as variable is void: source
Why that happens so? How could I retrieve the variable from the buffer? I can declare that variable by means of
defvar but I don't want to hold temporal variable just for such a little need. Is it possible to avoid additional variable declaration?