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

cython-mode.el should overload python-mode's settings to recognize cdef and cpdef declarations #3324

Open
ThibautVerron opened this issue Jan 22, 2020 · 0 comments

Comments

@ThibautVerron
Copy link

Hello,

In cython-mode, some of the mechanic is subcontracted to one of the existing python-mode's. I am not sure how all of those interact, but at least with the built-in python.el, there could be some improvement to parsing.

For example, currently, python-info-docstring-p fails to recognize that the point is in the docstring of a cdef or cpdef, which in turns means that formatting settings such as auto-filling fail.

I believe that cython-mode should provide a new value for python-nav-beginning-of-defun-regexp, for example:

(setq-local python-nav-beginning-of-defun-regexp 
	      (python-rx line-start
			 (* space)
			 (and symbol-start
			      (or "def" "class"
				  (and "async" (+ space) "def")
				  ;; new
				  (and (or "cdef" "cpdef") (+ space) (* (any word ?_))))
			      symbol-end)
			 (+ space)
			 (group symbol-name)))

It seems to do the trick for me, but I'm probably using only a subset of cython's syntax.

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

1 participant