aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-10-31 20:00:36 +0000
committerStefan Monnier2007-10-31 20:00:36 +0000
commitc01b997152fb916ce687577b03898372e0a404b2 (patch)
tree62789f3ec3df706f324688ee4226d4b0ef618c53
parent1bc973c2e4e89685a760187f76f4aeec9799b972 (diff)
downloademacs-c01b997152fb916ce687577b03898372e0a404b2.tar.gz
emacs-c01b997152fb916ce687577b03898372e0a404b2.zip
(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.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/python.el30
2 files changed, 16 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d6f8c53df29..54b5c2a2ba4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12007-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/python.el (python-mode-abbrev-table): Use :regexp.
4 Merge defvar and define-abbrev-table.
5 (def-python-skeleton): Use :case-fixed and :enable-function.
6 (python-abbrev-pc-hook, python-abbrev-syntax-table, python-pea-hook):
7 Remove.
8 (python-mode): Don't modify pre-abbrev-expand-hook.
9
12007-10-31 Dan Nicolaescu <dann@ics.uci.edu> 102007-10-31 Dan Nicolaescu <dann@ics.uci.edu>
2 11
3 * ediff-util.el (ediff-file-checked-out-p) 12 * ediff-util.el (ediff-file-checked-out-p)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index fc28b72bfd1..f54b7c9f928 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2036,10 +2036,11 @@ the if condition."
2036 "Alist of named skeletons for Python mode. 2036 "Alist of named skeletons for Python mode.
2037Elements are of the form (NAME . EXPANDER-FUNCTION).") 2037Elements are of the form (NAME . EXPANDER-FUNCTION).")
2038 2038
2039(defvar python-mode-abbrev-table nil 2039(define-abbrev-table 'python-mode-abbrev-table ()
2040 "Abbrev table for Python mode. 2040 "Abbrev table for Python mode.
2041The default contents correspond to the elements of `python-skeletons'.") 2041The default contents correspond to the elements of `python-skeletons'."
2042(define-abbrev-table 'python-mode-abbrev-table ()) 2042 ;; Allow / in abbrevs.
2043 :regexp "\\<\\([[:word:]/]+\\)\\W*")
2043 2044
2044(eval-when-compile 2045(eval-when-compile
2045 ;; Define a user-level skeleton and add it to `python-skeletons' and 2046 ;; Define a user-level skeleton and add it to `python-skeletons' and
@@ -2049,8 +2050,9 @@ The default contents correspond to the elements of `python-skeletons'.")
2049 (function (intern (concat "python-insert-" name)))) 2050 (function (intern (concat "python-insert-" name))))
2050 `(progn 2051 `(progn
2051 (add-to-list 'python-skeletons ',(cons name function)) 2052 (add-to-list 'python-skeletons ',(cons name function))
2052 (if python-use-skeletons 2053 (define-abbrev python-mode-abbrev-table ,name "" ',function
2053 (define-abbrev python-mode-abbrev-table ,name "" ',function nil t)) 2054 :system t :case-fixed t
2055 :enable-function (lambda () python-use-skeletons))
2054 (define-skeleton ,function 2056 (define-skeleton ,function
2055 ,(format "Insert Python \"%s\" template." name) 2057 ,(format "Insert Python \"%s\" template." name)
2056 ,@elements))))) 2058 ,@elements)))))
@@ -2205,23 +2207,6 @@ without confirmation."
2205 2207
2206(defvar outline-heading-end-regexp) 2208(defvar outline-heading-end-regexp)
2207(defvar eldoc-documentation-function) 2209(defvar eldoc-documentation-function)
2208
2209;; Stuff to allow expanding abbrevs with non-word constituents.
2210(defun python-abbrev-pc-hook ()
2211 "Set the syntax table before possibly expanding abbrevs."
2212 (remove-hook 'post-command-hook 'python-abbrev-pc-hook t)
2213 (set-syntax-table python-mode-syntax-table))
2214
2215(defvar python-abbrev-syntax-table
2216 (copy-syntax-table python-mode-syntax-table)
2217 "Syntax table used when expanding abbrevs.")
2218
2219(defun python-pea-hook ()
2220 "Reset the syntax table after possibly expanding abbrevs."
2221 (set-syntax-table python-abbrev-syntax-table)
2222 (add-hook 'post-command-hook 'python-abbrev-pc-hook nil t))
2223(modify-syntax-entry ?/ "w" python-abbrev-syntax-table)
2224
2225(defvar python-mode-running) ;Dynamically scoped var. 2210(defvar python-mode-running) ;Dynamically scoped var.
2226 2211
2227;;;###autoload 2212;;;###autoload
@@ -2309,7 +2294,6 @@ with skeleton expansions for compound statement templates.
2309 '((< '(backward-delete-char-untabify (min python-indent 2294 '((< '(backward-delete-char-untabify (min python-indent
2310 (current-column)))) 2295 (current-column))))
2311 (^ '(- (1+ (current-indentation)))))) 2296 (^ '(- (1+ (current-indentation))))))
2312 (add-hook 'pre-abbrev-expand-hook 'python-pea-hook nil t)
2313 (if (featurep 'hippie-exp) 2297 (if (featurep 'hippie-exp)
2314 (set (make-local-variable 'hippie-expand-try-functions-list) 2298 (set (make-local-variable 'hippie-expand-try-functions-list)
2315 (cons 'python-try-complete hippie-expand-try-functions-list))) 2299 (cons 'python-try-complete hippie-expand-try-functions-list)))