diff --git a/src/swank/commands/contrib/swank_arglists.clj b/src/swank/commands/contrib/swank_arglists.clj index b48ef13..31c057a 100644 --- a/src/swank/commands/contrib/swank_arglists.clj +++ b/src/swank/commands/contrib/swank_arglists.clj @@ -14,17 +14,29 @@ ((slime-fn 'operator-arglist) (ffirst raw-specs) *current-package*) nil))) -(defslimefn autodoc [raw-specs & options] - ;; This isn't complete but at least does something - (if (and raw-specs - (seq? raw-specs) - (seq? (first raw-specs))) - ((slime-fn 'operator-arglist) (ffirst raw-specs) *current-package*) - nil)) +(defslimefn autodoc + "Return a string representing the arglist for the deepest subform in +RAW-FORM that does have an arglist. The highlighted parameter is +wrapped in ===> X <===." + [raw-specs & options] + (let [{:keys [print-right-margin + print-lines]} (if (first options) + (apply hash-map options) + {})] + (if (and raw-specs + (seq? raw-specs)) + (let [expr (some #(and (seq? %) (some #{:cursor-marker} %) %) + (tree-seq seq? seq raw-specs))] + (if (and (seq? expr) (not (= (first expr) ""))) + ((slime-fn 'operator-arglist) + (first expr) + *current-package*) + `:not-available)) + `:not-available))) (defslimefn variable-desc-for-echo-area [variable-name] (with-emacs-package - (or + (or (try (when-let [sym (read-string variable-name)] (when-let [var (resolve sym)]