names icon indicating copy to clipboard operation
names copied to clipboard

Question about using namespace across multiple files?

Open melton1968 opened this issue 9 years ago • 2 comments

If a namespace is split across multiple files (or even re-opening the namespace in the same file), is there a way to cause function names embedded inside a backquote to be namespace-ed? As an example, is there a way to write bmacro below other than fully specifying the function afunc?

(require 'names-dev)
(require 'names)

;; In file a.el
(define-namespace foo-bar-- :global

(defun afunc ()
  (message "foo-bar--afunc called"))

(afunc)  ; afunc called

(defun cfunc ()
  `(afunc))

(cfunc)
)

(provide 'foo-bar)

;; In file b.el
(define-namespace foo-bar-- :global

(defun bfunc ()
  (afunc))

(defmacro bmacro ()
  `(afunc))

(defmacro cmacro ()
  `(foo-bar--afunc))

(afunc)  ; afunc called
(bfunc)  ; afunc called
(bmacro) ; (void function afunc)
(cmacro) ; afunc called
)

melton1968 avatar Jan 29 '15 15:01 melton1968