When "fume-python-fully-qualified-names" is true and there are nested
functions, like for example:
def foo:
def bar:
pass
Then the func-menu displays extra wide empty entries for those functions.
I suggest replacing the function "fume-find-next-python-function-name"
with the following:
(defun fume-find-next-python-function-name (buffer)
"Search for the next Python function in BUFFER."
(set-buffer buffer)
(if (re-search-forward fume-function-name-regexp nil t)
(save-excursion
(let* ((retpnt (match-beginning 2))
(retname (buffer-substring retpnt (match-end 2))))
(when fume-python-fully-qualified-names
(goto-char (match-beginning 0))
(cond ((looking-at "\\s-+def")
(cond ((/= (re-search-backward
"^\\(class\\|def\\)\\s-*\\([A-Za-z0-9_]+\\)\\s-*[(:]" nil t) retpnt)
(setq retname
(concat
(buffer-substring (match-beginning 2)
(match-end 2))
"."
retname)))))))
(cons retname retpnt)))))
This will qualify the name with the top parent function (i.e. "foo.bar"
with the above example). It only handles one level of nesting, but it
shouldn't break if there are more (i.e. it will display "foo.baz"
instead of "foo.bar.baz" but the display will still be useful).
|