# HG changeset patch # User Oleksandr Gavenko # Date 1670971902 -7200 # Node ID 407c95f4887fbce1a4217b6250791bd6e6cc7d88 # Parent 5cabf87dd450042f95ab9fdeb35f460011c13fb3 my-python/describe-at-point: With C-u argument ask for symbol and method. diff -r 5cabf87dd450 -r 407c95f4887f .emacs-my --- a/.emacs-my Sat Dec 10 18:34:57 2022 +0200 +++ b/.emacs-my Wed Dec 14 00:51:42 2022 +0200 @@ -3164,16 +3164,28 @@ (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python2")) (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python3")) -(defun my-python/describe-at-point (symbol process prefix) +(defvar my-python/describe-at-point-history nil) + +(defun my-python/describe-at-point (symbol prefix process) "Show full docs for symbol at point using Python's help() built-in. With argument 1 uses Python's type() built-in. With argument 2 uses Python's repr() built-in. -With argument 1 uses Python's dir() built-in. -With argument 1 uses Python's vars() built-in." - (interactive (list (python-info-current-symbol) - (python-shell-get-process) - current-prefix-arg)) +With argument 3 uses Python's dir() built-in. +With argument 4 uses Python's vars() built-in. + +With C-u argument ask for symbol and method." + (interactive + (let ((prefix + (if (and current-prefix-arg (listp current-prefix-arg)) + (plist-get '(?h nil ?t 1 ?r 2 ?d 3 ?v 4) + (car (read-multiple-choice "Mode" '((?h "help") (?t "type") (?r "repr") (?d "dir") (?v "vars"))))) + current-prefix-arg)) + (symbol + (if (and current-prefix-arg (listp current-prefix-arg)) + (read-string "EXPR: " (python-info-current-symbol) 'my-python/describe-at-point-history) + (python-info-current-symbol)))) + (list symbol prefix (python-shell-get-process)))) (let ( (cmd (cond ((eq 1 prefix) (concat "help(type(" symbol "))\n"))