# HG changeset patch # User Oleksandr Gavenko # Date 1611614291 -7200 # Node ID 84c30e639991efba3c20530b8a77dfd8d3a6bbad # Parent 26b2fc3886f957fa2dd5335f7067d64082c2247d Unwrap Python's dir() list into multi line text. diff -r 26b2fc3886f9 -r 84c30e639991 .emacs-my --- a/.emacs-my Mon Jan 25 10:55:00 2021 +0200 +++ b/.emacs-my Tue Jan 26 00:38:11 2021 +0200 @@ -3071,15 +3071,21 @@ (setq python-indent-offset 4) (defun my-python/describe-at-point (symbol process prefix) - "Show full docs for symbol at point." + "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)) (let ( (cmd (cond ((eq 1 prefix) (concat "type(" symbol ")\n")) - ((eq 2 prefix) (concat "vars(" symbol ")\n")) - ((eq 3 prefix) (concat "repr(" symbol ")\n")) + ((eq 2 prefix) (concat "repr(" symbol ")\n")) + ((eq 3 prefix) (concat "print('\\n'.join(dir(" symbol ")))\n")) + ((eq 4 prefix) (concat "vars(" symbol ")\n")) ((not prefix) (concat "help('" symbol "')\n")) (t (concat "dir(" symbol ")\n")))) ) (switch-to-buffer (get-buffer-create (format "*pydoc: %s*" symbol)))