Skip to content

Commit 56bd2ed

Browse files
committed
(py-shell-hook): A new hook variable, run at the end of py-shell.
Allows for some customization of the underlying comint buffer. (py-shell): Call the new hook. (info-lookup-maybe-add-help): A new call suggested by Milan Zamazal to make lookups in the Info documentation easier.
1 parent 65300f1 commit 56bd2ed

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Misc/python-mode.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ Currently-active file is at the head of the list.")
469469
(defvar python-mode-hook nil
470470
"*Hook called by `python-mode'.")
471471

472+
(defvar py-shell-hook nil
473+
"*Hook called by `py-shell'.")
474+
472475
;; In previous version of python-mode.el, the hook was incorrectly
473476
;; called py-mode-hook, and was not defvar'd. Deprecate its use.
474477
(and (fboundp 'make-obsolete-variable)
@@ -1336,6 +1339,7 @@ filter."
13361339
(setq py-pdbtrack-do-tracking-p t)
13371340
(set-syntax-table py-mode-syntax-table)
13381341
(use-local-map py-shell-map)
1342+
(run-hooks 'py-shell-hook)
13391343
))
13401344

13411345
(defun py-clear-queue ()
@@ -2996,6 +3000,16 @@ Obscure: When python-mode is first loaded, it looks for all bindings
29963000
to newline-and-indent in the global keymap, and shadows them with
29973001
local bindings to py-newline-and-indent."))
29983002

3003+
(require 'info-look)
3004+
(info-lookup-maybe-add-help
3005+
:mode 'python-mode
3006+
:regexp "[a-zA-Z0-9_]+"
3007+
:doc-spec '(("(python-lib)Module Index")
3008+
("(python-lib)Class-Exception-Object Index")
3009+
("(python-lib)Function-Method-Variable Index")
3010+
("(python-lib)Miscellaneous Index")))
3011+
3012+
29993013

30003014
;; Helper functions
30013015
(defvar py-parse-state-re

0 commit comments

Comments
 (0)