Hi Phil:

I guess it's swank night tonight!

The newer versions of slime.el changed the name of the frame-source-
location-for-emacs slimefn to frame-source-location, which breaks
stack trace source file viewing.

This patch fixes that and adds support for finding java files in
addition to the clojure ones already supported.

I've also sent you a pull request.

George

diff --git a/swank/commands/basic.clj b/swank/commands/basic.clj
index d668d2d..a1721a2 100644
--- a/swank/commands/basic.clj
+++ b/swank/commands/basic.clj
@@ -330,8 +330,12 @@ that symbols accessible in the current namespace
go first."

 (defn source-location-for-frame [frame]
   (let [line     (.getLineNumber frame)
-        frame-ns ((re-find #"(.*?)\$" (.getClassName frame)) 1)
-        filename (str (namespace-to-path (symbol frame-ns)) File/
separator (.getFileName frame))
+       filename (if (.. frame getFileName (endsWith ".java"))
+                  (.. frame getClassName  (replace \. \/) (concat ".java"))
+                  (str (namespace-to-path
+                        (symbol ((re-find #"(.*?)\$"
+                                          (.getClassName frame)) 1)))
+                       File/separator (.getFileName frame)))
         path     (slime-find-file-in-paths filename (slime-search-
paths))]
     `(:location ~path (:line ~line) nil)))

@@ -373,7 +377,7 @@ that symbols accessible in the current namespace
go first."
 (defslimefn frame-catch-tags-for-emacs [n] nil)
 (defslimefn frame-locals-for-emacs [n] nil)

-(defslimefn frame-source-location-for-emacs [n]
+(defslimefn frame-source-location [n]
   (source-location-for-frame
      (nth (.getStackTrace *current-exception*) n)))





On Jul 6, 7:54 pm, Sudish Joseph <sud...@gmail.com> wrote:
> Hi,
>
> The patch below fixes the computation of swank-version, which broke when
> (clojure-version) was defined to returned a string.  The bug only
> manifests itself if swank-clojure-compile-p is set to t.
>
> -Sudish Joseph
>
> From: Sudish Joseph <sud...@gmail.com>
> Date: Mon, 1 Jun 2009 19:18:11 -0400
> Subject: [PATCH] clojure-version is now a string, tweak swank-version to 
> match.
>
> ---
>  swank/loader.clj |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/swank/loader.clj b/swank/loader.clj
> index 5f079f1..8a79025 100644
> --- a/swank/loader.clj
> +++ b/swank/loader.clj
> @@ -55,8 +55,8 @@
>  (defn swank-version
>    "A likely bad way of calculating a version number for swank clojure"
>    ([]
> -     (+ (reduce + (map file-last-modified (swank-source-files 
> *swank-source-path*)))
> -        (clojure-version))))
> +     (str (reduce + (map file-last-modified (swank-source-files 
> *swank-source-path*)))
> +         "+" (clojure-version))))
>
>  (defn delete-file-recursive [& paths]
>    (when-not (empty? paths)
> --
> 1.6.3.1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to