comparison lisp/progmodes/python.el @ 83545:034f67f59091

Merged from emacs@sv.gnu.org. Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-479 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-480 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-481 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-482 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-483 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-484 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-485 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-153 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-154 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-155 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-585
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 03 Dec 2006 12:25:18 +0000
parents 664e876d97fd
children 871131fc9087 7eeafaaa9eab
comparison
equal deleted inserted replaced
83544:58cf725f5330 83545:034f67f59091
1967 (eval-after-load "ffap" 1967 (eval-after-load "ffap"
1968 '(push '(python-mode . python-module-path) ffap-alist)) 1968 '(push '(python-mode . python-module-path) ffap-alist))
1969 1969
1970 ;;;; Skeletons 1970 ;;;; Skeletons
1971 1971
1972 (defcustom python-use-skeletons nil
1973 "Non-nil means template skeletons will be automagically inserted.
1974 This happens when pressing \"if<SPACE>\", for example, to prompt for
1975 the if condition."
1976 :type 'boolean
1977 :group 'python)
1978
1972 (defvar python-skeletons nil 1979 (defvar python-skeletons nil
1973 "Alist of named skeletons for Python mode. 1980 "Alist of named skeletons for Python mode.
1974 Elements are of the form (NAME . EXPANDER-FUNCTION).") 1981 Elements are of the form (NAME . EXPANDER-FUNCTION).")
1975 1982
1976 (defvar python-mode-abbrev-table nil 1983 (defvar python-mode-abbrev-table nil
1984 (defmacro def-python-skeleton (name &rest elements) 1991 (defmacro def-python-skeleton (name &rest elements)
1985 (let* ((name (symbol-name name)) 1992 (let* ((name (symbol-name name))
1986 (function (intern (concat "python-insert-" name)))) 1993 (function (intern (concat "python-insert-" name))))
1987 `(progn 1994 `(progn
1988 (add-to-list 'python-skeletons ',(cons name function)) 1995 (add-to-list 'python-skeletons ',(cons name function))
1989 (define-abbrev python-mode-abbrev-table ,name "" ',function nil t) 1996 (if python-use-skeletons
1997 (define-abbrev python-mode-abbrev-table ,name "" ',function nil t))
1990 (define-skeleton ,function 1998 (define-skeleton ,function
1991 ,(format "Insert Python \"%s\" template." name) 1999 ,(format "Insert Python \"%s\" template." name)
1992 ,@elements))))) 2000 ,@elements)))))
1993 (put 'def-python-skeleton 'lisp-indent-function 2) 2001 (put 'def-python-skeleton 'lisp-indent-function 2)
1994 2002