Parsing parentheses: smie vs syntax table gives one example of how to use syntax-propertize-function
but I wonder if someone could help me with another example. I'm working with clojure-mode
. Here's a recipe to reproduce the problem:
;; load with emacs -Q -l clojure-init.el
(package-initialize nil)
(setq package-enable-at-startup nil)
(unless (assoc-default "melpa" package-archives)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(setq use-package-verbose t)
(require 'use-package)
(use-package clojure-mode
:ensure t :defer t)
Then M-x clojure-mode RET
and insert
(["phonemes" java.lang.String] ["rhymingPair" [Ljava.lang.String;])
You'll see that backward-sexp
/ forward-sexp
breaks in the viscinity of the [Ljava...
and that the last few characters are understood as a comment. More specifically, ["rhymingPair" [Ljava.lang.String;]
should be understood as one valid sexp.
(type (into-array String ["Awesome"]))
returns[Ljava.lang.String;
and(list (type (into-array String ["Awesome"])) 1)
returns([Ljava.lang.String; 1)
. So if you believe in homoiconicity then it is valid code. That said,([Ljava.lang.String; 1)
can't be entered on the REPL in CIDER. I don't know if that's a CIDER bug or a bona fide feature of Clojure. The main point is that I have a bunch of output from Clojure that contains this symbol, and I'd like to be able to navigate it in Emacs via forward- and backward-sexp commands. – Joe Corneli Jun 19 '15 at 23:34if you believe in homoiconicity
-- You've watched to many clojure videos. – politza Jun 20 '15 at 9:48