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

TAB gives py-forward-statement: buffer not in python-mode #34

Open
johanrosenkilde opened this issue Aug 11, 2017 · 3 comments
Open

TAB gives py-forward-statement: buffer not in python-mode #34

johanrosenkilde opened this issue Aug 11, 2017 · 3 comments

Comments

@johanrosenkilde
Copy link
Contributor

Since upgrading Emacs and a load of packages, hitting TAB in a file with sage-mode often gives me the error py-forward-statement: buffer not in python-mode.

For instance, with a file containing:

def f():
    return 1

I get the error hitting TAB on the return line, but not on the def line.

This also happens in a clean emacs with emacs -q.

@johanrosenkilde
Copy link
Contributor Author

I'm using MELPA's python-mode 20170803.405

@stakemori
Copy link
Collaborator

This is because py-forward-statement checks if major-mode is strictly equal to python-mode (I opened an issue in the python-mode repository https://gitlab.com/python-mode-devs/python-mode/issues/39). The following is a workaround by advice:

    (defun sage-shell-around-advice (fun &rest args)
      (let ((major-mode 'python-mode))
        (apply fun args)))
    (advice-add 'py-forward-statement :around #'sage-shell-around-advice)
    (advice-add 'py-switch-imenu-index-function :around #'sage-shell-around-advice)

@johanrosenkilde
Copy link
Contributor Author

Thanks for your super-snappy reply! I'll use the workaround for now.

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