[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
python.el -- support for the with statement
From: |
Edward O'Connor |
Subject: |
python.el -- support for the with statement |
Date: |
Wed, 18 Apr 2007 00:10:23 -0400 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) |
Hi,
Attached is a patch for progmodes/python.el to support the with
statement (new in Python 2.5). It's been only lightly tested, but Works
For Me and is a pretty minimal patch besides. It'd be nice to slip this
in before the release if possible. :)
Ted
--
Edward O'Connor
address@hidden
Index: python.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.57
diff -u -r1.57 python.el
--- python.el 28 Mar 2007 01:21:46 -0000 1.57
+++ python.el 18 Apr 2007 04:07:21 -0000
@@ -96,7 +96,7 @@
"import" "in" "is" "lambda" "not" "or" "pass" "print"
"raise" "return" "try" "while" "yield"
;; Future keywords
- "as" "None"
+ "as" "None" "with"
;; Not real keywords, but close enough to be fontified as such
"self" "True" "False")
symbol-end)
@@ -374,7 +374,7 @@
(save-excursion
(unless bos (python-beginning-of-statement))
(looking-at (rx (and (or "if" "else" "elif" "while" "for" "def"
- "class" "try" "except" "finally")
+ "class" "try" "except" "finally" "with")
symbol-end)))))
(defun python-close-block-statement-p (&optional bos)
@@ -2236,7 +2236,7 @@
#'python-current-defun)
(set (make-local-variable 'outline-regexp)
(rx (* space) (or "class" "def" "elif" "else" "except" "finally"
- "for" "if" "try" "while")
+ "for" "if" "try" "while" "with")
symbol-end))
(set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
(set (make-local-variable 'outline-level) #'python-outline-level)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- python.el -- support for the with statement,
Edward O'Connor <=