unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* python.el -- support for the with statement
@ 2007-04-18  4:10 Edward O'Connor
  2007-05-08  3:18 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Edward O'Connor @ 2007-04-18  4:10 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

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
hober0@gmail.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add support for the with statement to python.el --]
[-- Type: text/x-patch, Size: 1333 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-09 16:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18  4:10 python.el -- support for the with statement Edward O'Connor
2007-05-08  3:18 ` Stefan Monnier
2007-05-08 21:13   ` Richard Stallman
2007-05-09  4:36   ` Michael Olson
2007-05-09 14:17     ` Stefan Monnier
2007-05-09 16:34     ` Edward O'Connor
2007-05-09 16:56       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).