C-c C-x keybindings for swank-cdt don't work

34 views
Skip to first unread message

Gregg Williams

unread,
Jan 27, 2012, 1:06:14 AM1/27/12
to Clojure
Hi--After several attempts, I've gotten CDB working...sort of, and I'm
stuck.

Following the example on http://georgejahad.com/clojure/swank-cdt.html,
I execute the following:

(use 'clojure.set)
(use 'swank.cdt)
(set-bp clojure.set/difference)

which execute OK. When I execute:

user> (difference #{1 2} #{2 3})
CDT location is clojure/set.clj:53:0:/Users/gw/tech/clojurestuff/
cljprojects/infwb/lib/clojure-1.3.jar

the *sldb clojure/3* buffer appears, as does the source code for the
function `difference`, within the source file `set.clj`.

Using the `e` command, I can print the value of `s1` in the Emacs
minibuffer.

Here's my problem: when I attempt to use any of the C-c C-x commands
(e.g., C-c C-x C-p), the minibuffer complains that the command is not
defined.

Following George Jahad's suggestions on
http://groups.google.com/group/clojure/browse_thread/thread/2295f4550271b003/ebf9e166048871aa?hl=en&lnk=gst&q=Re%3A+setting+break+points+at+multimethods+in+cdt#,
I find that `sldb-line-bp` is defined, but I can't find `cdt-map`.

Also, his suggestion of executing (swank.core.cdt-utils/init-emacs-
helper-functions) from the REPL doesn't make any difference--I still
get the same behavior reported above.

I'm using Emacs 24; could that be causing any problems?

I'm using Leiningen 1.6.2, I have lein-midje-1.0.8 loaded in `~/.lein/
plugins`, and my project.clj file is below.

Thanks for any suggestions you might have.

--- project.clj ---

(defproject infwb "1.0.0-SNAPSHOT"
:description "an evolving, experimental workspace for manipulating
infocards"
:main infwb.core

:dependencies [[org.clojure/clojure "1.3"]
[org.clojure/clojure-contrib "[1.2.0,1.2.1]"]
[seesaw "1.2.0"]
[org.clojars.gw666/sxqj "beta2"]
[org.clojars.gw666/piccolo2dcore "1.3"]
[org.clojars.gw666/piccolo2dextras "1.3"]
[com.miglayout/miglayout "3.7.4"]
]
:dev-dependencies [[midje "1.3.1"]
[clojure-source "1.3.0"]
[swank-clojure "1.4.0-SNAPSHOT"]]
:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"])

--- end ---

George Jahad

unread,
Jan 27, 2012, 10:15:53 PM1/27/12
to Clojure

Not sure why that is happening. Can't reproduce it. What is supposed
to happen is that when swank-cdt is loaded, it should invoke the emacs
lisp to define those keystrokes.

Until I figure it out, try adding the following to your .emacs. Let
me know if that fixes it.

g

(progn (defun sldb-line-bp (&optional _) "Set breakpoint on current
buffer line." (interactive) (slime-eval-async (list (quote swank:sldb-
line-bp) (buffer-file-name) (line-number-at-pos)))) (defun slime-force-
continue (&optional _) "force swank server to continue" (interactive)
(slime-dispatch-event (quote (:emacs-interrupt :cdt)))) (defun slime-
get-thing-at-point (&optional _) (interactive) (let ((thing (thing-at-
point (quote sexp)))) (set-text-properties 0 (length thing) nil thing)
thing)) (defun slime-eval-last-frame (&optional _) "Eval thing at
point in the context of the last frame viewed" (interactive) (slime-
eval-with-transcript (list (quote swank:eval-last-frame) (slime-get-
thing-at-point)))) (define-prefix-command (quote cdt-map)) (define-key
cdt-map (kbd "C-b") (quote sldb-line-bp)) (define-key cdt-map (kbd "C-
g") (quote slime-force-continue)) (define-key cdt-map (kbd "C-p")
(quote slime-eval-last-frame)) (eval-after-load (quote slime) (quote
(progn (define-key slime-mode-map (kbd "C-c C-x") (quote cdt-map))
(define-key sldb-mode-map (kbd "C-c C-x") (quote cdt-map))))) (eval-
after-load (quote slime-repl) (quote (define-key slime-repl-mode-map
(kbd "C-c C-x") (quote cdt-map)))) (eval-after-load (quote cc-mode)
(quote (define-key java-mode-map (kbd "C-c C-x") (quote cdt-map)))))

On Jan 26, 10:06 pm, Gregg Williams <greg...@innerpaths.net> wrote:
> Hi--After several attempts, I've gotten CDB working...sort of, and I'm
> stuck.
>
> Following the example onhttp://georgejahad.com/clojure/swank-cdt.html,
> I execute the following:
>
> (use 'clojure.set)
> (use 'swank.cdt)
> (set-bp clojure.set/difference)
>
> which execute OK. When I execute:
>
> user> (difference #{1 2} #{2 3})
> CDT location is clojure/set.clj:53:0:/Users/gw/tech/clojurestuff/
> cljprojects/infwb/lib/clojure-1.3.jar
>
> the *sldb clojure/3* buffer appears, as does the source code for the
> function `difference`, within the source file `set.clj`.
>
> Using the `e` command, I can print the value of `s1` in the Emacs
> minibuffer.
>
> Here's my problem: when I attempt to use any of the C-c C-x commands
> (e.g., C-c C-x C-p), the minibuffer complains that the command is not
> defined.
>
> Following George Jahad's suggestions onhttp://groups.google.com/group/clojure/browse_thread/thread/2295f4550...,

George Jahad

unread,
Jan 27, 2012, 10:27:13 PM1/27/12
to Clojure
Sorry, the elisp got scrambled in the post.

Get it from here:
http://georgejahad.com/clojure/swank-cdt-helper.el

Gregg Williams

unread,
Jan 28, 2012, 11:58:19 PM1/28/12
to Clojure
George, I don't know why it works (my init.el file doesn't seem to
mess with anything), but adding that code to the end of init.el makes
things work. You're doing great things for the Clojure community--many
thanks!
Reply all
Reply to author
Forward
0 new messages