# HG changeset patch # User Oleksandr Gavenko # Date 1611564900 -7200 # Node ID 26b2fc3886f957fa2dd5335f7067d64082c2247d # Parent 3ed88879232f89920eddfa1e89f12ed06e4c2995 Added other types of introspection to my-python/describe-at-point. diff -r 3ed88879232f -r 26b2fc3886f9 .emacs-my --- a/.emacs-my Mon Jan 18 17:07:56 2021 +0200 +++ b/.emacs-my Mon Jan 25 10:55:00 2021 +0200 @@ -3070,11 +3070,18 @@ (setq python-indent-offset 4) -(defun my-python/describe-at-point (symbol process) +(defun my-python/describe-at-point (symbol process prefix) "Show full docs for symbol at point." (interactive (list (python-info-current-symbol) - (python-shell-get-process))) - (let ( (cmd (concat "help('" symbol "')\n")) ) + (python-shell-get-process) + current-prefix-arg)) + (let ( (cmd + (cond + ((eq 1 prefix) (concat "type(" symbol ")\n")) + ((eq 2 prefix) (concat "vars(" symbol ")\n")) + ((eq 3 prefix) (concat "repr(" symbol ")\n")) + ((not prefix) (concat "help('" symbol "')\n")) + (t (concat "dir(" symbol ")\n")))) ) (switch-to-buffer (get-buffer-create (format "*pydoc: %s*" symbol))) (fundamental-mode) (read-only-mode -1)