From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.bugs Subject: bug#17672: 24.4.50; [PATCH] python.el: Skeleton to insert import statements Date: Mon, 02 Jun 2014 23:02:31 +0200 Message-ID: <8738fnc9eg.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1401743001 26598 80.91.229.3 (2 Jun 2014 21:03:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2014 21:03:21 +0000 (UTC) To: 17672@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 02 23:03:15 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WrZNz-00008Z-1t for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jun 2014 23:03:15 +0200 Original-Received: from localhost ([::1]:49281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNy-0000XM-3m for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jun 2014 17:03:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNs-0000Vj-I2 for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:03:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrZNn-0006sV-0X for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:03:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNm-0006sN-Tf for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WrZNm-0002nP-ES for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Jun 2014 21:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17672 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.140174297110726 (code B ref -1); Mon, 02 Jun 2014 21:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jun 2014 21:02:51 +0000 Original-Received: from localhost ([127.0.0.1]:41347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WrZNa-0002mv-08 for submit@debbugs.gnu.org; Mon, 02 Jun 2014 17:02:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39394) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WrZNX-0002ma-Eg for submit@debbugs.gnu.org; Mon, 02 Jun 2014 17:02:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrZNQ-0006ne-H9 for submit@debbugs.gnu.org; Mon, 02 Jun 2014 17:02:42 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNQ-0006na-E7 for submit@debbugs.gnu.org; Mon, 02 Jun 2014 17:02:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNN-0000RS-T2 for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:02:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrZNM-0006my-1N for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:02:37 -0400 Original-Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:33680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrZNL-0006mk-Lu for bug-gnu-emacs@gnu.org; Mon, 02 Jun 2014 17:02:35 -0400 Original-Received: by mail-wi0-f177.google.com with SMTP id f8so5422949wiw.4 for ; Mon, 02 Jun 2014 14:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=e4xE22vZ64s+Pz25eVM7qnaTky9NAtgqNujEyVZJFW4=; b=fd7ad018B4hXDQpIJDUB0M9lU1bfFcPArPo9MAjwhzC4snt0BvWNmTsIwBfizxCKd1 PVOvLLI8LK9d/VUru+yV9vE08GQwpLN9ug7EveDeGNR/hvF6UI9gfwtRppU70aA/9oYJ 3TU+1BW0Pc2UvK8ewbS+st9ECxQ7MGKsjc/B+zej3Hz/6gBbChXxVIR/adDqUw8zFMVt De22FgflOX93PSphs5IFpFrBFyrhY//p/vCZm/rsD1PhJ5vwLgQAWWPKbhpB0h+ECYt1 24QxECvBf0bHcsF94uQHPJ0LbXWZ+cABfwlzptw8KUo7P//9/cfjKPBix88YAZ/D81yG OJDQ== X-Received: by 10.180.107.130 with SMTP id hc2mr25550975wib.7.1401742953761; Mon, 02 Jun 2014 14:02:33 -0700 (PDT) Original-Received: from choubidou.localdomain ([2a01:e35:2ef1:4540:e2b9:a5ff:fe0b:e998]) by mx.google.com with ESMTPSA id qq5sm35610459wic.10.2014.06.02.14.02.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jun 2014 14:02:32 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89915 Archived-At: --=-=-= Content-Type: text/plain; format=flowed The attach patch defines a skeleton to insert import statements in Python mode. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-python.el-Skeleton-to-insert-import-statements.patch Content-Description: python.el: Skeleton to insert import statement >From 2342a864c8787f59039978196501a007ddb13e5c Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Mon, 2 Jun 2014 22:37:07 +0200 Subject: [PATCH] python.el: Skeleton to insert import statements --- lisp/progmodes/python.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 436442d..3d4d5a1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -155,15 +155,16 @@ ;; the shell completion in background so you should run ;; `python-shell-send-buffer' from time to time to get better results. -;; Skeletons: 6 skeletons are provided for simple inserting of class, -;; def, for, if, try and while. These skeletons are integrated with -;; abbrev. If you have `abbrev-mode' activated and +;; Skeletons: 7 skeletons are provided for simple inserting of class, +;; def, for, import, if, try and while. These skeletons are +;; integrated with abbrev. If you have `abbrev-mode' activated and ;; `python-skeleton-autoinsert' is set to t, then whenever you type ;; the name of any of those defined and hit SPC, they will be ;; automatically expanded. As an alternative you can use the defined ;; skeleton commands: `python-skeleton-class', `python-skeleton-def' -;; `python-skeleton-for', `python-skeleton-if', `python-skeleton-try' -;; and `python-skeleton-while'. +;; `python-skeleton-for', `python-skeleton-import', +;; `python-skeleton-if', `python-skeleton-try' and +;; `python-skeleton-while'. ;; FFAP: You can find the filename for a given module when using ffap ;; out of the box. This feature needs an inferior python shell @@ -253,6 +254,7 @@ (define-key map "\C-c\C-td" 'python-skeleton-def) (define-key map "\C-c\C-tf" 'python-skeleton-for) (define-key map "\C-c\C-ti" 'python-skeleton-if) + (define-key map "\C-c\C-tm" 'python-skeleton-import) (define-key map "\C-c\C-tt" 'python-skeleton-try) (define-key map "\C-c\C-tw" 'python-skeleton-while) ;; Shell interaction @@ -2957,6 +2959,12 @@ The skeleton will be bound to python-skeleton-NAME." > _ \n '(python-skeleton--else) | ^) +(python-skeleton-define import nil + "Import from module: " + "from " str & " " | -5 + "import " + ("Identifier: " str ", ") -2 \n _) + (python-skeleton-define try nil nil "try:" \n -- 1.9.3 --=-=-= Content-Type: text/plain In GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2) of 2014-05-27 on choubidou Windowing system distributor `The X.Org Foundation', version 11.0.11501000 Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB Important settings: value of $LC_COLLATE: C value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix Major mode: Org Minor modes in effect: diff-auto-refine-mode: t flyspell-mode: t shell-dirtrack-mode: t show-paren-mode: t global-auto-complete-mode: t global-semantic-mru-bookmark-mode: t global-semanticdb-minor-mode: t global-semantic-idle-scheduler-mode: t semantic-mode: t desktop-save-mode: t auto-image-file-mode: t electric-pair-mode: t icomplete-mode: t global-auto-revert-mode: t auto-insert-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t use-hard-newlines: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t auto-fill-function: org-auto-fill-function transient-mark-mode: t Recent input: e m e n t s M-p M-p M-p M-p C-b C-b C-b C-d C-x d g q M-p C-b C-b ~ C-x d g p p d x y C-v C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-e M-< C-_ C-_ C-x C-f C-x b p y t h C-s i m p o r t C-S-s C-s C-s C-s C-s C-s C-g C-x b s h e l l 3 C-x C-f 0 0 C-n C-n C-x b p y t h o n M-g g 2 9 5 7 C-e C-n C-n C-n C-n C-n C-n C-n C-e C-p C-e C-n C-n C-n C-e C-x C-s C-x b * s h < 3 M-p M-p M-p SPC - - a m e n d M-p M-p C-x C-f M-p g C-_ C-x k M-p M-p M-p M-p M-p M-p M-p M-n M-p M-p M-p M-p M-p M-p C-x b 0 0 C-x C-f 0 0 C-x C-f 0 0 1 C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p M-< C-x d C-x 2 C-x d p r o e m p a t g C-x o R M-p g C-x o C-x o g n C-x o C-x b p y t h o M-< C-n C-n C-n C-n M-f C-n C-n C-x o C-x o M-x r e p o r t SPC e m Recent messages: Omitting... (Nothing to omit) Omitting... (Nothing to omit) Move: 1 file Omitting... Omitted 7 lines. Omitting... Omitted 3 lines. Mark set Load-path shadows: None found. Features: (shadow sort mail-extr gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime password-cache dig mailcap gnus-sum emacsbug sendmail find-dired grep debug org-table org-id conf-mode diff-mode add-log log-view pcvs-util descr-text hl-line rect dabbrev bookmark tabify info-look pp derived pcase time-stamp semantic/edit diary-lib diary-loaddefs reftex-dcr reftex reftex-vars tex-mode warnings inversion semantic/bovine/c hideif semantic/bovine/c-by semantic/lex-spp semantic/bovine/gcc semantic/analyze/refs cwarn sh-script executable css-mode smie semantic/wisent/javascript-jv semantic/wisent/js-wy semantic/java semantic/doc cap-words superword subword js json imenu arc-mode archive-mode rst semantic/tag-write face-remap vc-dir ewoc vc vc-dispatcher generic eieio-opt help-mode misearch multi-isearch mule-util semantic/html sgml-mode semantic/bovine/make semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn semantic/bovine/make-by semantic/bovine make-mode dired-aux avoid flyspell ox-latex ox-icalendar ox-html ox-ascii ox-publish ox goto-addr org-element org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m vc-git semantic/tag-file semantic/db-file data-debug cedet-files semantic/wisent/python semantic/decorate/include semantic/db-find semantic/db-ref semantic/decorate/mode semantic/decorate pulse semantic/dep semantic/wisent/python-wy semantic/wisent semantic/wisent/wisent rx python ob-sh shell ob-plantuml paren choubidou-custom cus-edit cus-start cus-load gnus-demon nntp gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls utf7 netrc parse-time gnus-spec gnus-win nnoo gnus-int gnus-range message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus gnus-ems nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit gnus-dired dired-x dired org-capture org org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs dictionary link connection irfc url-vars flymake-csslint php-mode etags cc-langs speedbar sb-image dframe sql view thingatpt flymake-jslint flymake-python-pyflakes flymake-easy advice help-fns flymake compile comint hideshow skeleton find-file whitespace auto-complete edmacro kmacro cl-macs popup cl minimap semantic/mru-bookmark ring semantic/db-mode semantic/db gv eieio-base semantic/idle semantic/format ezimage semantic/tag-ls semantic/find semantic/ctxt semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local cedet ispell desktop frameset server woman man cl-loaddefs cl-lib ansi-color image-file tar-mode saveplace elec-pair icomplete windmove autorevert filenotify autoinsert cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs generic-x Django-doc-autoloads auto-complete-autoloads color-theme-solarized-autoloads doctags-autoloads flymake-csslint-autoloads flymake-jslint-autoloads flymake-easy-autoloads gist-autoloads finder-inf gh-autoloads eieio byte-opt bytecomp byte-compile cconv eieio-core info easymenu gnuplot-autoloads graphviz-dot-mode-autoloads htmlize-autoloads logito-autoloads php-mode-autoloads popup-autoloads symbols-mode-autoloads package time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 1100492 207925) (symbols 48 63889 0) (miscs 40 8990 837) (strings 32 406285 30443) (string-bytes 1 8349847) (vectors 16 64126) (vector-slots 8 1844234 141588) (floats 8 408 778) (intervals 56 43444 0) (buffers 960 239) (heap 1024 122508 19429)) --=-=-=--