setting of py-indent-offset and indent-tabs-mode.
(python-mode): After python-mode-hook is run, do the automagic
calculation if py-smart-indentation is non-nil.
(py-parse-state): Get rid of unused variable to quiet the
byte-compiler.
over and around triple-quoted strings:
- move the beginning-of-line to above the p-p-s call
- in the `t' clause of the big cond, where we skip over
triple-quoted strings, first find out if we're looking at a
single or TQS, then skip over it in one fell swoop, instead of
trying to loop over skipage of SQS's.
(py-parse-state): Implement XEmacs only hack to more accurately figure
out whether we're in a string or not. Can't do this in Emacs because
it lacks the necessary primitive, so we just do it the old (and mostly
accurate, but foolable) way for Emacs.
continuation lines. This fixes this bug report, reported by Frank
Stajano.
# But if I split the "raise" line and reindent, the else WRONGLY goes up a
# level (?!?)
while condition1:
if condition2:
raise error3, \
moreInfo4
else: # meant to close "if condition2"
action5()
a religious issue: RMS decrees that the Enter (RET) key should just do
a newline and a LFD (C-j) should do a newline and indent (i.e. the
python-mode version of this). Almost everyone I know disagrees and
finds that RET should do newline and indent. Almost everyone hacks
their modes to do this, if they know how. Because it's hard for
newbies to figure out how to do this, and because most DOS keyboards
lack a LFD (leaving users to the more obscure C-j), I think it makes
better sense to add this default binding.
is based on the line above, watch out for landing inside a triple
quoted string. In this case, use iterative search +
parse-partial-sexp backwards to find the beginning of the string.
Note this does affect performance, but very little in the common cases
(I hope). It could be made *much* faster by adding Emacs and XEmacs
dependent code -- different code naturally. :-(
Fixes the following reported bug:
if len(sys.argv) >= 6:
# More lines here
fptr = open('/etc/hosts', 'w')
fptr.write("""# /etc/hosts -- autocreated by /etc/ppp/ip-up
#
# Address from pppd
%-15s %s
# For loopbacking
127.0.0.1 localhost
255.255.255.255 broadcast
""" % (ipaddr, ipname) )
os.chmod('/etc/hosts', 0644)
file local variable section of a file. When set, and the user hits
C-c C-c, this file gets executed instead of the buffer's file. Idea
given by Roy Dragseth <royd@math.uit.no>, but implemented differently.
(py-execute-buffer): Support py-master-file variable. If this names a
relative path, default-directory is prepended via expand-file-name.
(python-mode): Conditionalize imenu initializations to when we can
safely require imenu. Under Emacs this should prevent python-mode
from hosing the global value of imenu-create-index-function and
messing things up for all other modes. Problem identified by
Christian Egli.
(py-describe-mode): py-delete-char => py-electric-backspace. Given by
Christian Egli.
(imenu-example--create-python-index-engine): Use
buffer-substring-no-properties. Also, don't use
imenu-create-submenu-name. Apparently it is obsolete.
These Imenu patches were given by Christian Egli
<christian.egli@stest.ch>
py-keep-region-active so that the marked def/class gets the
zmacs-region or transient-mark region highlighted. Also point should
be left at the end of the marked region.
(py-mode-map): Moved py-mark-def-or-class to M-C-h to conform to Emacs
major mode standards.
to the Web site.
(py-defun-start-re, py-class-start-re): Changed to defconst.
(py-traceback-line-re): Regular expression describing what traceback
lines look like.
(py-point): New defsubst copied from CC Mode.
(py-highlight-line): Function which does the work of making a
traceback line mouseable. This only works on XEmacs. Someone familar
with Emacs text properties and such will have to do that port.
(py-mode-map): Added C-c- bound to py-up-exception and C-c= bound to
py-down-exception. Also, more concise form for mapcar.
(py-mode-output-map): New keymap for the *Python Output* buffer which
only has keybindings for py-mouseto-exception and py-goto-exception.
All other self-insert-command's are bound to beep. This is actually
bogus because the buffer should really be made read-only and the
functions that insert in that buffer should bind inhibit-read-only.
Also, this map should be bound to highlighted extents in a *Python*
shell buffer, but this stuff hasn't been migrated into there.
(py-postprocess-output-buffer): New function which extentifies the
*Python Output* buffer. The bogosities are that this only runs when
the synchronous process in the buffer is finished (so it doesn't work
for async procs), and it should also be merged into py-process-filter
so the *Python* shell gets mouseable too.
(py-shell): Added C-c- and C-c= to the comint buffer's keymap. The
bogosity is that py-goto-exception should also be bound, but it cannot
be bound to C-cC-c (since that interferes with
comint-interrupt-subjob's typical binding). Also, traceback lines
aren't mouseable in this buffer.
(py-execute-region): Support for traceback jumping. This really is
quite a kludge, but necessary based on the way all this stuff works.
There's bound to be broken interactions here.
(py-jump-to-exception, py-mouseto-exception, py-goto-exception,
py-find-next-exception, py-down-exception, py-up-exception): All new
commands and functions to implement traceback jumping.
(py-compute-indentation): Hope this change doesn't get lost in all the
noise above!!!! This fixes broken non-indentation of a line when TAB
is hit inside a string that isn't a multi-line string.