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

Cannot correctly detect doc if using single quote in Inferior Python mode. #87

Open
yanghaoxie opened this issue Jul 4, 2019 · 6 comments
Labels

Comments

@yanghaoxie
Copy link

If your issue is a bug, please provide me with some information to help reproduce it. If it's a feature request then
you can ignore this template.

Reproducing

  • scenario 1.
    If I first input ", then input /, it will produce >>> "/

  • scenario 2.
    If I first input ', then input /, it will produce >>> ' /

You see, in scenario 1, there is no extra space, since I trying insert string. However in scenario 2, I use single quote, there is an extra space.

Other useful info

  • Emacs version: 27.0.50
  • electric-operator version: 1.0.0
  • the value of electric-operator-enable-in-docs is nil
@davidshepherd7
Copy link
Owner

davidshepherd7 commented Jul 4, 2019

Hi, thanks for reporting this and for the reproduction details 👍

Unfortunately I think this is due to a bug in inferior python mode's parsing. electric-operator relies on the major mode to tell it if it is currently inside a string or not, and for some reason inferior python mode claims that >>> ' is not inside a string. I don't think there's really much I can do about it without implementing a whole python parser 😞.

@yanghaoxie
Copy link
Author

Thank for you for explain. I guess I have to file a issue to Emacs develop group.

@yanghaoxie
Copy link
Author

Hi!
I wonder is there a simple workaround that we test ' ourself (in electric-operator-in-docs?) instead using syntax-ppss in inferior python mode .

Maybe we can just add the test like this?

(defun electric-operator-in-docs? ()
  "Check if we are inside a string or comment"
  (or (nth 8 (syntax-ppss))
      (my-own-single-quote-test-in-inferior-python-mode)))

@davidshepherd7
Copy link
Owner

davidshepherd7 commented Jul 9, 2019 via email

@yanghaoxie
Copy link
Author

Thank you so much for you comprehensive explanation. Sounds like it is much harder than I thought.

By the way, I am using the Emacs 27.0.50, it seems like that this is still a issue.

Anyway, thank you very much! 👍

@davidshepherd7
Copy link
Owner

No problem, glad it helped 🙂

By the way, I am using the Emacs 27.0.50, it seems like that this is still a issue.

Oh, that's a shame.

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

No branches or pull requests

2 participants