Subject: bug#17683: 24.4.50; [PATCH] Missing char in Python class skeleton

From: Matthias Meulien <[email-masked]>
Date: Tue, 03 Jun 2014 22:04:30 +0200

When inserting a class skeleton in python mode (C-c C-t c) and
entering an empty value at the inheritance prompt, the last character of
the class name is deleted.

To reproduce, start emacs with the -Q switch; Then press:

C-x h C-w M-x p y t h o n SPC m o d <tab> <return> 
C-c C-t c T e s t <return> <return> <menu> r e p o 
r <tab> <return>

Here is a patch to fix that problem:

>From 81552cf6913d93caf47c0c1b7863af214cb447b1 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <[email-masked]>
Date: Tue, 3 Jun 2014 21:59:59 +0200
Subject: [PATCH] python.el: Fix missing char while inserting class skeleton

---
 lisp/progmodes/python.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 436442d..ef433eb 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2983,7 +2983,7 @@ The skeleton will be bound to python-skeleton-NAME."
   "class " str "(" ("Inheritance, %s: "
                     (unless (equal ?\( (char-before)) ", ")
                     str)
-  & ")" | -2
+  & ")" | -1
   ":" \n
   "\"\"\"" - "\"\"\"" \n
   > _ \n)
-- 
1.9.3

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: Python

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: 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
  transient-mark-mode: t

Recent input:
C-x h C-w M-x p y t h o n SPC m o d <tab> <return> 
C-c C-t c T e s t <return> <return> <menu> r e p o 
r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [2 times]
Can't guess python-indent-offset, using defaults: 4

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils skeleton python easymenu comint
ring ansi-color 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 80329 5956)
 (symbols 48 18657 0)
 (miscs 40 41 99)
 (strings 32 12365 4964)
 (string-bytes 1 352743)
 (vectors 16 10184)
 (vector-slots 8 387772 4257)
 (floats 8 69 289)
 (intervals 56 194 0)
 (buffers 960 11)
 (heap 1024 34297 1140))