diff options
| author | Matthias Meulien | 2014-06-11 22:35:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-06-11 22:35:26 -0400 |
| commit | c77f4a90b27fc1a8db698480ad4e93f3869a4ced (patch) | |
| tree | 22fd151e4853f66cc1aa50a6a0d84772603598a9 | |
| parent | 7c35a922517c140ee7f260e50f01ed291d839178 (diff) | |
| download | emacs-c77f4a90b27fc1a8db698480ad4e93f3869a4ced.tar.gz emacs-c77f4a90b27fc1a8db698480ad4e93f3869a4ced.zip | |
* lisp/progmodes/python.el (import skeleton): New skeleton.
(python-mode-map): Bind it.
Fixes: debbugs:17672
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 17 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 618c05ee5ef..9d91fd3b2f3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -6,6 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | 2014-06-12 Matthias Meulien <orontee@gmail.com> | 7 | 2014-06-12 Matthias Meulien <orontee@gmail.com> |
| 8 | 8 | ||
| 9 | * progmodes/python.el (import skeleton): New skeleton (bug#17672). | ||
| 10 | (python-mode-map): Bind it. | ||
| 11 | |||
| 9 | * progmodes/python.el (class skeleton): Don't erase last char of class | 12 | * progmodes/python.el (class skeleton): Don't erase last char of class |
| 10 | name (bug#17683). | 13 | name (bug#17683). |
| 11 | 14 | ||
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3a913a31193..91a85526420 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -155,15 +155,13 @@ | |||
| 155 | ;; the shell completion in background so you should run | 155 | ;; the shell completion in background so you should run |
| 156 | ;; `python-shell-send-buffer' from time to time to get better results. | 156 | ;; `python-shell-send-buffer' from time to time to get better results. |
| 157 | 157 | ||
| 158 | ;; Skeletons: 6 skeletons are provided for simple inserting of class, | 158 | ;; Skeletons: skeletons are provided for simple inserting of things like class, |
| 159 | ;; def, for, if, try and while. These skeletons are integrated with | 159 | ;; def, for, import, if, try, and while. These skeletons are |
| 160 | ;; abbrev. If you have `abbrev-mode' activated and | 160 | ;; integrated with abbrev. If you have `abbrev-mode' activated and |
| 161 | ;; `python-skeleton-autoinsert' is set to t, then whenever you type | 161 | ;; `python-skeleton-autoinsert' is set to t, then whenever you type |
| 162 | ;; the name of any of those defined and hit SPC, they will be | 162 | ;; the name of any of those defined and hit SPC, they will be |
| 163 | ;; automatically expanded. As an alternative you can use the defined | 163 | ;; automatically expanded. As an alternative you can use the defined |
| 164 | ;; skeleton commands: `python-skeleton-class', `python-skeleton-def' | 164 | ;; skeleton commands: `python-skeleton-<foo>'. |
| 165 | ;; `python-skeleton-for', `python-skeleton-if', `python-skeleton-try' | ||
| 166 | ;; and `python-skeleton-while'. | ||
| 167 | 165 | ||
| 168 | ;; FFAP: You can find the filename for a given module when using ffap | 166 | ;; FFAP: You can find the filename for a given module when using ffap |
| 169 | ;; out of the box. This feature needs an inferior python shell | 167 | ;; out of the box. This feature needs an inferior python shell |
| @@ -253,6 +251,7 @@ | |||
| 253 | (define-key map "\C-c\C-td" 'python-skeleton-def) | 251 | (define-key map "\C-c\C-td" 'python-skeleton-def) |
| 254 | (define-key map "\C-c\C-tf" 'python-skeleton-for) | 252 | (define-key map "\C-c\C-tf" 'python-skeleton-for) |
| 255 | (define-key map "\C-c\C-ti" 'python-skeleton-if) | 253 | (define-key map "\C-c\C-ti" 'python-skeleton-if) |
| 254 | (define-key map "\C-c\C-tm" 'python-skeleton-import) | ||
| 256 | (define-key map "\C-c\C-tt" 'python-skeleton-try) | 255 | (define-key map "\C-c\C-tt" 'python-skeleton-try) |
| 257 | (define-key map "\C-c\C-tw" 'python-skeleton-while) | 256 | (define-key map "\C-c\C-tw" 'python-skeleton-while) |
| 258 | ;; Shell interaction | 257 | ;; Shell interaction |
| @@ -2957,6 +2956,12 @@ The skeleton will be bound to python-skeleton-NAME." | |||
| 2957 | > _ \n | 2956 | > _ \n |
| 2958 | '(python-skeleton--else) | ^) | 2957 | '(python-skeleton--else) | ^) |
| 2959 | 2958 | ||
| 2959 | (python-skeleton-define import nil | ||
| 2960 | "Import from module: " | ||
| 2961 | "from " str & " " | -5 | ||
| 2962 | "import " | ||
| 2963 | ("Identifier: " str ", ") -2 \n _) | ||
| 2964 | |||
| 2960 | (python-skeleton-define try nil | 2965 | (python-skeleton-define try nil |
| 2961 | nil | 2966 | nil |
| 2962 | "try:" \n | 2967 | "try:" \n |