Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slime-edit-definition with local-nicknames? #789

Open
mooseyboots opened this issue Sep 1, 2023 · 1 comment
Open

slime-edit-definition with local-nicknames? #789

mooseyboots opened this issue Sep 1, 2023 · 1 comment

Comments

@mooseyboots
Copy link

is there a way for package local-nicknames to be respected during code navigation with slime-edit-definition and friends?

or perhaps a seasoned slimer has a hack for this to work?

no nav makes using nicknames pretty tiresome.

@mmontone
Copy link
Contributor

mmontone commented Sep 2, 2023

Binding *package* for the call to eval in eval-for-emacssolves it for me:

(defun eval-for-emacs (form buffer-package id)
 "Bind *BUFFER-PACKAGE* to BUFFER-PACKAGE and evaluate FORM.
Return the result to the continuation ID.
Errors are trapped and invoke our debugger."
 (let (ok result condition)
   (unwind-protect
        (let ((*buffer-package* (guess-buffer-package buffer-package))
              (*buffer-readtable* (guess-buffer-readtable buffer-package))
              (*pending-continuations* (cons id *pending-continuations*)))
          (check-type *buffer-package* package)
          (check-type *buffer-readtable* readtable)
          ;; APPLY would be cleaner than EVAL. 
          ;; (setq result (apply (car form) (cdr form)))
          (handler-bind ((t (lambda (c) (setf condition c))))
            (setq result (with-slime-interrupts
                           (let ((*package* (find-package *buffer-package*)))
                             (eval form)))))
          (run-hook *pre-reply-hook*)
          (setq ok t))
     (send-to-emacs `(:return ,(current-thread)
                              ,(if ok
                                   `(:ok ,result)
                                   `(:abort ,(prin1-to-string condition)))
                              ,id)))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants