clojure-emacs/clojure-mode

Infinite loop in `clojure-sort-ns` when sorting a ns with comments

ieure opened this issue · 0 comments

ieure commented

Expected behavior

The ns should be sorted.

Actual behavior

My Emacs session freezes until I hit C-g.

Steps to reproduce the problem

  1. Open an empty .clj file and put this in it:

    (ns test
      (:require [some]
                ;; [other]
                ))
    
  2. Hit M-x clojure-sort-ns RET.

  3. Emacs freezes.

If you uncomment the line with [other] and try again, it works fine. It also works fine if the #_ reader macro is used.

Environment & Version information

clojure-mode version

clojure-mode (version 5.16.0)

Emacs version

GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)

Operating system

Debian 11 "bullseye"