Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a67bb7e

Browse files
committed
python-mode-hook instead of py-mode-hook
1 parent f34cadd commit a67bb7e

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

Misc/python-mode-old.el

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; Major mode for editing Python programs, version 1.09
1+
;;; Major mode for editing Python programs, version 1.10
22
;; by: Tim Peters <[email protected]>
33
;; after an original idea by: Michael A. Guravage
44
;;
@@ -128,6 +128,12 @@ Currently-active file is at the head of the list.")
128128
(setq py-inherited-kill-emacs-hook kill-emacs-hook)
129129
(setq kill-emacs-hook 'py-kill-emacs-hook)))
130130

131+
(defvar python-mode-hook nil
132+
"*Hook called by `python-mode'.")
133+
134+
(and (fboundp 'make-obsolete-variable)
135+
(make-obsolete-variable 'py-mode-hook 'python-mode-hook))
136+
131137
(defvar py-beep-if-tab-change t
132138
"*Ring the bell if tab-width is changed.
133139
If a comment of the form
@@ -273,7 +279,9 @@ py-beep-if-tab-change\tring the bell if tab-width is changed"
273279
(if py-beep-if-tab-change (beep)))))
274280
(goto-char start))
275281

276-
(run-hooks 'py-mode-hook))
282+
(if python-mode-hook
283+
(run-hooks 'python-mode-hook)
284+
(run-hooks 'py-mode-hook)))
277285

278286
;;; Functions that execute Python commands in a subprocess
279287

@@ -1409,8 +1417,9 @@ CONTROL), press and release `n' (while still holding down CONTROL), &
14091417
then release CONTROL.
14101418
14111419
Entering Python mode calls with no arguments the value of the variable
1412-
`py-mode-hook', if that value exists and is not nil; see the `Hooks'
1413-
section of the Elisp manual for details.
1420+
`python-mode-hook', if that value exists and is not nil; for backward
1421+
compatibility it also tries `py-mode-hook'; see the `Hooks' section of
1422+
the Elisp manual for details.
14141423
14151424
Obscure: When python-mode is first loaded, it looks for all bindings
14161425
to newline-and-indent in the global keymap, and shadows them with

0 commit comments

Comments
 (0)