.emacs-my
changeset 1766 407c95f4887f
parent 1765 5cabf87dd450
child 1767 fd3589f24170
--- 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"))