aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-06-18 16:41:23 -0400
committerStefan Monnier2012-06-18 16:41:23 -0400
commit25f09295fa146e9e4569f16f2eb41f3452383af9 (patch)
tree5e5bc27f8743d1b464901b8b492e562487a952c0
parent6b11952a33ff7f4989c9366f24bbe894ae6c05e1 (diff)
downloademacs-25f09295fa146e9e4569f16f2eb41f3452383af9.tar.gz
emacs-25f09295fa146e9e4569f16f2eb41f3452383af9.zip
* lisp/progmodes/python.el (python-rx-constituents): Move backquote.
(python-skeleton-define, python-define-auxiliary-skeleton): Use `declare'.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/python.el30
2 files changed, 22 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 00a33cc01b9..ab66eaf58fb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/python.el (python-rx-constituents): Move backquote.
4 (python-skeleton-define, python-define-auxiliary-skeleton):
5 Use `declare'.
6
12012-06-18 Michael Albinus <michael.albinus@gmx.de> 72012-06-18 Michael Albinus <michael.albinus@gmx.de>
2 8
3 * minibuffer.el (read-file-name-default): Revert the patch from 9 * 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 @@
308 308
309(eval-when-compile 309(eval-when-compile
310 (defconst python-rx-constituents 310 (defconst python-rx-constituents
311 (list 311 `((block-start . ,(rx symbol-start
312 `(block-start . ,(rx symbol-start
313 (or "def" "class" "if" "elif" "else" "try" 312 (or "def" "class" "if" "elif" "else" "try"
314 "except" "finally" "for" "while" "with") 313 "except" "finally" "for" "while" "with")
315 symbol-end)) 314 symbol-end))
316 `(decorator . ,(rx line-start (* space) ?@ (any letter ?_) 315 (decorator . ,(rx line-start (* space) ?@ (any letter ?_)
317 (* (any word ?_)))) 316 (* (any word ?_))))
318 `(defun . ,(rx symbol-start (or "def" "class") symbol-end)) 317 (defun . ,(rx symbol-start (or "def" "class") symbol-end))
319 `(if-name-main . ,(rx line-start "if" (+ space) "__name__" 318 (if-name-main . ,(rx line-start "if" (+ space) "__name__"
320 (+ space) "==" (+ space) 319 (+ space) "==" (+ space)
321 (any ?' ?\") "__main__" (any ?' ?\") 320 (any ?' ?\") "__main__" (any ?' ?\")
322 (* space) ?:)) 321 (* space) ?:))
323 `(symbol-name . ,(rx (any letter ?_) (* (any word ?_)))) 322 (symbol-name . ,(rx (any letter ?_) (* (any word ?_))))
324 `(open-paren . ,(rx (or "{" "[" "("))) 323 (open-paren . ,(rx (or "{" "[" "(")))
325 `(close-paren . ,(rx (or "}" "]" ")"))) 324 (close-paren . ,(rx (or "}" "]" ")")))
326 `(simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))) 325 (simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))
327 `(not-simple-operator . ,(rx 326 ;; FIXME: rx should support (not simple-operator).
327 (not-simple-operator . ,(rx
328 (not 328 (not
329 (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))) 329 (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))))
330 `(operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" 330 ;; FIXME: Use regexp-opt.
331 (operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">"
331 "=" "%" "**" "//" "<<" ">>" "<=" "!=" 332 "=" "%" "**" "//" "<<" ">>" "<=" "!="
332 "==" ">=" "is" "not"))) 333 "==" ">=" "is" "not")))
333 `(assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" 334 ;; FIXME: Use regexp-opt.
335 (assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**="
334 ">>=" "<<=" "&=" "^=" "|=")))) 336 ">>=" "<<=" "&=" "^=" "|="))))
335 "Additional Python specific sexps for `python-rx'")) 337 "Additional Python specific sexps for `python-rx'"))
336 338
@@ -2146,6 +2148,7 @@ the if condition."
2146 "Define a `python-mode' skeleton using NAME DOC and SKEL. 2148 "Define a `python-mode' skeleton using NAME DOC and SKEL.
2147The skeleton will be bound to python-skeleton-NAME and will 2149The skeleton will be bound to python-skeleton-NAME and will
2148be added to `python-mode-abbrev-table'." 2150be added to `python-mode-abbrev-table'."
2151 (declare (indent 2))
2149 (let* ((name (symbol-name name)) 2152 (let* ((name (symbol-name name))
2150 (function-name (intern (concat "python-skeleton-" name)))) 2153 (function-name (intern (concat "python-skeleton-" name))))
2151 `(progn 2154 `(progn
@@ -2156,11 +2159,11 @@ be added to `python-mode-abbrev-table'."
2156 ,(or doc 2159 ,(or doc
2157 (format "Insert %s statement." name)) 2160 (format "Insert %s statement." name))
2158 ,@skel)))) 2161 ,@skel))))
2159(put 'python-skeleton-define 'lisp-indent-function 2)
2160 2162
2161(defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel) 2163(defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel)
2162 "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL. 2164 "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL.
2163The skeleton will be bound to python-skeleton-NAME." 2165The skeleton will be bound to python-skeleton-NAME."
2166 (declare (indent 2))
2164 (let* ((name (symbol-name name)) 2167 (let* ((name (symbol-name name))
2165 (function-name (intern (concat "python-skeleton--" name))) 2168 (function-name (intern (concat "python-skeleton--" name)))
2166 (msg (format 2169 (msg (format
@@ -2176,7 +2179,6 @@ The skeleton will be bound to python-skeleton-NAME."
2176 (unless (y-or-n-p ,msg) 2179 (unless (y-or-n-p ,msg)
2177 (signal 'quit t)) 2180 (signal 'quit t))
2178 ,@skel))) 2181 ,@skel)))
2179(put 'python-define-auxiliary-skeleton 'lisp-indent-function 2)
2180 2182
2181(python-define-auxiliary-skeleton else nil) 2183(python-define-auxiliary-skeleton else nil)
2182 2184