Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

### Bugs fixed

* [#527](https://github.com/clojure-emacs/clojure-mode/issues/527): Fix `clojure-sort-ns` mangling `:gen-class` and other non-sortable ns forms.
* Fix typos in `clojure-mode-extra-font-locking`: `halt-when?` -> `halt-when`, `simple-indent?` -> `simple-ident?`.
* Fix `doc` and `find-doc` misplaced under `clojure.core` instead of `clojure.repl` in extra font-locking.

Expand Down
9 changes: 5 additions & 4 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2221,10 +2221,11 @@ content) are considered part of the preceding sexp."
(forward-char -1)
(while (progn (forward-sexp -1)
(looking-at "(:[a-z]"))
(save-excursion
(forward-char 1)
(forward-sexp 1)
(clojure--sort-following-sexps)))
(when (looking-at "(:\\(?:require\\|import\\|use\\|refer-clojure\\|require-macros\\)\\>")
(save-excursion
(forward-char 1)
(forward-sexp 1)
(clojure--sort-following-sexps))))
(goto-char beg)
(if (looking-at (regexp-quote ns))
(message "ns form is already sorted")
Expand Down
22 changes: 21 additions & 1 deletion test/clojure-mode-util-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,27 @@
;; Some comments.
[rum.core :as rum])
(:import [clojure.lang AFunction Atom MultiFn Namespace]
java.io.Writer))"))))
java.io.Writer))")))

(it "should not mangle :gen-class"
(with-clojure-buffer "(ns foo
(:require [c]
[a]
[b])
(:gen-class
:methods [[methodOne [] String]
[methodTwo [] String]]
:init init))"
(clojure-sort-ns)
(expect (buffer-string) :to-equal
"(ns foo
(:require [a]
[b]
[c])
(:gen-class
:methods [[methodOne [] String]
[methodTwo [] String]]
:init init))"))))

(describe "clojure-toggle-ignore"
(when-refactoring-with-point-it "should add #_ to literals"
Expand Down