diff options
| author | Stefan Monnier | 2013-04-16 13:28:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-04-16 13:28:11 -0400 |
| commit | 351edece98dcafbfa9237ffc07a63b181877d6ac (patch) | |
| tree | 6d235b0c39ec355fa4698f491b8964378df74336 /lisp/progmodes/python.el | |
| parent | 613f948181f88d8180f136c73cdfd8d811329452 (diff) | |
| download | emacs-351edece98dcafbfa9237ffc07a63b181877d6ac.tar.gz emacs-351edece98dcafbfa9237ffc07a63b181877d6ac.zip | |
* 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.el | 14 |
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." | |||
| 2654 | (defvar python-skeleton-available '() | 2654 | (defvar python-skeleton-available '() |
| 2655 | "Internal list of available skeletons.") | 2655 | "Internal list of available skeletons.") |
| 2656 | 2656 | ||
| 2657 | (define-abbrev-table 'python-mode-abbrev-table () | 2657 | (define-abbrev-table 'python-mode-skeleton-abbrev-table () |
| 2658 | "Abbrev table for Python mode." | 2658 | "Abbrev table for Python mode skeletons." |
| 2659 | :case-fixed t | 2659 | :case-fixed t |
| 2660 | ;; Allow / inside abbrevs. | 2660 | ;; Allow / inside abbrevs. |
| 2661 | :regexp "\\(?:^\\|[^/]\\)\\<\\([[:word:]/]+\\)\\W*" | 2661 | :regexp "\\(?:^\\|[^/]\\)\\<\\([[:word:]/]+\\)\\W*" |
| @@ -2668,13 +2668,13 @@ the if condition." | |||
| 2668 | (defmacro python-skeleton-define (name doc &rest skel) | 2668 | (defmacro python-skeleton-define (name doc &rest skel) |
| 2669 | "Define a `python-mode' skeleton using NAME DOC and SKEL. | 2669 | "Define a `python-mode' skeleton using NAME DOC and SKEL. |
| 2670 | The skeleton will be bound to python-skeleton-NAME and will | 2670 | The skeleton will be bound to python-skeleton-NAME and will |
| 2671 | be added to `python-mode-abbrev-table'." | 2671 | be added to `python-mode-skeleton-abbrev-table'." |
| 2672 | (declare (indent 2)) | 2672 | (declare (indent 2)) |
| 2673 | (let* ((name (symbol-name name)) | 2673 | (let* ((name (symbol-name name)) |
| 2674 | (function-name (intern (concat "python-skeleton-" name)))) | 2674 | (function-name (intern (concat "python-skeleton-" name)))) |
| 2675 | `(progn | 2675 | `(progn |
| 2676 | (define-abbrev python-mode-abbrev-table ,name "" ',function-name | 2676 | (define-abbrev python-mode-skeleton-abbrev-table |
| 2677 | :system t) | 2677 | ,name "" ',function-name :system t) |
| 2678 | (setq python-skeleton-available | 2678 | (setq python-skeleton-available |
| 2679 | (cons ',function-name python-skeleton-available)) | 2679 | (cons ',function-name python-skeleton-available)) |
| 2680 | (define-skeleton ,function-name | 2680 | (define-skeleton ,function-name |
| @@ -2682,6 +2682,10 @@ be added to `python-mode-abbrev-table'." | |||
| 2682 | (format "Insert %s statement." name)) | 2682 | (format "Insert %s statement." name)) |
| 2683 | ,@skel)))) | 2683 | ,@skel)))) |
| 2684 | 2684 | ||
| 2685 | (define-abbrev-table 'python-mode-abbrev-table () | ||
| 2686 | "Abbrev table for Python mode." | ||
| 2687 | :parents (list python-mode-skeleton-abbrev-table)) | ||
| 2688 | |||
| 2685 | (defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel) | 2689 | (defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel) |
| 2686 | "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL. | 2690 | "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL. |
| 2687 | The skeleton will be bound to python-skeleton-NAME." | 2691 | The skeleton will be bound to python-skeleton-NAME." |