GNU bug report logs - #19908
python.el: minimal cython indentation support

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita <at> gmail.com>

Date: Fri, 20 Feb 2015 00:28:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 19908 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to fgallina <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#19908; Package emacs. (Fri, 20 Feb 2015 00:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carlos Pita <carlosjosepita <at> gmail.com>:
New bug report received and forwarded. Copy sent to fgallina <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Fri, 20 Feb 2015 00:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: python.el: minimal cython indentation support
Date: Thu, 19 Feb 2015 21:27:23 -0300
X-Debbugs-CC: fgallina <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19908; Package emacs. (Fri, 14 Aug 2015 17:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 19908 <at> debbugs.gnu.org (full text, mbox):

From: Nathan Weston <nweston <at> fastmail.com>
To: 19908 <at> debbugs.gnu.org
Subject: python.el: minimal cython indentation support
Date: Fri, 14 Aug 2015 12:59:57 -0400
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.




This bug report was last modified 9 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.