summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-04-16 13:28:11 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-04-16 13:28:11 -0400
commit351edece98dcafbfa9237ffc07a63b181877d6ac (patch)
tree6d235b0c39ec355fa4698f491b8964378df74336 /lisp/progmodes/python.el
parent613f948181f88d8180f136c73cdfd8d811329452 (diff)
downloademacs-351edece98dcafbfa9237ffc07a63b181877d6ac.tar.gz
* lisp/progmodes/python.el (python-mode-skeleton-abbrev-table): Rename from
python-mode-abbrev-table. (python-skeleton-define): Adjust accordingly. (python-mode-abbrev-table): New table that inherits from it so that python-skeleton-autoinsert does not affect non-skeleton abbrevs. * lisp/abbrev.el (abbrev--symbol): New function, extracted from abbrev-symbol. (abbrev-symbol): Use it. (abbrev--before-point): Use it since we already handle inheritance.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index d1009534e49..fde7fadd061 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2654,8 +2654,8 @@ the if condition."
(defvar python-skeleton-available '()
"Internal list of available skeletons.")
-(define-abbrev-table 'python-mode-abbrev-table ()
- "Abbrev table for Python mode."
+(define-abbrev-table 'python-mode-skeleton-abbrev-table ()
+ "Abbrev table for Python mode skeletons."
:case-fixed t
;; Allow / inside abbrevs.
:regexp "\\(?:^\\|[^/]\\)\\<\\([[:word:]/]+\\)\\W*"
@@ -2668,13 +2668,13 @@ the if condition."
(defmacro python-skeleton-define (name doc &rest skel)
"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'."
+be added to `python-mode-skeleton-abbrev-table'."
(declare (indent 2))
(let* ((name (symbol-name name))
(function-name (intern (concat "python-skeleton-" name))))
`(progn
- (define-abbrev python-mode-abbrev-table ,name "" ',function-name
- :system t)
+ (define-abbrev python-mode-skeleton-abbrev-table
+ ,name "" ',function-name :system t)
(setq python-skeleton-available
(cons ',function-name python-skeleton-available))
(define-skeleton ,function-name
@@ -2682,6 +2682,10 @@ be added to `python-mode-abbrev-table'."
(format "Insert %s statement." name))
,@skel))))
+(define-abbrev-table 'python-mode-abbrev-table ()
+ "Abbrev table for Python mode."
+ :parents (list python-mode-skeleton-abbrev-table))
+
(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."