3162 (put 'python-shell-process-environment 'safe-local-variable 'listp) |
3162 (put 'python-shell-process-environment 'safe-local-variable 'listp) |
3163 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python")) |
3163 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python")) |
3164 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python2")) |
3164 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python2")) |
3165 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python3")) |
3165 (add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python3")) |
3166 |
3166 |
3167 (defun my-python/describe-at-point (symbol process prefix) |
3167 (defvar my-python/describe-at-point-history nil) |
|
3168 |
|
3169 (defun my-python/describe-at-point (symbol prefix process) |
3168 "Show full docs for symbol at point using Python's help() built-in. |
3170 "Show full docs for symbol at point using Python's help() built-in. |
3169 |
3171 |
3170 With argument 1 uses Python's type() built-in. |
3172 With argument 1 uses Python's type() built-in. |
3171 With argument 2 uses Python's repr() built-in. |
3173 With argument 2 uses Python's repr() built-in. |
3172 With argument 1 uses Python's dir() built-in. |
3174 With argument 3 uses Python's dir() built-in. |
3173 With argument 1 uses Python's vars() built-in." |
3175 With argument 4 uses Python's vars() built-in. |
3174 (interactive (list (python-info-current-symbol) |
3176 |
3175 (python-shell-get-process) |
3177 With C-u argument ask for symbol and method." |
3176 current-prefix-arg)) |
3178 (interactive |
|
3179 (let ((prefix |
|
3180 (if (and current-prefix-arg (listp current-prefix-arg)) |
|
3181 (plist-get '(?h nil ?t 1 ?r 2 ?d 3 ?v 4) |
|
3182 (car (read-multiple-choice "Mode" '((?h "help") (?t "type") (?r "repr") (?d "dir") (?v "vars"))))) |
|
3183 current-prefix-arg)) |
|
3184 (symbol |
|
3185 (if (and current-prefix-arg (listp current-prefix-arg)) |
|
3186 (read-string "EXPR: " (python-info-current-symbol) 'my-python/describe-at-point-history) |
|
3187 (python-info-current-symbol)))) |
|
3188 (list symbol prefix (python-shell-get-process)))) |
3177 (let ( (cmd |
3189 (let ( (cmd |
3178 (cond |
3190 (cond |
3179 ((eq 1 prefix) (concat "help(type(" symbol "))\n")) |
3191 ((eq 1 prefix) (concat "help(type(" symbol "))\n")) |
3180 ((eq 2 prefix) (concat "repr(" symbol ")\n")) |
3192 ((eq 2 prefix) (concat "repr(" symbol ")\n")) |
3181 ((eq 3 prefix) (concat "print('\\n'.join(dir(" symbol ")))\n")) |
3193 ((eq 3 prefix) (concat "print('\\n'.join(dir(" symbol ")))\n")) |