When the REPL is started without lisp-mode windows, the arglist isn't fontified until something is „M-x slime-mode”'d because of this:
[slime-autodoc.el] (defun slime-fontify-string (string) "Fontify STRING as `font-lock-mode' does in Lisp mode." (with-current-buffer (get-buffer-create " *slime-fontify*") (erase-buffer) (unless (eq major-mode 'lisp-mode) (lisp-mode) (slime-autodoc-mode -1) ...) ...))
…and „slime-autodoc-mode” sets „slime-echo-arglist-function” when arg satisfies „minusp”.
So i made an ugly patch to fix it. Here it goes:
diff --git a/contrib/slime-autodoc.el b/contrib/slime-autodoc.el index 524539d..e69a65c 100644 --- a/contrib/slime-autodoc.el +++ b/contrib/slime-autodoc.el @@ -184,7 +184,11 @@ Return DOCUMENTATION." (erase-buffer) (unless (eq major-mode 'lisp-mode) (lisp-mode) - (slime-autodoc-mode -1) + (let ((slime-echo-arglist-function slime-echo-arglist-function) + (slime-autodoc-mode slime-autodoc-mode) + (eldoc-idle-delay eldoc-idle-delay) + (eldoc-documentation-function eldoc-documentation-function)) + (slime-autodoc-mode -1)) (set (make-local-variable 'slime-highlight-suppressed-forms) nil)) (insert string) (let ((font-lock-verbose nil))
Stanislaw Halik sthalik@test123.ltd.pl writes:
When the REPL is started without lisp-mode windows, the arglist isn't fontified until something is „M-x slime-mode”'d because of this:
[slime-autodoc.el] (defun slime-fontify-string (string) "Fontify STRING as `font-lock-mode' does in Lisp mode." (with-current-buffer (get-buffer-create " *slime-fontify*") (erase-buffer) (unless (eq major-mode 'lisp-mode) (lisp-mode) (slime-autodoc-mode -1) ...) ...))
…and „slime-autodoc-mode” sets „slime-echo-arglist-function” when arg satisfies „minusp”.
So i made an ugly patch to fix it. Here it goes:
I see no reason why slime-autodoc-mode should be turned off in this buffer, so I just removed (slime-autodoc-mode -1) line and committed it.
Another way would be to make slime-echo-arglist-function buffer-local in slime-autodoc-mode, but I'm not sure that this is desirable.
Stas Boukarev stassats@gmail.com writes:
Stanislaw Halik sthalik@test123.ltd.pl writes:
When the REPL is started without lisp-mode windows, the arglist isn't fontified until something is „M-x slime-mode”'d because of this:
[slime-autodoc.el] (defun slime-fontify-string (string) "Fontify STRING as `font-lock-mode' does in Lisp mode." (with-current-buffer (get-buffer-create " *slime-fontify*") (erase-buffer) (unless (eq major-mode 'lisp-mode) (lisp-mode) (slime-autodoc-mode -1) ...) ...))
…and „slime-autodoc-mode” sets „slime-echo-arglist-function” when arg satisfies „minusp”.
Thanks for discovering this, Stanislaw. I think this is the root of another problem that sometimes pressing SPACE involves `slime-show-arglist' and not autodoc due to a race condition.
So i made an ugly patch to fix it. Here it goes:
I see no reason why slime-autodoc-mode should be turned off in this buffer, so I just removed (slime-autodoc-mode -1) line and committed it.
It's the other way around, there's not reason why it should be turned on; especially because it's used within the autodoc code itself, so there may have been recursive problems I forgot. Another thing is that because autodoc is performed periodically involving an RPC request, you don't want it to happen if you're just vising a .lisp file without having started slime.
Another way would be to make slime-echo-arglist-function buffer-local in slime-autodoc-mode, but I'm not sure that this is desirable.
The real fix, I think, is to conditionalize on `slime-use-autodoc-mode' in `slime-compute-autodoc', and binding the variable to nil inside of `slime-fontify-string'.
-T.