technomancy / swank-clojure

Swank/slime support for clojure
Eclipse Public License 1.0
412 stars 83 forks source link

Loading the slime payload upsets clojure-mode's formatting #103

Closed pjstadig closed 9 years ago

pjstadig commented 12 years ago

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.

In fact, I have found that one does not need to re-evaluate the whole clojure-mode.el file, but only the form starting on this line https://github.com/technomancy/clojure-mode/blob/c858a8aa8702b1febef2e42a42d92ff727571d4c/clojure-mode.el#L732

pjstadig commented 12 years ago

Turns out this is actually a problem with clojure-mode.

pjstadig commented 12 years ago

Actually, I'm not convinced this as a clojure-mode issue. The change to clojure-mode was to allow it to respond to indentation-update messages. For some reason slime is sending an indentation-update message that is changing deftest's indentation function from 'defun to 1.