Code Monkey home page Code Monkey logo

clojure-mode's Introduction

circleci MELPA MELPA Stable NonGNU ELPA Discord License GPL 3

Clojure Mode

clojure-mode is an Emacs major mode that provides font-lock (syntax highlighting), indentation, navigation and refactoring support for the Clojure(Script) programming language.


This documentation tracks the master branch of clojure-mode. Some of the features and settings discussed here might not be available in older releases (including the current stable release). Please, consult the relevant git tag (e.g. 5.18.1) if you need documentation for a specific clojure-mode release.

Installation

Available on the major package.el community maintained repos - MELPA Stable and MELPA repos.

MELPA Stable is the recommended repo as it has the latest stable version. MELPA has a development snapshot for users who don't mind (infrequent) breakage but don't want to run from a git checkout.

You can install clojure-mode using the following command:

M-x package-install [RET] clojure-mode [RET]

or if you'd rather keep it in your dotfiles:

(unless (package-installed-p 'clojure-mode)
  (package-install 'clojure-mode))

If the installation doesn't work try refreshing the package list:

M-x package-refresh-contents

Bundled major modes

The clojure-mode package actually bundles together several major modes:

  • clojure-mode is a major mode for editing Clojure code
  • clojurescript-mode is a major mode for editing ClojureScript code
  • clojurec-mode is a major mode for editing .cljc source files

All the major modes derive from clojure-mode and provide more or less the same functionality. Differences can be found mostly in the font-locking - e.g. ClojureScript has some built-in constructs that are not present in Clojure.

The proper major mode is selected automatically based on the extension of the file you're editing.

Having separate major modes gives you the flexibility to attach different hooks to them and to alter their behavior individually (e.g. add extra font-locking just to clojurescript-mode) .

Note that all modes derive from clojure-mode, so things you add to clojure-mode-hook and clojure-mode-map will affect all the derived modes as well.

Configuration

In the spirit of Emacs, pretty much everything you can think of in clojure-mode is configurable.

To see a list of available configuration options do M-x customize-group RET clojure.

Indentation options

The default indentation rules in clojure-mode are derived from the community Clojure Style Guide. Please, refer to the guide for the general Clojure indentation rules.

If you'd like to use the alternative "fixed/tonsky" indentation style you should update your configuration accordingly:

(setq clojure-indent-style 'always-indent
      clojure-indent-keyword-style 'always-indent
      clojure-enable-indent-specs nil)

Read on for more details on the available indentation-related configuration options.

Indentation of docstrings

By default multi-line docstrings are indented with 2 spaces, as this is a somewhat common standard in the Clojure community. You can however adjust this by modifying clojure-docstring-fill-prefix-width. Set it to 0 if you don't want multi-line docstrings to be indented at all (which is pretty common in most lisps).

Indentation of function forms

The indentation of function forms is configured by the variable clojure-indent-style. It takes three possible values:

  • always-align (the default)
(some-function
 10
 1
 2)
(some-function 10
               1
               2)
  • always-indent
(some-function
  10
  1
  2)
(some-function 10
  1
  2)
  • align-arguments
(some-function
  10
  1
  2)
(some-function 10
               1
               2)

Note: Prior to clojure-mode 5.10, the configuration options for clojure-indent-style used to be keywords, but now they are symbols. Keywords will still be supported at least until clojure-mode 6.

Indentation of keywords

Similarly we have the clojure-indent-keyword-style, which works in the following way:

  • always-align (default) - All args are vertically aligned with the first arg in case (A), and vertically aligned with the function name in case (B).
(:require [foo.bar]
          [bar.baz])
(:require
 [foo.bar]
 [bar.baz])
  • always-indent - All args are indented like a macro body.
(:require [foo.bar]
   [bar.baz])
(:x
   location
   0)
  • align-arguments - Case (A) is indented like always-align, and case (B) is indented like a macro body.
(:require [foo.bar]
          [bar.baz])
(:x
   location
   0)

Indentation of macro forms

The indentation of special forms and macros with bodies is controlled via put-clojure-indent, define-clojure-indent and clojure-backtracking-indent. Nearly all special forms and built-in macros with bodies have special indentation settings in clojure-mode. You can add/alter the indentation settings in your personal config. Let's assume you want to indent ->> and -> like this:

(->> something
  ala
  bala
  portokala)

You can do so by putting the following in your config:

(put-clojure-indent '-> 1)
(put-clojure-indent '->> 1)

This means that the body of the ->/->> is after the first argument.

A more compact way to do the same thing is:

(define-clojure-indent
  (-> 1)
  (->> 1))

To indent something like a definition (defn) you can do something like:

(put-clojure-indent '>defn :defn)

You can also specify different indentation settings for symbols prefixed with some ns (or ns alias):

(put-clojure-indent 'do 0)
(put-clojure-indent 'my-ns/do 1)

The bodies of certain more complicated macros and special forms (e.g. letfn, deftype, extend-protocol, etc) are indented using a contextual backtracking indentation method, require more sophisticated indent specifications. Here are a few examples:

(define-clojure-indent
  (implement '(1 (1)))
  (letfn     '(1 ((:defn)) nil))
  (proxy     '(2 nil nil (1)))
  (reify     '(:defn (1)))
  (deftype   '(2 nil nil (1)))
  (defrecord '(2 nil nil (1)))
  (specify   '(1 (1)))
  (specify   '(1 (1))))

These follow the same rules as the :style/indent metadata specified by cider-nrepl. For instructions on how to write these specifications, see this document. The only difference is that you're allowed to use lists instead of vectors.

The indentation of special arguments is controlled by clojure-special-arg-indent-factor, which by default indents special arguments a further lisp-body-indent when compared to ordinary arguments.

An example of the default formatting is:

(defrecord MyRecord
    [my-field])

Note that defrecord has two special arguments, followed by the form's body - namely the record's name and its fields vector.

Setting clojure-special-arg-indent-factor to 1, results in:

(defrecord MyRecord
  [my-field])

You can completely disable the effect of indentation specs like this:

(setq clojure-enable-indent-specs nil)

Indentation of Comments

clojure-mode differentiates between comments like ;, ;;, etc. By default clojure-mode treats ; as inline comments and always indents those. You can change this behaviour like this:

(add-hook 'clojure-mode-hook (lambda () (setq-local comment-column 0)))

You might also want to change comment-add to 0 in that way, so that Emacs comment functions (e.g. comment-region) would use ; by default instead of ;;.

Note: Check out this section of the Clojure style guide to understand better the semantics of the different comment levels and why clojure-mode treats them differently by default.

Vertical alignment

You can vertically align sexps with C-c SPC. For instance, typing this combo on the following form:

(def my-map
  {:a-key 1
   :other-key 2})

Leads to the following:

(def my-map
  {:a-key     1
   :other-key 2})

This can also be done automatically (as part of indentation) by turning on clojure-align-forms-automatically. This way it will happen whenever you select some code and hit TAB.

Font-locking

clojure-mode features static font-locking (syntax highlighting) that you can extend yourself if needed. As typical for Emacs, it's based on regular expressions. You can find the default font-locking rules in clojure-font-lock-keywords. Here's how you can add font-locking for built-in Clojure functions and vars:

(defvar clojure-built-in-vars
  '(;; clojure.core
    "accessor" "aclone"
    "agent" "agent-errors" "aget" "alength" "alias"
    "all-ns" "alter" "alter-meta!" "alter-var-root" "amap"
    ;; omitted for brevity
    ))

(defvar clojure-built-in-dynamic-vars
  '(;; clojure.test
    "*initial-report-counters*" "*load-tests*" "*report-counters*"
    "*stack-trace-depth*" "*test-out*" "*testing-contexts*" "*testing-vars*"
    ;; clojure.xml
    "*current*" "*sb*" "*stack*" "*state*"
    ))

(font-lock-add-keywords 'clojure-mode
                        `((,(concat "(\\(?:\.*/\\)?"
                                    (regexp-opt clojure-built-in-vars t)
                                    "\\>")
                           1 font-lock-builtin-face)))

(font-lock-add-keywords 'clojure-mode
                        `((,(concat "\\<"
                                    (regexp-opt clojure-built-in-dynamic-vars t)
                                    "\\>")
                           0 font-lock-builtin-face)))

Note: The package clojure-mode-extra-font-locking provides such additional font-locking for Clojure built-ins.

As you might imagine one problem with this font-locking approach is that because it's based on regular expressions you'll get some false positives here and there (there's no namespace information, and no way for clojure-mode to know what var a symbol resolves to). That's why clojure-mode's font-locking defaults are conservative and minimalistic.

Precise font-locking requires additional data that can obtained from a running REPL (that's how CIDER's dynamic font-locking works) or from static code analysis.

When it comes to non built-in definitions, clojure-mode needs to be manually instructed how to handle the docstrings and highlighting. Here's an example:

(put '>defn 'clojure-doc-string-elt 2)

(font-lock-add-keywords 'clojure-mode
                        `((,(concat "(\\(?:" clojure--sym-regexp "/\\)?"
                                    "\\(>defn\\)\\>")
                           1 font-lock-keyword-face)))

Note: The clojure-doc-string-elt attribute is processed by the function clojure-font-lock-syntactic-face-function.

Refactoring support

The available refactorings were originally created and maintained by the clj-refactor.el team. The ones implemented in Elisp only are gradually migrated to clojure-mode.

Threading macros related features

clojure-thread: Thread another form into the surrounding thread. Both ->> and -> variants are supported.

clojure-unwind: Unwind a threaded expression. Supports both ->> and ->.

clojure-thread-first-all: Introduce the thread first macro (->) and rewrite the entire form. With a prefix argument do not thread the last form.

clojure-thread-last-all: Introduce the thread last macro and rewrite the entire form. With a prefix argument do not thread the last form.

clojure-unwind-all: Fully unwind a threaded expression removing the threading macro.

Cycling things

clojure-cycle-privacy: Cycle privacy of defs or defns. Use metadata explicitly with setting clojure-use-metadata-for-privacy to t for defns too.

clojure-cycle-not: Add or remove a not form around the current form.

clojure-cycle-when: Find the closest when or when-not up the syntax tree and toggle it.

clojure-cycle-if: Find the closest if or if-not up the syntax tree and toggle it. Also transpose the else and then branches, keeping the semantics the same as before.

Convert collection

Convert any given collection at point to list, quoted list, map, vector or set.

Let expression

clojure-introduce-let: Introduce a new let form. Put the current form into its binding form with a name provided by the user as a bound name. If called with a numeric prefix put the let form Nth level up in the form hierarchy.

clojure-move-to-let: Move the current form to the closest let's binding form. Replace all occurrences of the form in the body of the let.

clojure-let-forward-slurp-sexp: Slurp the next form after the let into the let. Replace all occurrences of the bound forms in the form added to the let form. If called with a prefix argument slurp the next n forms.

clojure-let-backward-slurp-sexp: Slurp the form before the let into the let. Replace all occurrences of the bound forms in the form added to the let form. If called with a prefix argument slurp the previous n forms.

paredit-convolute-sexp is advised to replace occurrences of bound forms with their bound names when convolute is used on a let form.

Rename ns alias

clojure-rename-ns-alias: Rename an alias inside a namespace declaration, and all of its usages in the buffer

If there is an active selected region, only rename usages of aliases within the region, without affecting the namespace declaration.

Add arity to a function

clojure-add-arity: Add a new arity to an existing single-arity or multi-arity function.

Related packages

  • clojure-mode-extra-font-locking provides additional font-locking for built-in methods and macros. The font-locking is pretty imprecise, because it doesn't take namespaces into account and it won't font-lock a function at all possible positions in a sexp, but if you don't mind its imperfections you can easily enable it:
(require 'clojure-mode-extra-font-locking)

The code in clojure-mode-font-locking used to be bundled with clojure-mode before version 3.0.

You can also use the code in this package as a basis for extending the font-locking further (e.g. functions/macros from more namespaces). Generally you should avoid adding special font-locking for things that don't have fairly unique names, as this will result in plenty of incorrect font-locking. CIDER users should avoid this package, as CIDER does its own dynamic font-locking, which is namespace-aware and doesn't produce almost any false positives.

  • clj-refactor provides refactoring support.

  • Enabling CamelCase support for editing commands(like forward-word, backward-word, etc) in clojure-mode is quite useful since we often have to deal with Java class and method names. The built-in Emacs minor mode subword-mode provides such functionality:

(add-hook 'clojure-mode-hook #'subword-mode)
  • The use of paredit when editing Clojure (or any other Lisp) code is highly recommended. It helps ensure the structure of your forms is not compromised and offers a number of operations that work on code structure at a higher level than just characters and words. To enable it for Clojure buffers:
(add-hook 'clojure-mode-hook #'paredit-mode)
  • smartparens is an excellent (newer) alternative to paredit. Many Clojure hackers have adopted it recently and you might want to give it a try as well. To enable smartparens use the following code:
(add-hook 'clojure-mode-hook #'smartparens-strict-mode)
  • RainbowDelimiters is a minor mode which highlights parentheses, brackets, and braces according to their depth. Each successive level is highlighted in a different color. This makes it easy to spot matching delimiters, orient yourself in the code, and tell which statements are at a given depth. Assuming you've already installed RainbowDelimiters you can enable it like this:
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
  • aggressive-indent-mode automatically adjust the indentation of your code, while you're writing it. Using it together with clojure-mode is highly recommended. Provided you've already installed aggressive-indent-mode you can enable it like this:
(add-hook 'clojure-mode-hook #'aggressive-indent-mode)

REPL Interaction

One of the fundamental aspects of Lisps in general, and Clojure in particular, is the notion of interactive programming - building your programs by continuously changing the state of the running Lisp program (as opposed to doing something more traditional like making a change and re-running the program afterwards to see the changes in action). To get the most of clojure-mode you'll have to combine it with some tool which will allow you to interact with your Clojure program (a.k.a. process/REPL).

A number of options exist for connecting to a running Clojure process and evaluating code interactively.

Basic REPL

inf-clojure provides basic interaction with a Clojure REPL process. It's very similar in nature and supported functionality to inferior-lisp-mode for Common Lisp.

CIDER

CIDER is a powerful Clojure interactive development environment, similar to SLIME for Common Lisp.

If you're into Clojure and Emacs you should definitely check it out.

Tutorials

Tutorials, targeting Emacs beginners, are available at clojure-doc.org and Clojure for the Brave and the True. Keep in mind, however, that they might be out-of-date.

Caveats

clojure-mode is a capable tool, but it's certainly not perfect. This section lists a couple of general design problems/limitations that might affect your experience negatively.

General Issues

clojure-mode derives a lot of functionality directly from lisp-mode (an Emacs major mode for Common Lisp), which simplified the initial implementation, but also made it harder to implement certain functionality. Down the road it'd be nice to fully decouple clojure-mode from lisp-mode.

See this ticket for a bit more details.

Indentation Performance

clojure-mode's indentation engine is a bit slow. You can speed things up significantly by disabling clojure-use-backtracking-indent, but this will break the indentation of complex forms like deftype, defprotocol, reify, letfn, etc.

We should look into ways to optimize the performance of the backtracking indentation logic. See this ticket for more details.

Font-locking Implementation

As mentioned above, the font-locking is implemented in terms of regular expressions which makes it both slow and inaccurate.

Changelog

An extensive changelog is available here.

License

Copyright © 2007-2024 Jeffrey Chu, Lennart Staflin, Phil Hagelberg, Bozhidar Batsov, Artur Malabarba, Magnar Sveen and contributors.

Distributed under the GNU General Public License; type C-h C-c to view it.

clojure-mode's People

Contributors

amalloy avatar anthonygalea avatar bbatsov avatar benedekfazekas avatar bonega avatar bonifaido avatar bost avatar cichli avatar drone29a avatar hugoduncan avatar jeffvalk avatar jochu avatar juergenhoetzel avatar kototama avatar magnars avatar malabarba avatar oknolombarda avatar p4v4n avatar pjstadig avatar rlbdv avatar samaaron avatar scottjad avatar syohex avatar tavisrudd avatar technomancy avatar ucieee avatar vemv avatar vspinu avatar xiongtx avatar yuhan0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clojure-mode's Issues

Enabling slime-mode for clojure-mode interferes with nrepl-mode

clojure-mode enables slime-mode for all Clojure buffers if slime is activated. Unfortunately, this interferes with nrepl-mode and you get "Not Connected" errors when trying to load file etc. The workaround is to disable slime-mode in a Clojure buffer which restores nrepl's correct functioning.

Locally I've edited my copy of clojure-mode to comment out the add-hook that enables slime-mode on Clojure buffers (the slime-connected-hook).

Now that swank-clojure is deprecated and everyone is being (strongly!) encouraged to switch to nrepl instead, it seems that clojure-mode should play nicer with nrepl?

Debugger entered--Lisp error: (wrong-number-of-arguments #[(sym indent)

Hi technomancy:
there is a debugger lisp error when I use emacs24.0.94 in win7 with "clisp", "sbcl" and "ccl" .
when I run M-x: slime, It gives the error:
------------detail info----------------

Debugger entered--Lisp error: (wrong-number-of-arguments #[(sym indent) "\302�\303 #\207" [sym indent put clojure-indent-function] 4] 3)
put-clojure-indent(with-stack-short-floats 1 ("X8632"))
run-hook-with-args(put-clojure-indent with-stack-short-floats 1 ("X8632"))
(let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol (quote common-lisp-indent-function)) (get symbol (quote slime-indent))) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages))
(while --cl-dolist-temp-- (setq info (car --cl-dolist-temp--)) (let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol (quote common-lisp-indent-function)) (get symbol (quote slime-indent))) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))
(let ((--cl-dolist-temp-- alist) info) (while --cl-dolist-temp-- (setq info (car --cl-dolist-temp--)) (let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol (quote common-lisp-indent-function)) (get symbol (quote slime-indent))) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))
(catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- alist) info) (while --cl-dolist-temp-- (setq info (car --cl-dolist-temp--)) (let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol ...) (get symbol ...)) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- alist) info) (while --cl-dolist-temp-- (setq info (car --cl-dolist-temp--)) (let ((symbol (intern ...)) (indent (slime-intern-indentation-spec ...)) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal ... ...) (put symbol ... indent) (put symbol ... indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))))
(block nil (let ((--cl-dolist-temp-- alist) info) (while --cl-dolist-temp-- (setq info (car --cl-dolist-temp--)) (let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol ...) (get symbol ...)) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
(dolist (info alist) (let ((symbol (intern (car info))) (indent (slime-intern-indentation-spec (second info))) (packages (third info))) (if (boundp (quote common-lisp-system-indentation)) (slime-update-system-indentation symbol indent packages) (when (equal (get symbol (quote common-lisp-indent-function)) (get symbol (quote slime-indent))) (put symbol (quote common-lisp-indent-function) indent) (put symbol (quote slime-indent) indent))) (run-hook-with-args (quote slime-indentation-update-hooks) symbol indent packages)))
slime-handle-indentation-update((("with-stack-short-floats" 1 ("X8632")) ("defx8632archmacro" 2 ("X8632")) ("with-format-scan-options" 1 ("CCL")) ("with-lock-grabbed-maybe" 1 ("CCL")) ("defx862" 3 ("CCL")) ("with-ioblock-input-locked" 1 ("CCL")) ("lfunloop" 4 ("CCL")) ("with-package-write-lock" 1 ("CCL")) ("with-program-error-handler" 1 ("CCL")) ("allowing-deferred-gc" 0 ("CCL")) ("with-eagain" 2 ("CCL")) ("with-slot-values" 2 ("CCL")) ("defx86lapfunction" 2 ("CCL")) ("with-ioblock-output-lock-grabbed" 1 ("CCL")) ("with-node-target" 2 ("CCL")) ("%get-signed-natural" 0 ("CCL")) ("%get-natural" 0 ("CCL")) ("without-gcing" 0 ("CCL")) ("with-declarations" 1 ("CCL")) ("with-restart" 1 ("CCL")) ("with-auxiliary-foreign-types" 0 ("CCL")) ("with-deferred-gc" 0 ("CCL")) ("with-package-read-lock" 1 ("CCL")) ("with-preserved-working-directory" 1 ("CCL")) ("while" 1 ("CCL")) ("with-additional-imm-reg" 1 ("CCL")) ("with-call-method-context" 1 ("CCL")) ("ff-call-ignoring-eintr" 0 ("CCL")) ("with-dll-node-freelist" 1 ("CCL")) ("with-open-dir" 1 ("CCL")) ("with-note" 1 ("CCL")) ("ignoring-without-interrupts" 0 ("CCL")) ("with-area-macptr" 1 ("CCL")) ("with-standard-abort-handling" 1 ("CCL")) ("define-x8632-vinsn" 2 ("CCL")) ("once-only" 1 ("CCL")) ("def-kernel-restart" 3 ("CCL")) ("define-toplevel-command" 3 ("CCL")) ("defx86lapmacro" 2 ("CCL")) ("with-native-utf-16-cstrs" 1 ("CCL")) ("with-imm-target" 2 ("CCL")) ("with-cross-compilation-package" 1 ("CCL")) ("def-acode-rewrite" 4 ("CCL")) ("ignoring-eintr" 0 ("CCL")) ("with-x86-p2-declarations" 1 ("CCL")) ("with-package-list-read-lock" 0 ("CCL")) ("with-stream-ioblock-input" 1 ("CCL")) ("with-standard-initial-bindings" 0 ("CCL")) ("def-ccl-pointers" 2 ("CCL")) ("with-native-utf-16-cstr" 1 ("CCL")) ...))
slime-dispatch-event((:indentation-update (("with-stack-short-floats" 1 ("X8632")) ("defx8632archmacro" 2 ("X8632")) ("with-format-scan-options" 1 ("CCL")) ("with-lock-grabbed-maybe" 1 ("CCL")) ("defx862" 3 ("CCL")) ("with-ioblock-input-locked" 1 ("CCL")) ("lfunloop" 4 ("CCL")) ("with-package-write-lock" 1 ("CCL")) ("with-program-error-handler" 1 ("CCL")) ("allowing-deferred-gc" 0 ("CCL")) ("with-eagain" 2 ("CCL")) ("with-slot-values" 2 ("CCL")) ("defx86lapfunction" 2 ("CCL")) ("with-ioblock-output-lock-grabbed" 1 ("CCL")) ("with-node-target" 2 ("CCL")) ("%get-signed-natural" 0 ("CCL")) ("%get-natural" 0 ("CCL")) ("without-gcing" 0 ("CCL")) ("with-declarations" 1 ("CCL")) ("with-restart" 1 ("CCL")) ("with-auxiliary-foreign-types" 0 ("CCL")) ("with-deferred-gc" 0 ("CCL")) ("with-package-read-lock" 1 ("CCL")) ("with-preserved-working-directory" 1 ("CCL")) ("while" 1 ("CCL")) ("with-additional-imm-reg" 1 ("CCL")) ("with-call-method-context" 1 ("CCL")) ("ff-call-ignoring-eintr" 0 ("CCL")) ("with-dll-node-freelist" 1 ("CCL")) ("with-open-dir" 1 ("CCL")) ("with-note" 1 ("CCL")) ("ignoring-without-interrupts" 0 ("CCL")) ("with-area-macptr" 1 ("CCL")) ("with-standard-abort-handling" 1 ("CCL")) ("define-x8632-vinsn" 2 ("CCL")) ("once-only" 1 ("CCL")) ("def-kernel-restart" 3 ("CCL")) ("define-toplevel-command" 3 ("CCL")) ("defx86lapmacro" 2 ("CCL")) ("with-native-utf-16-cstrs" 1 ("CCL")) ("with-imm-target" 2 ("CCL")) ("with-cross-compilation-package" 1 ("CCL")) ("def-acode-rewrite" 4 ("CCL")) ("ignoring-eintr" 0 ("CCL")) ("with-x86-p2-declarations" 1 ("CCL")) ("with-package-list-read-lock" 0 ("CCL")) ("with-stream-ioblock-input" 1 ("CCL")) ("with-standard-initial-bindings" 0 ("CCL")) ("def-ccl-pointers" 2 ("CCL")) ("with-native-utf-16-cstr" 1 ("CCL")) ...)) #)
slime-process-available-input(#)
slime-net-filter(# ""CCL")) ("%stack-block" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("rletz" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-input-from-vector" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-output-to-vector" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("let-globally" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("define-setf-method" 2 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-input-timeout" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("rlet" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-interrupts-enabled" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-encoded-cstrs" 2 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-write-lock" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-pointer-to-ivector" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-output-timeout" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("dovector" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("without-compiling-code-coverage" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("defcallback" 2 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("without-interrupts" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("def-load-pointers" 2 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("without-duplicate-definition-warnings" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-read-lock" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-string-vector" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("%vstack-block" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("define-declaration" 2 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-cstrs" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-terminal-input" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-lock-grabbed" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("catch-cancel" 0 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("with-open-socket" 1 ("COMMON-LISP-USER" "SWINK" "INSPECTOR" "OPENMCL-SOCKET" "CCL")) ("defarchmacro" 3 ("ARCH")) ("defx8664archmacro" 2 ("X8664")) ("with-errorfree-printing" 0 ("INSPECTOR")) ("with-swink-stream" 2 ("SWINK")) ("with-swink-lock" 1 ("SWINK")) ("with-return-values" 1 ("SWINK")) ("with-event-handling" 1 ("SWINK")) ("with-connection-lock" 1 ("SWINK")) ("with-loop-list-collection-head" 1 ("ANSI-LOOP")) ("with-minimax-value" 1 ("ANSI-LOOP")) ("with-slime-output-stream" 1 ("SWANK-BACKEND")) ("converting-errors-to-error-location" 0 ("SWANK-BACKEND")) ("with-frame" 2 ("SWANK-BACKEND")) ("defimplementation" 2 ("SWANK-BACKEND")) ("with-compilation-hooks" 1 ("SWANK" "SWANK-BACKEND")) ("with-struct" 2 ("SWANK" "SWANK-BACKEND")) ("when-let" 1 ("SWANK" "SWANK-BACKEND")) ("with-time/cons" 2 ("MONITOR")) ("with-monitoring" 2 ("MONITOR")) ("with-xref" 0 ("CROSS-REFERENCE" "COMMON-LISP-USER" "SWINK" "INSPECTOR" "CCL")) ("match" 1 ("SWANK" "SWANK-MATCH")) ("with-slime-interrupts" 0 ("SWANK")) ("define-channel-method" 2 ("SWANK")) ("without-slime-interrupts" 0 ("SWANK")) ("with-swank-error-handler" 1 ("SWANK")) ("with-buffer-syntax" 1 ("SWANK")) ("with-retry-restart" 1 ("SWANK")) ("without-printing-errors" 1 ("SWANK")) ("with-describe-settings" 1 ("SWANK")) ("with-top-level-restart" 1 ("SWANK")) ("with-io-redirection" 1 ("SWANK")) ("with-bindings" 1 ("SWANK")) ("with-struct*" 1 ("SWANK")) ("with-string-stream" 1 ("SWANK")) ("with-connection" 1 ("SWANK")) ("defslimefun" 2 ("SWANK")) ("with-panic-handler" 1 ("SWANK"))))")

Bug with nrepl-hide-special-buffers (??? and add-hook 'nrepl-mode-hook)

Hi everybody,

I am having problems with clojure-mode,
if I set
(setq nrepl-hide-special-buffers t)
it doesn't work and I still see the nrepl-connection and nrepl-server buffer when I switch buffers using C-x LEFT/RIGHT or when I use the switch-to-buffer command (either via C-x b and by the bar)

Then the nrepl doesn't work (it does not show the namespace> and when I press RET (enter) it reply "wrong type of argument: integer-or.marker-p, nil" ) if I either:
(add-hook 'nrepl-mode-hook 'paredit-mode)
or
(add-hook 'nrepl-mode-hook 'rainbow-delimiters-mode)

(I think, but I may be wrong that the problem is the add-hook)

My .emacs is here:
https://gist.github.com/siscia/5093718

clojure-test-maybe-enable issue

Hi! Is it my impression, or the current definition of the clojure-test-maybe-enable has two setbacks?

  • First, it doesn't do anything related to the directory the file is in, unlike the docstring statement.
  • Second, the check it does will search for "clojure.test" on the file - isn't that somehow limitative (despite the fact that it won't be a good detection method, if the file contains that string in a comment somewhere else besides the namespace, e.g. ...)

I propose the following change, as it works for - what i believe to be - the right way to specify tests:

(defun clojure-test-maybe-enable ()
  "Enable clojure-test-mode if the current buffer contains a namespace 
   with a \"test.\" bit on it."
  (let ((ns (clojure-find-package))) ; defined in clojure-mode.el
    (when (search "test." ns)
  (clojure-test-mode t))))

What do you think?

clojure-jack-in on Windows, error in process filter: Non-hex digit used for Unicode escape

Emacs version 23.3.1

When I try to use clojure-jack-in I get the error above. I turned on debugging and get the message below.

Debugger entered--Lisp error: (error "Non-hex digit used for Unicode escape")
eval-region(43 746) ; Reading at buffer position 143
clojure-eval-bootstrap-region(#)
#[(G84100 G84101 process output) "r\305�!q\210 c\210)\306\307 "\205.

Certain comments break check-parens (and hence paredit)

With Emacs HEAD and the latest clojure-mode from git, check-parens breaks when the following comment is in a file, claiming that there are unmatched parens.

; e.g. Foo StartTime="2008-09-28T14:38:53Z

I presume that the syntax table is slightly confused, and the unmatched quote therefore gets treated as a broken sexp; the same comment passes check-parens when dropped into an elisp file.

When check-parens fails, paredit can't be enabled. (gasp!)

I don't know if it's related, but I also noticed that emacs' notion of sexps varies between emacs-lisp and clojure source; in the former, any number of consecutive comments are treated as a single sexp for the purpose of 'forward-sexp etc., even when separated by blank lines. In clojure-mode, forward-sexp at the beginning of this line:

;; Parse dates/times in common string formats

moves point to just before "Parse". This seems like an error to me.

-Steve

clojure-test-mode output is hard to read

Could you use flymakes faces if those are installed instead of defining your own? More people are likely to have flymake faces customized so that they are readable.

Also you can use an underline in red/yellow for your error faces, so text is easier to read. This is likely more compatible with most color-schemes as well.

bug - clojure-match-next-def d/n work correctly, (potential fix attached)

Hi, I'm your neightbor over at https://github.com/mgrisius/clj-mode. Steve Purcell (https://github.com/purcell) suggested that I share a potential fix.

I noticed that clojure-match-next-def d/n work correctly. Using `clojure-1.4.0/src/clj/clojure/core.clj' as a test use case over 20 of 571 defs or ~4% were missing from index, plus erroneous entries were added too!

Here is my approach that might help the community at large:

(defun clj-mode-next-def ()
"Scans the buffer backwards for the next top-level definition."
(when (re-search-backward "^(def\sw*" nil t)
(save-excursion
(let ((def-name nil)
(start (point)))
(down-list)
(forward-sexp)
(while (not def-name)
(forward-sexp)
(or (if (char-equal ?[ (char-after (point)))
(backward-sexp))
(if (char-equal ?) (char-after (point)))
(backward-sexp)))
(destructuring-bind (def-beg . def-end) (bounds-of-thing-at-point 'sexp)
(if (not (char-equal ?^ (char-after def-beg)))
(progn (setq def-name t) (set-match-data (list def-beg def-end)))
(progn (forward-sexp) (backward-sexp)))))
(goto-char start)))))

Hope that helps, thanks!

In 8f4f9b2d clojure-jack-in breaks clojure-mode buffers

Hitting enter on any clojure-mode buffer after connecting to SLIME via clojure-jack-in results in

slime-to-lisp-filename: Symbol's function definition is void: slime-tramp-local-filename

To reproduce using latest HEAD of swank, clojure-mode and emacs 22.1.1 (mac-apple-darwin)

emacs -nw -Q
In scratch buffer, evaluate:

(add-to-list 'load-path "/path/to/slime")
(add-to-list 'load-path "/path/to/clojure-mode")

Open a clojure file,
M-x clojure-mode
M-x clojure-jack-in

Now in the clojure file buffer, hit enter or backspace and the error occurs.

Test file location should mirror leiningen's project structure

Currently clojure-mode looks for src/my/project/frob.clj tests in test/my/project/test/frob.clj. Leiningen structures its projects to use test/my/project/frob_test.clj. Can clojure-mode use leiningen's project structure when looking for tests (or at least have the option)?

Not properly indenting "let" binding sequences

"let" binding blocks containing complex bindings are not indented properly.

(let [[x
       y] (range 2)

       [a b] (["foo" "bar"])]
  (print x y a b))

Notice that the line that starts with [a ...] is lined up under the y in the line above. It should line up under the [x .... It appears to be a problem with having 2 s-expressions on the lines starting [x ...

Var metadata breaks the imenu index

For example, imenu index for core.clj (from clojure-1.2.1.jar) contains a lot of junk from the annotations:

unquote)
unquote-splicing)
'([&
'([x
true
'([coll])
'([coll
"Same
'([coll])
'([^Class

best workflow with testing

Hello,

I'm currently trying to create some serious project with clojure using aquaemacs, leiningen, nrepl and clojure-mode. I faced quite a problem for me: how can I test my code in REPL? I want to have 2 files, first one with code, the second with tests. What's the best approach of doing it in "one-click" manner with autoreloading, switching buffers, don't asking for save etc. Just ONE step. I don't want to use lein test, it takes too long.
Any suggestion is worthy for me :)

thanks,
Bartek

RET behavior is non-standard

By default, RET calls reindent-then-newline-and-indent. This breaks tradition with most programming modes for Emacs, which instead call newline.

This is really a personal preference thing. The default behavior should be like all the other programming modes for Emacs, and if the user doesn't like this (as many folks don't) it can of course be customized.

Loading the slime payload upsets clojure-mode's formatting

When given a form like

(deftest ^{:regression true} test-blah
  ...)

clojure-mode will format it by indenting the "..." two spaces from the margin. After M-x clojure-jack-in, clojure-mode will indent the "..." underneath the metadata map.

Repro steps using swank-clojure 1.3.4 and clojure-mode c858a:

  1. Format the test source file with clojure-mode, and notice that "..." is indented two spaces.
  2. M-x clojure-jack-in
  3. C-c C-k to compile the test namespace.
  4. Format the source file with clojure-mode and notice that the "..." is indented to line up with the metadata map.
  5. Open clojure-mode.el and C-c v.
  6. Go back to the test source file, format with clojure-mode, and notice that the "..." is indented two spaces.

After performing a bisect it appears this problem was introduced in cdfc45.

Better integration with swank-cdt

(As discussed between myself and technomancy here: http://clojure-log.n01se.net/#12:21)

We should make it possible to invoke a clojure instance prepped for CDT without the user having to modify the project file. This could happen with a prefix argument to clojure-jack-in or maybe a related start function such as clojure-jack-in-debug.

There are three potential parts to this:

  1. Add "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n" to the Java options.
  2. Add tools.jar and sa-jdi.jar from $(JAVA_HOME)/../lib to the classpath of the invoked JVM. (CDT tries to add these to the classpath with add-classpath, but doesn't always seem to succeed.)
  3. Add a dependency to clojure-source.

Of these three, #1 is clearly required, #2 would make the whole structure more reliable, and I don't even know how we'd make #3 happen in the current structure (esp., since clojure-source doesn't seem to be pushed reliably).

We may want to do the underlying implementation a part of a new option to lein jack-in (e.g., "lein jack-in debug") so that it can be used by tools other than emacs, but that's obviously a matter for your judgment.

Running `clojure-test-run-tests` when using `nrepl.el` doesn't seem to work.

I'm only using emacs (and clojure) for a couple of months so I may be doing something wrong :(

Today I tried to use the nrepl.el plugin. When trying to run tests (e.g. the lein2 default generated test) it returns nil and it doesn't seem to run. Trying to compile/load the file again doesn't help.

The clojure-test-run-tests function causes another strange behavior:

  • I load the test file to nrepl.
  • I switch to the namespace of the test file
  • I run the tests with (run-tests)
  • It shows one test failed (as it should).
  • I switch to the test file and execute clojure-test-run-tests
  • Switching back to nrepl and running (run-tests) shows that 0 tests were running.
  • I have to load the test file again (e.g. with C-c, C-l) to make it run the tests again.

I'm using latest versions of everything (via melpa) and emacs 24.1.

Thanks

Keywords ending in # aren't correctly highlighted

I've tried to hack a solution but I appear to be lost in a sea of unfamiliar regex syntax.

It appears that line 520 is close to the issue:

  ;; Constant values (keywords), including as metadata e.g. ^:static
  ("\\<^?:\\(\\sw\\|#\\)+\\>" 0 font-lock-builtin-face)

somehow the end of word matcher \\> inhibits # from being the end of a keyword.

Docstring with map breaks font locking

This function breaks font locking in my Emacs 23.3.1. I raised a separate issue with nrepl.el for the evaluation issue.

(defn xxx 
  "This docstring breaks font lock and eval.
{:key [values] :anotherkey [more values]}"
  [] (str "this breaks font lock "
          "and C-M-x in nrepl"))

To all those following both projects: Please excuse the duplicate noise. To me it feels like to separate issues. Hope this is correct.

Regards,
Stefan

(require 'swank-clojure-autoload) after swank-clojure-jar-path has been set

In clojure-slime-config
(require 'swank-clojure-autoload)
is called before swank-clojure-jar-path is set. This results in the error
"You must specifiy either a swank-clojure-binary or a swank-clojure-jar-path"
if all the used specified was clojure-src-root. Changing the order of (require...) and (setq...) in the definition of clojure-slime-config solves this issue.

getRoot causes throw when working with Clojure 1.3.0-beta1

Applies to

Steps to Reproduce

  • Create a new lein project that has clojure 1.3.0-beta1 as a dependency and swank-clojure 1.4.0-snapshot as a dev dependency.
  • Connect via SLIME/emacs to the new project
  • Write a trivial test
  • Run test via C-c ,
  • Observe the following exception:
No matching field found: getRoot for class clojure.lang.Var
  [Thrown class java.lang.IllegalArgumentException]

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: clojure.lang.Reflector.getInstanceField(Reflector.java:289)
  1: clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:318)
  2: clojure.test.mode$report.invoke(NO_SOURCE_FILE:1)
  3: clojure.test$do_report.invoke(test.clj:349)
  4: clojure.test$test_ns.invoke(test.clj:723)
  5: clojure.core$map$fn__3839.invoke(core.clj:2433)
  6: clojure.lang.LazySeq.sval(LazySeq.java:42)
  7: clojure.lang.LazySeq.seq(LazySeq.java:60)
  8: clojure.lang.Cons.next(Cons.java:39)
  9: clojure.lang.RT.boundedLength(RT.java:1607)
...

Binding for "C-c t" violates Emacs key binding conventions

clojure-mode currently binds C-c t to clojure-jump-to-test. This violates Emacs's key binding conventions:

Don't define C-c letter as a key in Lisp programs. Sequences consisting of C-c and a letter (either upper or lower case) are reserved for users; they are the only sequences reserved for users, so do not block them.

Changing all the Emacs major modes to respect this convention was a lot of work; abandoning this convention would make that work go to waste, and inconvenience users. Please comply with it.

Key Binding Conventions, Emacs Lisp Manual

all-caps words get parsed as Java interop forms

All-caps words such as GET or POST get treated as Java interop forms. This is the culprit regex:

("\\<[A-Z][a-zA-Z0-9_]*[a-zA-Z0-9/$_]+\\>" 0 font-lock-preprocessor-face) ;; Foo Bar$Baz

Not sure if this is a bug or a feature - it is not too rare to find Clojurians typing their constants in caps... it's probably as likely as finding an all-uppercase Java class.

Replacing it for these

  ("\\<[A-Z_][a-z_/0-9]*\\>" 0 font-lock-preprocessor-face)
  ("\\<[A-Z].*\\>" 0 font-lock-preprocessor-face)

seems to works in that it covers all the test suite attached. Not sure if my solution is the best or generates false positives, though.

(comment
 _Bar .foo .barBaz .qux01 .-flibble .-flibbleWobble
 barFoo Foo Bar$Baz Qux_
 World_OpenUDP
 Foo/Bar
 Foo/
 AhenAenenAEnenAEnenAenenen
 Astr$Sstrst
 foo.bar.Baz foo.Bar/baz
 Foo. BarBaz. Qux$Quux. Corge9.
 Bar
 Bar_
 HTTP GET POST) ; these should be the only not rendered with font-lock-preprocessor-face

Add a 'setup' option (vs install)

Would be nice to have an M-x clojure-setup option, in addition to the M-x clojure-install, for people who already have Clojure repositories set up.

Another use case would be if for some reason the Git clone fails (e.g. on a crappy Comcast cable connection!). Having just spent several attempts (and bandwith) only to watch the clones of either -contrib or slime getting aborted, I ended up editing the clojure-mode.el file and commenting-out the checkout parts.

So if clojure-install clones the repositories and then hands off to clojure-setup, the latter can be called by people who have set up the repositories already (but might not want to set up Emacs by themselves).

Thanks for the good work -- I just persuaded a colleague to try Clojure, and clojure-mode (+ ELPA) definitely makes the task easier.

clojure-slime-config doesn't add swank-clojure.jar onto the classpath

I've been getting errors when running M-x slime, saying that swank-clojure isn't on the classpath...

Altering the setq for swank-clojure-classpath inside the clojure-slime-config function seems to fix this... e.g.

From this:

(setq swank-clojure-classpath
      (list
       (concat clojure-src-root "/clojure/clojure.jar")
       (concat clojure-src-root "/clojure-contrib/clojure-contrib.jar")))

To this:

(setq swank-clojure-classpath
      (list
       (concat clojure-src-root "/clojure/clojure.jar")
       (concat clojure-src-root "/swank-clojure/swank-clojure.jar")
       (concat clojure-src-root "/clojure-contrib/clojure-contrib.jar")))

mismatch in test name convention between clojure-mode and clojure-test-mode.

Commit e753312 changed the convention for naming tests in clojure-mode to "test/foo", but in clojure-test-mode it's still "foo_test" which completely breaks clojure-jump-between-tests-and-code.

I'm not sure which is the right way so I can't submit a pull request (iirc a few months ago there was a change in the opposite direction) 😄 .

What is the appropriate way to use SLIME via an old clojure-mode version?

I get that nREPL is the future, but I use SLIME's inspector on a daily basis and can't make the switch quite yet.
It looks like two weeks ago a new version of clojure-mode was released with the SLIME support cut, which I only discovered when putting my emacs config onto a clean machine.

I used to have all my emacs bits checked into git, but I switched to emacs-starter-kit 2.0 which recommends using the emacs24 package manager over direct checkins or submodules.
So how can I get an older version of clojure-mode so I can keep working?

According to this Emacs documentation, I should hold clojure-mode back.
Marmalade's clojure-mode page doesn't list any other available versions besides 2.0.0, so I tried digging through the commits and found "1.11.5".
Adding this to my init.el:

(setq package-load-list '((clojure-mode "1.11.5") all))

and running

(package-install 'clojure-mode)

returns a package not found error.

What's the proper way to use an older version of clojure-mode?
Or should I give up on package.el and just check in the version manually into my emacs config repo?

clojure-test-mode not up-to date on marmalade repo

Running tests with clojure-test-mode on clojure 1.3.0 and 1.4.0-alpha fails by calling "getRoot" which doesn't exist there.
"getRawRoot" fixed the problem, but it isn't mirrored in the marmalade repo.

clojure-fill-docstring error when fill-paragraph takes only one arg

clojure-fill-docstring throws an error in versions of Emacs in which fill-paragraph only accepts one argument.

My full version: "GNU Emacs 23.3.50.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2011-08-04 on braeburn.aquamacs.org - Aquamacs Distribution 2.3a"

clojure-test-mode mode specification errors

I try to use clojure-test-mode and face with few problems.

First I try open test file with disconnected nREPL and without slime installation in my system.

I've got "File mode specification error: (void-function slime-connected-p)"

I think it wood be better to use something like "(when (fboundp 'slime-connected-p)
(slime-connected-p))" in the minor mode definition.

After it happens I try to open emacs without open any files, start nREPL with `nrepl-jack-in' command and open my test file. I've got something like this:

File mode specification error: (wrong-type-argument stringp (lambda (&rest --cl-rest--) (apply (quote #[(G97112 G97113 G97114 G97115 G97116 response) "\306\307�"A\306\310�"A\306\311�"A\306\312�"A\306\313�"A\306\314�"A\306\315�"A\306\316�"A���������\211��\203Y

When I try `clojure-test-run-tests' I've got message below

nrepl-netstring: Wrong type argument: stringp, (lambda (&rest --cl-rest--) (apply (quote #[(G97112 G97113 G97114 G97115 G97116 response) "ÆÇ�"AÆÈ�"AÆÉ�"AÆÊ�"AÆË�"AÆÌ�"AÆÍ�"AÆÎ�"A�������������Y

What is this at all?!

If I use "(run-tests)" command directly in repl buffer it will process perfectly.

P.S. This is part of my .emacs file for clojure support:

(require 'clojure-mode)
(require 'clojure-test-mode)
(require 'nrepl)
(add-hook 'clojure-mode-hook 'nrepl-interaction-mode)

clojure-jack-in uses incorrect path on windows

Hello,

clojure-jack-in creates the shell-command
cd ~/clojure/scripts/myproject/ && lein jack-in 46284
which won't work under windows.

I changed
(format clojure-swank-command clojure-root clojure-swank-port) to
(format clojure-swank-command (expand-file-name clojure-root) clojure-swank-port)
which worked for me...

Thanks!

Syntax highlighting on Java with numbers

Hi, importing the following class

(:import (ncsa.hdf.hdf5lib HDF5Constants))

The syntax highlighter skips HDF5 and highlights only Constants, this seems
to be the case anytime a number is next to a capital at the start of a variable/class.

Changes to clojure-swank-command breaks use under Windows

Since clojure-swank-command now tries to pipe to sh, clojure-jack-in doesn't work on Windows. This is what I get in swank when I try clojure-jack-in:

Process swank exited abnormally with code 255
'sh' is not recognized as an internal or external command,
operable program or batch file.

Integrate with Aquamacs (feature request)

This is a feature request, rather than a bugreport, since I know you don't claim support for Aquamacs.

Clojure-mode doesn't work with Aquamacs 2.4 (current). When I install clojure-mode 1.11.5 via marmalade, I get a problem

Compiling file /Users/norman/Library/Application Support/Aquamacs Emacs/elpa/clojure-mode-1.11.5/clojure-mode.el at Thu Jan 19 18:39:10 2012
clojure-mode.el:70:1:Warning: cl package required at runtime

In clojure-mode:
clojure-mode.el:194:34:Warning: reference to free variable `paredit-mode'
clojure-mode.el:194:51:Warning: reference to free variable `paredit-version'
....

I think that clojure-mode 1.10 has worked with this version.

Points:

  • Aquamacs is becoming the 'default' emacs on OS X. It's not literally the default, but it's becoming the standard answer to the question "I want to use emacs on OS X...", and when I see folk running emacs on OS X, it's usually Aquamacs. Google suggests there's quite a few people having this clojure-mode/Aquamacs problem.
  • I don't keep track of the lineages of emacs, so I don't know if this is a big ask.
  • The aquamacs developer -- see http://aquamacs.org/ -- is pretty responsive, and if there's something obvious missing from that version, it might be easy to get it included or adjusted as appropriate. If it'd be useful, I could make a feature request there matching this one.

Install question for emacs first-timer

I just installed emacs24 and I'm trying to get to the point where I can run clojurescriptone's repl from emacs so I'm guessing that I'll need this for emacs so that the repl will run when I put it into inferior-lisp mode as I saw in clojurescript one's video.

I'm very new at emacs, knowing a smidgen of the basics from the tutorial, so I've never installed a new mode.

I'm working on a Windows7 machine, if that means anything.

My first question (aside from the request for any corrections if you sense my trajectory is erroneous in terms of the goals I've stated in the above preface) is--

Since I know that package.el comes with emacs24 I tried the "M-x package-install clojure-mode" command and get a notice saying it doesn't exist. So I need to download it, I assume, but I've never done anything like this so I need to know how I do it. Specifically, of the files in the table above the read me section how do I go about downloading those, I mean do I place them in a text file, where relative to the emacs path do I place them and do I need to use any program to do it or do I just copy and paste into a text file?

A million thanks to anyone that can either point me to the answer or can step me through this. If I knew where to look for this answer I promise I wouldn't go through this and waste anyone's time but I'm at a loss and am finding that I move a lot faster and learn a lot faster and have an overall better experience when I'm more willing to ask what seem to have the potential to be dumb questions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.