summaryrefslogtreecommitdiffstats
path: root/Misc/python-mode.el
Commit message (Collapse)AuthorAgeFilesLines
...
* (py-execute-region): Watch out for shell-command-on-region killing aBarry Warsaw1998-03-251-4/+10
| | | | zero sized output buffer.
* Removed all the mixed indentation face stuff. It's not as helpful asBarry Warsaw1998-03-201-9/+0
| | | | | it at first seems. I think we've got a good idea of what to do, but it'll be a bit of work... for later.
* (py-tab-face): => py-mixed-indentation-faceBarry Warsaw1998-03-201-5/+6
| | | | | | (python-font-lock-keywords): Better regexp given by Sjoerd. This matches only mixed indentation which is probably more useful than matching all tabs.
* (py-in-literal, py-fast-in-literal): New functions (mostly) stolenBarry Warsaw1998-03-191-24/+45
| | | | | | | | from CC Mode. (py-guess-indent-offset): Teach it about colons in `literals' (e.g. comments and strings). Don't false hit colons in literals; keep searching for a real block introducing line.
* #minor change to eval-while-compile so that it must both findBarry Warsaw1998-03-191-4/+7
| | | | | #custom.el and have an up-to-date version (i.e. one that defines #defcustom -- which Emacs 19.34's by default does not).
* (py-tab-face, python-font-lock-keywords): Color all tabs at the startBarry Warsaw1998-03-191-0/+8
| | | | | | | of a line in py-tab-face to aid in seeing mixed tab/space indentation. This face defaults to the `default' face so it is unobtrusive until you `M-x customize-face' py-tab-face to something obnoxious like "Yellow".
* (py-smart-indentation): Updated docstring for new policy.Barry Warsaw1998-03-161-8/+12
| | | | | (python-mode): Implement new policy: never turn indent-tabs-mode on. Only turn it off if tab-width != py-indent-offset.
* #(py-smart-indentation): Small fixes for clarity in the docstring.Barry Warsaw1998-03-131-5/+4
|
* (python-mode): Removed vi vi vi hack for setting the tab width from aBarry Warsaw1998-03-131-25/+0
| | | | | magic comment. Now Guido only has to worry about the northern Wisconsin Braces Freedom Fighter Militia.
* (py-smart-indentation): New variable which controls the automagicBarry Warsaw1998-03-131-20/+49
| | | | | | | | | | 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.
* (py-execute-region): Simplified calculation of temporary file name.Barry Warsaw1998-02-251-2/+3
| | | | | When running synchronously in a subproc buffer, be sure to pop-to-buffer so the output is visible.
* (py-temp-directory): Minor docstring nit.Barry Warsaw1998-02-251-1/+1
|
* (py-master-file): Fixed some typos in the docstring.Barry Warsaw1998-02-251-4/+4
|
* (py-compute-indentation): Several changes made to improve navigationBarry Warsaw1998-02-121-14/+33
| | | | | | | | | | | | | | | | 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.
* (py-scroll-process-buffer): Default value changed to nil to act moreBarry Warsaw1998-02-061-1/+1
| | | | like default shell-mode behavior.
* (py-parse-state): When looking for landing inside triple-quotedBarry Warsaw1998-02-051-1/+1
| | | | | | string, don't check for indentation at column zero. This will falsely hit a line inside a docstring that starts at column zero but ends in a colon.
* (py-python-command-args): New variable, allows user to customize theBarry Warsaw1998-02-051-1/+6
| | | | arguments past to py-python-command when invoking the Python shell.
* (py-outdent-p): When looking at the previous line, watch out forBarry Warsaw1998-01-211-1/+3
| | | | | | | | | | | | | | | 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()
* (py-goto-initial-line): Shut up the byte compiler.Barry Warsaw1998-01-211-1/+1
|
* (py-mode-map): Add a binding of C-m to py-newline-and-indent. This isBarry Warsaw1998-01-211-1/+2
| | | | | | | | | | | 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.
* (py-compute-indentation): In the most common case, where indentationBarry Warsaw1998-01-201-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* (py-master-file): New buffer-local variable which can be set in theBarry Warsaw1998-01-201-0/+24
| | | | | | | | | 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.
* Update to the Big Comment at the top of the file. It should betterBarry Warsaw1997-12-111-24/+43
| | | | | explain what the users of the various Emacsen have to do to get this all working.
* Added some links to OO-Browser, given by Harri Pasanen.Barry Warsaw1997-12-061-2/+8
| | | | Updated the to do list.
* (py-jump-on-exception): Variable which if t, means that if anBarry Warsaw1997-12-031-7/+19
| | | | | exception occurs in a synchronous Python subprocess, the mode will automatically jump to the innermost exception.
* Removed redundant eval-when-compile.Barry Warsaw1997-12-031-19/+13
| | | | | | | | | | | (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.
* (python-mode): Patch to make font-lock work automatically for Emacs.Barry Warsaw1997-12-021-0/+1
| | | | Unnecessary for XEmacs, but oh well...
* Test for an up-to-date Custom library when byte-compiling, and issueBarry Warsaw1997-12-021-1/+20
| | | | | an informative message when one cannot be found, as is the case with a vanilla Emacs 19.34 (and NTEmacs 19.34).
* Require 'cl when compiling so that the push macro gets picked in EmacsBarry Warsaw1997-12-011-0/+2
| | | | 19.34.
* (py-traceback-line-re): Relaxation of regexp to catch SyntaxErrors.Barry Warsaw1997-11-271-2/+2
| | | | Harri Pasanen.
* (py-process-filter): py-delete-file-silently is obsolete. Use aBarry Warsaw1997-11-261-1/+1
| | | | py-safe wrapped delete-file call instead.
* (py-compute-indentation): Check for multiline stringness andBarry Warsaw1997-11-261-4/+4
| | | | | commentness so that hitting TAB in the middle of a comment will still indent the line.
* (py-mode-map): Bind py-mark-def-or-class to C-M-h with a differentBarry Warsaw1997-11-261-2/+3
| | | | | spelling so that it doesn't clobber the standard M-BS binding. This should be portable between X/Emacsen.
* (python-mode): Make imenu-create-index-function buffer local.Barry Warsaw1997-11-261-3/+4
| | | | | | | | | (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-mark-def-or-class): Added an exchange-point-and-mark and aBarry Warsaw1997-11-261-2/+4
| | | | | | | | | 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.
* (python-mode): Patch to fix Imenu support under Emacs, given byBarry Warsaw1997-11-261-1/+3
| | | | Torsten Hilbrich <Torsten.Hilbrich@bln.de>.
* (py-kill-emacs-hook): Simplification.Barry Warsaw1997-11-261-11/+5
|
* Added comment about where to find details on python-mode.el, pointingBarry Warsaw1997-11-261-23/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* #(py-emacs-features): Fixed typo in docstring.Barry Warsaw1997-11-061-2/+2
|
* (python-font-lock-keywords): Pick up block introducing keywords withBarry Warsaw1997-11-061-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | immediately following colons. Sjoerd noticed this one too. Here's a nonsense.py file that flexes all the font-lock keyword combinations. class A: class B(A): pass def __init__(self): if i == 2 and j == 3 or k == 4: import stuff from otherstuff import cool for i in range(cool.count): if i == j: break elif j == 1: continue print i else: return not i elif q is not i: return lambda x: x + 1 else: try: try: raise stuff.error except stuff.error, v: print v except: global q finally: while q > 0: q = q - 1 assert q == 0 def make(): a = A() exec "nonsense" del a
* (python-font-lock-keywords): Fix for consecutive keyword font locking,Barry Warsaw1997-11-051-6/+2
| | | | given by Sjoerd Mullender <Sjoerd.Mullender@cwi.nl>.
* (py-emacs-features): Test for working make-temp-name, which is brokenBarry Warsaw1997-11-051-10/+20
| | | | | | | | | | | on NTEmacs 19.34.6. (py-serial-number): New variable. (py-execute-region): If make-temp-name is broken, simply append a serial number to the string "python-" to get a temporary file name. It's possible concurrent NTEmacs can step on each others toes, but it makes no sense to further coddle a busted NTEmacs.
* (py-execute-region): Fixed small bug with queuing file for executionBarry Warsaw1997-11-051-2/+1
| | | | in a py-shell. Temp files now get cleaned up.
* (mark-python-def-or-class): Renamed to py-mark-def-or-class globally.Barry Warsaw1997-11-051-11/+13
| | | | | | | (py-mode-map): Moved py-mark-def-or-class from M-C-h to C-c C-m since the old binding conflicts with the standard global backward-kill-word binding, and this new binding is more conformant with other language modes. Moved py-mark-block to C-c C-k.
* (py-backspace-function): New variable.Barry Warsaw1997-11-041-60/+101
| | | | | | | | | | | (py-electric-backspace, py-electric-delete): Support the XEmacs 20 Way for backspace and delete mappings. In XEmacs 19, Emacs 19, and Emacs 20, both backspace and delete keysyms are bound to py-electric-backspace. In XEmacs 20, backspace and delete keysyms are bound separately, allowing the user to specify forward or backward deletion of the delete keysym through the variable delete-key-deletes-forward. All this is the Right Way To Do It and this implementation was largely ripped from CC Mode.
* First round of changes, mostly subprocess stuff.Barry Warsaw1997-11-041-138/+129
| | | | | | | | | | | | | | | | | | | | | | (py-execute-file): Better interaction with comint. Set comint-scroll-to-bottom-on-output to t. Wrapper buffer change in unwind-protect in case process filter fails. (py-shell): Start Python with -i flag to fix tty problem on Windows; presumably -- not yet tested. (py-clear-queue): New function to clear the pending exec file queue. Not currently keybound. (py-execute-region, py-execute-buffer): Added optional async flag (use via C-u prefix) to execute the region in a new asynchrous buffer, even if the Python shell is running. (py-append-to-process-buffer): Removed as obsolete. Comint provides this functionality. Removed fbound test defun of match-string. All modern X/Emacsen have this function.
* Changes in preparation for integrating into the Python CVS tree.Barry Warsaw1997-11-031-70/+59
| | | | | | | | | | | | | | | | | | | | | | | Introductory comment updates. (python-font-lock-keywords): Added "assert" (py-block-closing-keywords-re): New variable. (py-no-outdent-re): Rewrite to use py-block-closing-keywords-re. (py-shell): py-process-filter should no longer be necessary. Comint should do all the work. Note that more fixes to the py-shell process mechanism need to be done. (py-execute-region): Check for empty region. Some questionable changes to set-buffer after shell-command-on-region. Again, this all needs to be closely examined for X/Emacs 19/20 compatibility. (py-goto-beyond-final-line): py-parse-partial-sexp-works-p should no longer be necessary. (py-statement-closes-block-p): Use py-block-closing-keywords-re.
* (py-parse-partial-sexp-works-p): Removed as obsolete. All currentBarry Warsaw1997-09-041-20/+10
| | | | | | Emacs and XEmacs versions should have working parse-partial-sexp's. (py-emacs-features): Defined as future placeholder.
* #Fixed two byte-compiler errorsBarry Warsaw1997-08-091-2/+2
|
* #Checkpointing X/Emacs 20'fication of this mode.Barry Warsaw1997-08-091-210/+231
|