I can't really claim to be handy with elisp, but I got by.
(Is there a guide to elisp functions anywhere? The Lisp
reference didn't include the Common Lisp emulation library,
and I never did find an equivalent to the clojure filter()).
Anyway, here's what I added to my .emacs:
(defun find-ext-for-mode (m)
(let (modes)
(dolist (ext auto-mode-alist modes)
(if (eq (cdr ext) m)
(add-to-list 'modes (car ext))))))
; (find-ext-for-mode 'clojure-mode)
(defun is-clojure-buffer (b)
(let ((regexes (find-ext-for-mode 'clojure-mode)))
(find-if
(lambda (regex) (string-match regex (buffer-name b)))
regexes)))
(defun add-slime-mode-to-existing-buffers ()
(interactive)
(let ((clojure-buffers (remove-if-not 'is-clojure-buffer (buffer-
list))))
(dolist (b clojure-buffers)
(set-buffer b)
(slime-mode))))
(eval-after-load 'slime '(add-slime-mode-to-existing-buffers))
Let me know if you add it to your repository.
There could conceivably be some issues with multiple slime
connections, or with running slime-mode repeatedly on the same
buffer. I couldn't find any easy way to determine if a buffer already
had slime-mode -- love to hear from someone who is actually handy
with elisp!
On Feb 13, 4:39 pm, Phil Hagelberg <[email protected]> wrote:
> David <[email protected]> writes:
> > I have a small problem with clojure-mode in your setup.
>
> > Since clojure-mode is autoloaded, it, and SLIME, aren't available
> > until I load a '.clj' file.
> > Starting SLIME, though, doesn't add the SLIME menu to the previously
> > loaded '.clj' buffer
> > (Newly loaded files get the menu, as they should).
>
> Yeah, I've thought about a hook that runs after SLIME loads to activate
> slime-mode for all pre-existing clojure-mode buffers; just haven't
> gotten around to it.
>
> If you're handy with elisp, I'd love a patch, otherwise I'll get around
> to it eventually. =)
>
> -Phil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---