bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2238: Acknowledgement (23.0.90; [PATCH] Regression in python.el)


From: Stefan Monnier
Subject: bug#2238: Acknowledgement (23.0.90; [PATCH] Regression in python.el)
Date: Sun, 08 Feb 2009 19:32:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Forgot to attach the patch, here it is.

How 'bout this patch instead?  The main advantage is that it will
correctly react to changes to python-use-skeletons without having to
reload the mode.  The main disadvantage is that it will control all
abbrev expansions, not just the skeleton ones.


        Stefan


--- python.el.~1.93.~   2009-02-07 11:23:02.000000000 -0500
+++ python.el   2009-02-08 19:30:38.000000000 -0500
@@ -2205,13 +2205,21 @@
 
 ;;;; Skeletons
 
+(defcustom python-use-skeletons nil
+  "Non-nil means template skeletons will be automagically inserted.
+This happens when pressing \"if<SPACE>\", for example, to prompt for
+the if condition."
+  :type 'boolean
+  :group 'python)
+
 (define-abbrev-table 'python-mode-abbrev-table ()
   "Abbrev table for Python mode."
   :case-fixed t
   ;; Allow / inside abbrevs.
   :regexp "\\(?:^\\|[^/]\\)\\<\\([[:word:]/]+\\)\\W*"
   ;; Only expand in code.
-  :enable-function (lambda () (not (python-in-string/comment))))
+  :enable-function (lambda () (and python-use-skeletons
+                              (not (python-in-string/comment)))))
 
 (eval-when-compile
   ;; Define a user-level skeleton and add it to the abbrev table.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]