GNU bug report logs - #22665
24.5; PROPOSAL: add full docs for symbol at point for Python mode along with existing one-line.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Oleksandr Gavenko <gavenkoa@HIDDEN>; dated Sun, 14 Feb 2016 18:04:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Feb 2016 18:03:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 14 13:03:04 2016
Received: from localhost ([127.0.0.1]:39029 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aV10h-0002I5-Py
	for submit <at> debbugs.gnu.org; Sun, 14 Feb 2016 13:03:04 -0500
Received: from eggs.gnu.org ([208.118.235.92]:51975)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10g-0002HL-5f
 for submit <at> debbugs.gnu.org; Sun, 14 Feb 2016 13:03:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10a-0003ak-6A
 for submit <at> debbugs.gnu.org; Sun, 14 Feb 2016 13:02:57 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51903)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10a-0003ag-3m
 for submit <at> debbugs.gnu.org; Sun, 14 Feb 2016 13:02:56 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42944)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10Y-0007fe-Vy
 for bug-gnu-emacs@HIDDEN; Sun, 14 Feb 2016 13:02:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10U-0003aD-0W
 for bug-gnu-emacs@HIDDEN; Sun, 14 Feb 2016 13:02:54 -0500
Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:35268)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gavenkoa@HIDDEN>) id 1aV10T-0003a2-Km
 for bug-gnu-emacs@HIDDEN; Sun, 14 Feb 2016 13:02:49 -0500
Received: by mail-lf0-x235.google.com with SMTP id l143so77238812lfe.2
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Feb 2016 10:02:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:subject:date:message-id:mime-version:content-type
 :content-transfer-encoding;
 bh=BnwGt92R3m+8DfZBiSSwep8cJZclflGvsYTKPsVp1Wo=;
 b=vvlXtXJUFv5kvzo8XYdDJA34/XKPPCSwiQSri1wio443XEEaLa6DUtaJCq6e836vuc
 Qf1/WRiJnNtfavkie+lluGZ1hQjvSkBSK/9DKuuk+gYOeOiviGGOojYeGB7HwHq7MR93
 0y7wL6Qmbst7XRceAuQEaXZfiGVOc4osxzkdllF3eLkG9qaTHTnztEJJcwvs4rf3vxz4
 6yYYubXYvWdOESA9KCLc6ycknthhZLNeq6vWRskNTQ4L6bltjO129nSKoAwToVe+W3sY
 zRv/mcakEbHPMrHs55B9OLc+A3AdF28Z8DJiCzxsmTspwZNCPrLwtVyWyPsoCFSwzqXF
 nEYg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-type:content-transfer-encoding;
 bh=BnwGt92R3m+8DfZBiSSwep8cJZclflGvsYTKPsVp1Wo=;
 b=lqW//yYBSaQgI6Hx77ev4rCsxEgFxFL+EKQcWyw0NzwyG1TkUZLoJ47OteTR51ZZ2f
 fxl5Ke61VHbShYSRWgD0b1Ki7gwDqS2aI9ICfK4qBg0FY3fnw2k/mItWzB39tVxbPn0k
 6m3y/rK44TMurNHudaEVtFygIAfbHfYCOZvuklKHjBvBLONulFiIg+KT0NZAjgTXSI7X
 z2OtyVQw5J+dZ10DR8KE/xrSEFPLw+S1sc44vMuWtU3Sp9qUqtawj4zbLr2AjqjOQXts
 8X6fLXrQ7PJBUr7yHMVjQeAq05cs7EIQMw4n1Huf4wY/GbDC8A59eDxn1OWbHkEDO2g3
 3NAQ==
X-Gm-Message-State: AG10YOSiacffgpjlQaV+1ISGZNSsW+E46+JxYVlJJkmJN7QXUEcTssoNEigecNFKyxZe8w==
X-Received: by 10.25.16.196 with SMTP id 65mr4053488lfq.21.1455472968575;
 Sun, 14 Feb 2016 10:02:48 -0800 (PST)
Received: from desktop ([46.118.53.144])
 by smtp.gmail.com with ESMTPSA id l129sm3202932lfl.18.2016.02.14.10.02.45
 for <bug-gnu-emacs@HIDDEN> (version=TLSv1/SSLv3 cipher=OTHER);
 Sun, 14 Feb 2016 10:02:45 -0800 (PST)
From: Oleksandr Gavenko <gavenkoa@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.5;
 PROPOSAL: add full docs for symbol at point for Python mode along
 with existing one-line.
Date: Sun, 14 Feb 2016 20:02:44 +0200
Message-ID: <871t8fp3uj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

`python-eldoc-setup-code' from lisp/progmodes/python.el have:

        else:
            doc =3D doc.splitlines()[0]

This line from changes:

  commit 15cc40b8199735e600ddf718b936917ff4d79db0
  Author: Fabi=C3=A1n Ezequiel Gallina <fgallina@cuca>
  Date:   2012-05-17 00:03:18 -0300

    Fixed eldoc behavior.
=20=20=20=20
          * python-eldoc-setup-code: The code to get help now uses the
            inspect element. When an object doesn't have documentation and
            if it is callable it returns the signature for it. Also when
            an object does contain documentation it only returns the first
            line.

***Also when an object does contain documentation it only returns the first
   line.***

Current code uses `message' to display docs. Previous uses
`with-output-to-temp-buffer'.

In some situation I want to see full docs.

I don't use Python regularly and professionally so one line explanation is =
not
helpful at all.

Please add alternative function to display full doc in separate buffer (if
text is longer then one line??).

It can be done on same key binding but require command prefix.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

I made dirty hack to my .emacs based on latest sources, but I like to use
official solution (the difference is that I strip ".splitlines()[0]"):

(defvar my/python-eldoc-setup-code
  "def __PYDOC_get_full_help(obj):
    try:
        import inspect
        try:
            str_type =3D basestring
        except NameError:
            str_type =3D str
        if isinstance(obj, str_type):
            obj =3D eval(obj, globals())
        doc =3D inspect.getdoc(obj)
        if not doc and callable(obj):
            target =3D None
            if inspect.isclass(obj) and hasattr(obj, '__init__'):
                target =3D obj.__init__
                objtype =3D 'class'
            else:
                target =3D obj
                objtype =3D 'def'
            if target:
                args =3D inspect.formatargspec(
                    *inspect.getargspec(target)
                )
                name =3D obj.__name__
                doc =3D '{objtype} {name}{args}'.format(
                    objtype=3Dobjtype, name=3Dname, args=3Dargs
                )
    except:
        doc =3D ''
    return doc"
  "Python code to setup documentation retrieval.")

(defvar my/python-eldoc-string-code "__PYDOC_get_full_help('''%s''')"
  "Python code used to get a string with the documentation of an object.")

;; For built-in python.el
(with-eval-after-load 'python
  (add-to-list 'python-shell-setup-codes 'my/python-eldoc-setup-code) ; Use=
d inside (python-shell-send-setup-code)
  (defun my/python-eldoc-at-point (&optional symbol)
    (interactive
     (let ((symbol (python-info-current-symbol t))
           (enable-recursive-minibuffers t))
       (list (read-string (if symbol
                              (format "Describe symbol (default %s): " symb=
ol)
                            "Describe symbol: ")
                          nil nil symbol))))
    (let ( (python-eldoc-string-code my/python-eldoc-string-code)
           (python-eldoc-setup-code my/python-eldoc-setup-code) )
      (switch-to-buffer (get-buffer-create "*Python-doc*"))
      (read-only-mode -1)
      (buffer-disable-undo)
      (erase-buffer)
      (insert (python-eldoc--get-doc-at-point symbol))
      (goto-char (point-min))
      (when (re-search-forward "^u?'" (line-end-position) t)
        (replace-match ""))
      (while (re-search-forward "\\\\n" nil t)
        (replace-match "\n"))
      (goto-char (point-max))
      (when (eq ?' (char-before))
        (delete-char -1))
      (read-only-mode 1)
      (goto-char (point-min))))
  (define-key python-mode-map "\C-c\C-d" 'my/python-eldoc-at-point))

--=20
http://defun.work/




Acknowledgement sent to Oleksandr Gavenko <gavenkoa@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#22665; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.