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

fix errors by slime-export-symbol on slime-tramp environment #451

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

y2q-actionman
Copy link
Contributor

This pull request tries to fix errors by slime-export-symbol on slime-tramp environment.

  • commit e09c504 fixes tramp-error: Not a Tramp file name: ... error.
  • commit d0d9f0c fixes down-list: Scan error: "Unbalanced parentheses", 1, 1 error.

other commits changes some words.

@y2q-actionman
Copy link
Contributor Author

Sorry I am very late for posting a detailed bug report.

This pull request fixes slime-goto-package-source-definition if the implementation does not have a good support for slime-find-package-definition-rpc.

I found it on Allegro CL. In Allegro CL, slime-find-package-definition-rpc seems returns nil.

To reproduce this problem on SBCL, please comment out the slime-find-package-definition-rpc call in slime-goto-package-source-definition, like:

(defun slime-goto-package-source-definition (package)
  "Tries to find the DEFPACKAGE form of `package'. If found,
places the cursor at the start of the DEFPACKAGE form."
  (cl-labels ((try (location)
                   (when (slime-location-p location)
                     (slime-goto-source-location location)
                     t)))
    (or ; (try (slime-find-package-definition-rpc package))   ; comment out this.
        (try (slime-find-package-definition-regexp package))
        (try (let ((package-file (slime-find-possible-package-file
                                  (buffer-file-name))))
               (when package-file
                 (with-current-buffer (find-file-noselect package-file t)
                   (slime-find-package-definition-regexp package)))))
        (error "Couldn't find source definition of package: %s" package))))

slime-tramp settings for reproducing problems

I use these settings about slime-tramp.

(use-package slime
  :config
  (add-to-list 'slime-contribs 'slime-fancy)
  (add-to-list 'slime-contribs 'slime-tramp)
  (add-to-list 'slime-contribs 'slime-xref-browser))

(eval-after-load 'slime-tramp
  '(progn
     (add-to-list 'slime-filename-translations
		  (slime-create-filename-translator
		   :remote-host "home-xubuntu"
		   ;; I got below by evaluating `(cl:machine-instance)' by SBCL in the 'home-xubuntu' host.
		   :machine-instance "y2q-PC-VK17HBBCD"
		   :username "y2q"))))

and use this ssh config:

HOST home-xubuntu
     USER y2q
     HostName 192.168.3.100
     LocalForward 4005 localhost:4005

I placed some files on the 'home-xubuntu' host:

  /ssh:y2q@home-xubuntu:/home/y2q/test/slime-package-test:
  total 24
  -rw-rw-r-- 1 y2q y2q   68 Jun 26 01:04 foo.lisp
  -rw-rw-r-- 1 y2q y2q   70 Jun 26 01:03 package.lisp

package.lisp is here:

(in-package :cl-user)

(defpackage :foo
  (:use :cl)
  (:export
   ))

and foo.lisp is here:

(in-package :foo)

(defun bar ()
  (format t  "~&Hello, World!~%"))

After that, I called M-x slime-connect and connected to localhost:4005, and loaded the package.lisp and foo.lisp.

About Commit e09c504

I tried M-x slime-export-symbol-at-point on bar symbol on foo.lisp.
But I only got this message:

tramp-error: Not a Tramp file name: "/home/y2q/test/package.lisp"

I saw backtraces and tried to trace some functions (attached as trace-1.txt).
I found some problems in slime-find-possible-package-file:

Commit e09c504 tries to fix this by:

  • The try local function assumes taking slime-filenames only. So, it does not calls slime-to-lisp-filename.
  • The file-name-subdirectory local function makes a slime-filename. It always calls slime-from-lisp-filename

About Commit d0d9f0c

After applied commit e09c504, I tried M-x slime-export-symbol-at-point again.
But I saw these weird messages:

Attention: This is ‘/ssh:y2q@home-xubuntu:/ssh:y2q@home-xubuntu:/home/y2q/test/slime-package-test/package.lisp’.
down-list: Scan error: "Unbalanced parentheses", 1, 1

I tried to trace some functions again (attached as trace-2.txt ).

At a glance of slime-goto-location-buffer, slime-goto-source-location assumes lisp-filenames, not slime-filenames.
But slime-find-package-definition-regexp makes a location with (buffer-file-name). The (buffer-file-name) returns a slime-filename. And It is translated to a slime-filename again.

In this example:

  1. slime-find-package-definition-regexp used "/ssh:y2q@home-xubuntu:/home/y2q/test/slime-package-test/package.lisp".
  2. slime-goto-location-buffer made "/ssh:y2q@home-xubuntu:/ssh:y2q@home-xubuntu:/home/y2q/test/slime-package-test/package.lisp".
  3. This weird filename caused a message, and tried to scan a non-existent file.

Commit d0d9f0c tries to fix this by using a lisp-filename on slime-find-package-definition-regexp.

With commit e09c504 and d0d9f0c, M-x slime-export-symbol-at-point works well on Allegro CL.


Again, I am so sorry for reporting so late.
Thank you for reading to the end.

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

Successfully merging this pull request may close these issues.

None yet

1 participant