Emacs with Lisp and Clojure.

84 views
Skip to first unread message

mmwaikar

unread,
Mar 23, 2011, 3:07:32 PM3/23/11
to Clojure
Hi,

I am a newbie to Ubuntu (10.10) and Emacs (23). I have been able to
satisfactorily setup Eclipse and CCW, thanks to feedback from CCW user
group members. However, I wanted to explore Clojure through Emacs.

I have clojure-mode 1.7.1, slime and slime-repl 20100404 installed.
I've also installed the ELPA. I've read the assembla wiki and also
seen Lau Jensen's video on getting started with Emacs and clojure. I
have the following in my ~/.emacs file (please note, some of the lines
are commented) -

;; Set up the Common Lisp environment
(add-to-list 'load-path "/usr/share/common-lisp/source/slime/")
(add-to-list 'load-path "/opt/clojure-mode/")

;;(add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup)
;;(add-to-list 'package-archives '("marmalade" . "http://marmalade-
repo.org/packages/") t)

;;(setq inferior-lisp-program "/usr/bin/sbcl")
(setq x-select-enable-clipboard t)

(require 'clojure-mode)
(require 'slime)
(slime-setup)

(setq slime-lisp-implementations
'((clojure ("/usr/bin/clojure"))
(sbcl ("/usr/bin/sbcl"))))

;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))

Now when I try to install swank-clojure, I get the following message -
File exists: /home/manoj/.emacs.d/elpa/clojure-mode-1.7.1/clojure-
mode.el

And then, after running Emacs, when I say, C-u M-x slime, it prompts
me with Run lisp: lisp and when I change lisp to Clojure, I get a
clojure prompt.

But -
1) There is no auto indentation (so when I go to the next line, after
say (defn some[]), it starts with the first col. in this new line)

2) I can also delete the user => prompt (where as with SBCL prompt, it
says the text is read-only).

Please let me know if I am doing something wrong or missing some
steps.

I would also like the ability to run Lisp and / or Clojure in Emacs
(because I am learning both of them).

Thanks in advance,
Manoj.

Thorsten Wilms

unread,
Mar 23, 2011, 3:30:11 PM3/23/11
to clo...@googlegroups.com
On 03/23/2011 08:07 PM, mmwaikar wrote:

> Now when I try to install swank-clojure, I get the following message -
> File exists: /home/manoj/.emacs.d/elpa/clojure-mode-1.7.1/clojure-
> mode.el

I vaguely recall that I had the same problem and solved it by simply
moving the existing clojure-mode.el out of the way. You can delete it,
if that works.


> But -
> 1) There is no auto indentation (so when I go to the next line, after
> say (defn some[]), it starts with the first col. in this new line)

Could be the job of Paredit (I'm not sure what does what, here).


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

Tassilo Horn

unread,
Mar 23, 2011, 3:45:02 PM3/23/11
to clo...@googlegroups.com
Thorsten Wilms <t_...@freenet.de> writes:

Hi,

>> 1) There is no auto indentation (so when I go to the next line, after
>> say (defn some[]), it starts with the first col. in this new line)
>
> Could be the job of Paredit (I'm not sure what does what, here).

No, paredit has nothing to do with that. He probably goes to the next
line with RET, which is `newline' by default. Maybe he wants to bind
`newline-and-indent' to RET, instead.

(define-key clojure-mode-map (kbd "RET") 'newline-and-indent)

Bye,
Tassilo

mmwaikar

unread,
Mar 24, 2011, 12:26:40 AM3/24/11
to Clojure
But the same enter key works properly when I am using Lisp, so why
shouldn't it be the default in Clojure as well?

Also, after removing clojure-mode, when I try to install swank-
clojure, it again installs the clojure-mode, but fails to install
itself?

regards,
Manoj.

On Mar 24, 12:45 am, Tassilo Horn <tass...@member.fsf.org> wrote:

Tassilo Horn

unread,
Mar 24, 2011, 4:14:49 AM3/24/11
to clo...@googlegroups.com
mmwaikar <mmwa...@gmail.com> writes:

> But the same enter key works properly when I am using Lisp, so why
> shouldn't it be the default in Clojure as well?

What's considered "properly" for RET is purely subjective. :-)

But I have to admit that I was wrong. When paredit-mode is enabled, RET
is indeed bound to `paredit-newline', which does indentation
automatically. For me that does the trick for Clojure, Elisp, and CL
buffers...

> Also, after removing clojure-mode, when I try to install swank-
> clojure, it again installs the clojure-mode, but fails to install
> itself?

Do you get some error messages?

Using emacs 24 from bzr, I only added

(add-to-list 'package-archives
'("technomancy" . "http://repo.technomancy.us/emacs/") t)

to get the most recent packages from technomancy listed in M-x
package-list-packages, and there I installed these ones:

clojure-mode 1.8.0 installed Major mode for Clojure code
slime 20100404.1 installed Superior Lisp Interaction Mode for Emacs
slime-repl 20100404 installed Read-Eval-Print Loop written in Emacs Lisp
swank-clojure 1.1.0 installed Slime adapter for clojure

Bye,
Tassilo

MarisO

unread,
Mar 24, 2011, 1:31:19 PM3/24/11
to Clojure
swank-clojure is deprecated, don't use it. Instead start swank from
leiningen.

I found these instructions how to install clojure support in emacs
http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html

No need to use elpa with broken packages or starter-kit.

Maris

On Mar 24, 8:14 am, Tassilo Horn <tass...@member.fsf.org> wrote:

Daniel Bell

unread,
Mar 26, 2011, 8:43:26 PM3/26/11
to Clojure
http://thtatithticth.blogspot.com/2011/02/obligatory-development-environment-post.html

On Mar 24, 11:31 am, MarisO <maris.orbid...@gmail.com> wrote:
> swank-clojure is deprecated, don't use it.  Instead start swank from
> leiningen.
>
> I found these instructions how to install clojure support in emacshttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
Reply all
Reply to author
Forward
0 new messages