clojure-emacs/clojure-mode

some-> & some->> not fontlocked

boxxxie opened this issue · 10 comments

clojure-mode version

clojure-mode (version 5.14.0)

my work around

(defvar clojure-core-macros
  `((,(concat
       "(\\(?:clojure.core/\\)?"
       (regexp-opt
        '(
          "some->"
          "some->>"
          ) t)
       "\\>")
     1 font-lock-keyword-face)))

Such font-locking lives in a separate package these days https://github.com/clojure-emacs/clojure-mode#font-locking as the expectation is that most people are using CIDER which has better dynamic font-locking.

vemv commented

It sounds worthwhile and cheap to support clojure.core macros though. Would be friendly to clojure-lsp users, for instance, I reckon.

wdyt?

@vemv Yeah, probably those we can add back to the main package. I was wondering what to do with the extra package as I guess most people don't realize that it exists.

Looking at the code we've definitely messed up something as some macros are in the main package and some in the secondary.

I guess we'll need to check how many of the things that are listed as clojure.core built-ins in the extra package are actually macros and move them to clojure-mode. I'll reopen this ticket.

point me to where i should look in the .el file, and i can compile a list of the missing macros from clojure.core

#{
 gen-class
  while
  import
  pvalues
  bound-fn
  vswap!
  with-loading-context
  delay
  gen-interface
  with-bindings
  deftype
  with-precision
  lazy-seq
  let
  defstruct
  areduce
  definline
  future
  fn
  definterface
  some->>
  amap
  extend-type
  defmethod
  time
  memfn
  extend-protocol
  reify
  defonce
  defn-
  defprotocol
  sync
  assert
  proxy-super
  loop
  with-out-str
  with-in-str
  some->
  proxy
  locking
  defmulti
  io!
  lazy-cat
  comment
  defrecord
  refer-clojure
}

that is the difference of all the clojure.core (including loads from other files) non private macros and the list that you pointed me to
here is the union in the same format as in the .el file

'("when-first" "cond->>" "gen-class" "while" "doall" "import" "pvalues" "bound-fn" "vswap!" "dosync"
 "with-loading-context" ".." "delay" "gen-interface" "with-bindings" "dorun" "if-not" "doseq" "deftype" "when-let"
 "if-some" "with-precision" "lazy-seq" "let" "->" "defstruct" "doto" "areduce" "definline" "future" "fn" "definterface"
 "as->" "when-not" "when" "some->>" "in-ns" "ns" "amap" "declare" "or" "extend-type" "defmethod" "time" "memfn"
 "extend-protocol" "cond->" "dotimes" "reify" "with-open" "defonce" "defn-" "defprotocol" "sync" "assert" "letfn"
 "proxy-super" "loop" "with-out-str" "condp" "cond" "with-in-str" "some->" "for" "binding" "with-local-vars" "proxy"
 "with-redefs" "locking" "defmulti" "if-let" "case" "io!" "lazy-cat" "comment" "defrecord" "with-redefs-fn" "and"
 "when-some" "->>" "refer-clojure" )

macros i left out are from pprint_base.clj cl_format.clj template.clj core_proxy.clj tap.clj test.clj shell.clj junit.clj repl.clj genclass.clj main.clj

vemv commented

Released as clojure-mode 5.15.0, which will be available within a couple hours