unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters
@ 2015-01-20 20:09 Carlos Pita
  2015-02-05 19:21 ` Carlos Pita
  2015-02-07 21:45 ` Fabián Ezequiel Gallina
  0 siblings, 2 replies; 3+ messages in thread
From: Carlos Pita @ 2015-01-20 20:09 UTC (permalink / raw)
  To: 19637; +Cc: Fabian Ezequiel Gallina

Please keep eldoc line in the buffer area visible while entering the
parameters of a funcion. The signature information is mainly useful
for that. Hiding it immediately after typing the opening parenthesis
kinda defeats the whole point. Cheers, Carlos.

PD: Fabian, if you're interested in this feature I could try to
implement it myself and send a patch.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters
  2015-01-20 20:09 bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters Carlos Pita
@ 2015-02-05 19:21 ` Carlos Pita
  2015-02-07 21:45 ` Fabián Ezequiel Gallina
  1 sibling, 0 replies; 3+ messages in thread
From: Carlos Pita @ 2015-02-05 19:21 UTC (permalink / raw)
  To: 19637

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

Here is a tentative patch.

What it does is the following:

1) If point is in a paren context it escapes to the opening parenthesis

2) Now, if point is left (or was there from the very beginning) over
an opening (, then the relevant symbol is the one to the left of the
(, so whitespaces, newlines and backslashes are skipped backwards.
Presumably the point is now over a symbol.

3) We call (python-info-current-symbol). If a symbol is indeed parsed,
it's returned, if not, then the point position is restored and
(python-info-current-symbol) is called as usual.

Notice that the above allows for nested calls. But the exact behavior
is as follows (say * marks the position of the point):

a) m*ap(xx           will return map
b) map(xx*           will return map
c) map(open*       will also return map
d) map(open(xx*  will return open

I think this is almost always what you want. But a more complex
sequence could be implemented for c that first checks if there is any
documentation for 'open' and only in case there was no documentation
for the symbol, it showed the documentation for 'map'. I don't think
it's worth the extra complexity.

Cheers
--
Carlos

[-- Attachment #2: tooltip.patch --]
[-- Type: text/x-patch, Size: 1373 bytes --]

diff --git a/.emacs.d/lisp/python.el b/.emacs.d/lisp/python.el
index 4c8f4c6..3fe62e0 100644
--- a/.emacs.d/lisp/python.el
+++ b/.emacs.d/lisp/python.el
@@ -3940,15 +3940,25 @@ See `python-check-command' for the default."
   :type 'string
   :group 'python)
 
+(defun python-eldoc--get-symbol-at-point ()
+  (or (save-excursion
+        (when (let ((start (python-syntax-context 'paren)))
+                (when start
+                  (goto-char start))
+                (= (char-after) ?\())
+          (skip-chars-backward " \t\n\\\\")
+          (python-info-current-symbol)))
+      (python-info-current-symbol)))
+
 (defun python-eldoc--get-doc-at-point (&optional force-input force-process)
   "Internal implementation to get documentation at point.
-If not FORCE-INPUT is passed then what `python-info-current-symbol'
+If not FORCE-INPUT is passed then what `python-eldoc--get-symbol-at-point'
 returns will be used.  If not FORCE-PROCESS is passed what
 `python-shell-get-process' returns is used."
   (let ((process (or force-process (python-shell-get-process))))
     (when process
       (let ((input (or force-input
-                       (python-info-current-symbol t))))
+                       (python-eldoc--get-symbol-at-point))))
         (and input
              ;; Prevent resizing the echo area when iPython is
              ;; enabled.  Bug#18794.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters
  2015-01-20 20:09 bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters Carlos Pita
  2015-02-05 19:21 ` Carlos Pita
@ 2015-02-07 21:45 ` Fabián Ezequiel Gallina
  1 sibling, 0 replies; 3+ messages in thread
From: Fabián Ezequiel Gallina @ 2015-02-07 21:45 UTC (permalink / raw)
  To: 19637-done


Fixed at revno 2155973 in the master branch.

I tweaked your patch a bit to handle other cases and added tests.  I
realized I forgot to mention this was based on your patch after pushing
so I adjusted the ChangeLog entry at b480a6a.


Thanks again,
Fabián.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-07 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 20:09 bug#19637: 25.0.50; ipython eldoc keep visible while typing parameters Carlos Pita
2015-02-05 19:21 ` Carlos Pita
2015-02-07 21:45 ` Fabián Ezequiel Gallina

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).