Closed melton1968 closed 9 years ago
Yes, you are correct. It absolutely should allow you to evaluate (a)
.
I may have broken something recently. Let me try to reproduce that and I'll get back to you.
FYI: I am using emacs 24.4.1 and names-20150115.1 from MELPA.
Thanks that helped. Indeed I broke this feature on Emacs 24.4 (I didn't notice cause there aren't any tests for the -dev
stuff yet).
I'll fix it asap.
Ok, should be fixed in version 20150125 Let me know if it works.
Interactive evaluation now works as expected within the namespace. Thanks for the quick turn-around.
I have a related question -- if I close and then re-open the namespace, interactive evaluation works as expected, but the unqualified symbol is not found in the re-opened namespace when using commands like eval-buffer
or load-file
. E.g.,
(require 'names-dev)
;; open the namespace foo
(define-namespace foo-
(defun a ()
(message "defun a called"))
(foo-a) ;; defun a called
(a) ;; defun a called
)
;; reopen the namespace foo
(define-namespace foo-
(foo-a) ;; defun a called
(a) ;; Symbol's function definiton is void: a
)
Is this the intended behavior? I'd like to be able to use the same namespace over multiple files. Is there some other methodology I should be using?
Yes, just add the :global keyword after foo-.
By default Names only looks up symbol names locally (inside the macro). This keyword tells it you want to access symbols defined outside the macro as well.
This should allow you to have multifile namespaces. I haven't developed a multifile package using Names yet, so please let me know of any workflow obstacles you encounter so I can fix them!
I assumed that
names-eval-last-sexp
would allow you to interactively evaluate an expression within a namespace without prefixing the namespace name. However, in the example below, I cannot seem to get it to work. I would expect to be able to interactively evaluate the expression(a)
within the namespace usingnames-eval-last-sexp
. Am I doing something wrong?