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.
Logged In: YES
user_id=10769
(I am the original logger of this bug.)