[Python-mode] [ python-mode-Bugs-783241 ] python-mode.el: sexp commands don't understand Python

SourceForge.net noreply at sourceforge.net
Sun Feb 22 15:29:02 EST 2004


Bugs item #783241, was opened at 2003-08-05 04:14
Message generated for change (Comment added) made by epaepa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=581349&aid=783241&group_id=86916

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: python-mode.el: sexp commands don't understand Python

Initial Comment:
migrating from the python project.

Original submission:

Emacs has a whole lot of commands dealing with 
'sexps', 
 such as forward-sexp and kill-sexp.  These originated 
 with Lisp but are useful for other languages too.  For 
 example in c-mode, editing the text 
  
 if (x > 7) { 
     puts("hello"); 
 } 
  
 with point before the 'i', pressing M-C-k (kill-sexp) 
 will first kill the 'if' keyword, leaving: 
  
  (x > 7) { 
     puts("hello"); 
 } 
  
 Then a second press of M-C-k leaves 
  
  { 
     puts("hello"); 
 } 
  
 and a third press kills the whole block following.  So 
 you can kill the whole if-statement, and nothing 
more, 
 with three keypresses.  This is useful for moving 
 chunks of code around. 
  
 However the same doesn't work in python-mode 
because 
 Emacs doesn't appear to know about the definition of 
a 
 sexp.  You can kill balanced expressions on a 
 particular line but it's not possible to remove the 
 whole of an 'if' or 'while' block. 
  
 Along the same lines, while commands like mark-
defun 
 work in most languages to select the current function 
 definition, they don't work with Python's 'def' blocks, 
 instead highlighting the whole file. 
  
 Is it possible to get these and similar commands 
 working, or is Emacs hardwired to look for starting 
and 
 ending delimiters around each block?  If it's not 
 possible to make these commands work correctly, it 
 might be better to disable them for python-mode 
rather 
 than leave them present but wrong (eg mark-defun 
marks 
 the whole buffer).

No followup comments.


----------------------------------------------------------------------

Comment By: Ed Avis (epaepa)
Date: 2004-02-22 20:29

Message:
Logged In: YES 
user_id=10769

(I am the original logger of this bug.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=581349&aid=783241&group_id=86916



More information about the Python-mode mailing list