Mercurial > emacs
changeset 85840:d227ffcaa3fe
(python-mode-abbrev-table): Use :regexp.
Merge defvar and define-abbrev-table.
(def-python-skeleton): Use :case-fixed and :enable-function.
(python-abbrev-pc-hook, python-abbrev-syntax-table, python-pea-hook): Remove.
(python-mode): Don't modify pre-abbrev-expand-hook.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 31 Oct 2007 20:00:36 +0000 |
parents | f32c70475c8e |
children | 0c0a9419b0c4 |
files | lisp/ChangeLog lisp/progmodes/python.el |
diffstat | 2 files changed, 16 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed Oct 31 19:25:32 2007 +0000 +++ b/lisp/ChangeLog Wed Oct 31 20:00:36 2007 +0000 @@ -1,3 +1,12 @@ +2007-10-31 Stefan Monnier <monnier@iro.umontreal.ca> + + * progmodes/python.el (python-mode-abbrev-table): Use :regexp. + Merge defvar and define-abbrev-table. + (def-python-skeleton): Use :case-fixed and :enable-function. + (python-abbrev-pc-hook, python-abbrev-syntax-table, python-pea-hook): + Remove. + (python-mode): Don't modify pre-abbrev-expand-hook. + 2007-10-31 Dan Nicolaescu <dann@ics.uci.edu> * ediff-util.el (ediff-file-checked-out-p)
--- a/lisp/progmodes/python.el Wed Oct 31 19:25:32 2007 +0000 +++ b/lisp/progmodes/python.el Wed Oct 31 20:00:36 2007 +0000 @@ -2036,10 +2036,11 @@ "Alist of named skeletons for Python mode. Elements are of the form (NAME . EXPANDER-FUNCTION).") -(defvar python-mode-abbrev-table nil +(define-abbrev-table 'python-mode-abbrev-table () "Abbrev table for Python mode. -The default contents correspond to the elements of `python-skeletons'.") -(define-abbrev-table 'python-mode-abbrev-table ()) +The default contents correspond to the elements of `python-skeletons'." + ;; Allow / in abbrevs. + :regexp "\\<\\([[:word:]/]+\\)\\W*") (eval-when-compile ;; Define a user-level skeleton and add it to `python-skeletons' and @@ -2049,8 +2050,9 @@ (function (intern (concat "python-insert-" name)))) `(progn (add-to-list 'python-skeletons ',(cons name function)) - (if python-use-skeletons - (define-abbrev python-mode-abbrev-table ,name "" ',function nil t)) + (define-abbrev python-mode-abbrev-table ,name "" ',function + :system t :case-fixed t + :enable-function (lambda () python-use-skeletons)) (define-skeleton ,function ,(format "Insert Python \"%s\" template." name) ,@elements))))) @@ -2205,23 +2207,6 @@ (defvar outline-heading-end-regexp) (defvar eldoc-documentation-function) - -;; Stuff to allow expanding abbrevs with non-word constituents. -(defun python-abbrev-pc-hook () - "Set the syntax table before possibly expanding abbrevs." - (remove-hook 'post-command-hook 'python-abbrev-pc-hook t) - (set-syntax-table python-mode-syntax-table)) - -(defvar python-abbrev-syntax-table - (copy-syntax-table python-mode-syntax-table) - "Syntax table used when expanding abbrevs.") - -(defun python-pea-hook () - "Reset the syntax table after possibly expanding abbrevs." - (set-syntax-table python-abbrev-syntax-table) - (add-hook 'post-command-hook 'python-abbrev-pc-hook nil t)) -(modify-syntax-entry ?/ "w" python-abbrev-syntax-table) - (defvar python-mode-running) ;Dynamically scoped var. ;;;###autoload @@ -2309,7 +2294,6 @@ '((< '(backward-delete-char-untabify (min python-indent (current-column)))) (^ '(- (1+ (current-indentation)))))) - (add-hook 'pre-abbrev-expand-hook 'python-pea-hook nil t) (if (featurep 'hippie-exp) (set (make-local-variable 'hippie-expand-try-functions-list) (cons 'python-try-complete hippie-expand-try-functions-list)))