From: Stefan Monnier Date: Mon, 18 Jun 2012 20:41:23 +0000 (-0400) Subject: * lisp/progmodes/python.el (python-rx-constituents): Move backquote. X-Git-Tag: emacs-24.2.90~1199^2~432 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=25f09295fa146e9e4569f16f2eb41f3452383af9;p=emacs.git * lisp/progmodes/python.el (python-rx-constituents): Move backquote. (python-skeleton-define, python-define-auxiliary-skeleton): Use `declare'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 00a33cc01b9..ab66eaf58fb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-06-18 Stefan Monnier + + * progmodes/python.el (python-rx-constituents): Move backquote. + (python-skeleton-define, python-define-auxiliary-skeleton): + Use `declare'. + 2012-06-18 Michael Albinus * minibuffer.el (read-file-name-default): Revert the patch from diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3cbd744e3e7..8844480a95f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -308,29 +308,31 @@ (eval-when-compile (defconst python-rx-constituents - (list - `(block-start . ,(rx symbol-start + `((block-start . ,(rx symbol-start (or "def" "class" "if" "elif" "else" "try" "except" "finally" "for" "while" "with") symbol-end)) - `(decorator . ,(rx line-start (* space) ?@ (any letter ?_) + (decorator . ,(rx line-start (* space) ?@ (any letter ?_) (* (any word ?_)))) - `(defun . ,(rx symbol-start (or "def" "class") symbol-end)) - `(if-name-main . ,(rx line-start "if" (+ space) "__name__" + (defun . ,(rx symbol-start (or "def" "class") symbol-end)) + (if-name-main . ,(rx line-start "if" (+ space) "__name__" (+ space) "==" (+ space) (any ?' ?\") "__main__" (any ?' ?\") (* space) ?:)) - `(symbol-name . ,(rx (any letter ?_) (* (any word ?_)))) - `(open-paren . ,(rx (or "{" "[" "("))) - `(close-paren . ,(rx (or "}" "]" ")"))) - `(simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))) - `(not-simple-operator . ,(rx + (symbol-name . ,(rx (any letter ?_) (* (any word ?_)))) + (open-paren . ,(rx (or "{" "[" "("))) + (close-paren . ,(rx (or "}" "]" ")"))) + (simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))) + ;; FIXME: rx should support (not simple-operator). + (not-simple-operator . ,(rx (not (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))) - `(operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" + ;; FIXME: Use regexp-opt. + (operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" "=" "%" "**" "//" "<<" ">>" "<=" "!=" "==" ">=" "is" "not"))) - `(assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" + ;; FIXME: Use regexp-opt. + (assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" ">>=" "<<=" "&=" "^=" "|=")))) "Additional Python specific sexps for `python-rx'")) @@ -2146,6 +2148,7 @@ the if condition." "Define a `python-mode' skeleton using NAME DOC and SKEL. The skeleton will be bound to python-skeleton-NAME and will be added to `python-mode-abbrev-table'." + (declare (indent 2)) (let* ((name (symbol-name name)) (function-name (intern (concat "python-skeleton-" name)))) `(progn @@ -2156,11 +2159,11 @@ be added to `python-mode-abbrev-table'." ,(or doc (format "Insert %s statement." name)) ,@skel)))) -(put 'python-skeleton-define 'lisp-indent-function 2) (defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel) "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL. The skeleton will be bound to python-skeleton-NAME." + (declare (indent 2)) (let* ((name (symbol-name name)) (function-name (intern (concat "python-skeleton--" name))) (msg (format @@ -2176,7 +2179,6 @@ The skeleton will be bound to python-skeleton-NAME." (unless (y-or-n-p ,msg) (signal 'quit t)) ,@skel))) -(put 'python-define-auxiliary-skeleton 'lisp-indent-function 2) (python-define-auxiliary-skeleton else nil)