unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19908: python.el: minimal cython indentation support
@ 2015-02-20  0:27 Carlos Pita
  2015-08-14 16:59 ` Nathan Weston
  0 siblings, 1 reply; 2+ messages in thread
From: Carlos Pita @ 2015-02-20  0:27 UTC (permalink / raw)
  To: 19908

X-Debbugs-CC: fgallina@gnu.org

This isn't a bug in python.el at all. But as it tries to be so smart at
indenting it could be difficult for inherited modes to leverage this
cleverness.

What is needed for cython-mode indentation to work (AFAICS):

* To add cdef, cpdef, enum, struct, union, IF, ELIF and ELSE as
  block starters.

* To add ELIF and ELSE as dedenters.

* To add cdef and cpdef as defuns.

Hopefully the above will also make navigation commands to work with
cython source.

It would be pretty easy to add this directly into python.el (but a
kludge, except you plan to support cython directly). I've done it in my
working copy of python.el and seems to do the job quite well.

This report is about finding a good extension point for the above, in
order to make possible cython-mode to better extend
python-mode. Briefly, it's necessary to extend python-rx-constituents
some way, and at compilation time. Maybe it's already possible in a
clean way I'm not aware of. Or maybe you plan to support cython directly
(+1 it shouldn't be difficult at all).

I will gladly add a pull request to the cython project in github with
the result of the discussion and suggestions here. Or help integrating
cython-mode.el into python.el. In it's current shape cython-mode
indentation and navigation really sucks.

Cheers
--
Carlos





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#19908: python.el: minimal cython indentation support
  2015-02-20  0:27 bug#19908: python.el: minimal cython indentation support Carlos Pita
@ 2015-08-14 16:59 ` Nathan Weston
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Weston @ 2015-08-14 16:59 UTC (permalink / raw)
  To: 19908

I've encountered similar problems writing a mode for Enaml.

What I really want is to override python-rx for enaml-mode, while 
leaving the original definition for python-mode. But that doesn't seem 
to be possible.

For Enaml, I was able to get indentation working by advising 
python-indent-context, but it's not particularly elegant. And other 
function which use (python-rx 'block-start) don't work correctly in 
enaml-mode.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-14 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20  0:27 bug#19908: python.el: minimal cython indentation support Carlos Pita
2015-08-14 16:59 ` Nathan Weston

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).