Fork me on GitHub
#emacs
<
2019-11-10
>
David Pham08:11:46

Anyone knows if we can do the same with Cider?

Jcaw14:11:03

There's semantic-stickyfunc, but it only works with function definitions, not the current expression.

Jcaw14:11:16

It should be fairly easy to whip something up like this.

Jcaw14:11:21

(defun my-clojure-get-current-expression ()
  (or (save-excursion
        (ignore-errors
          ;; Find outside of surrounding expression
          (while (and (not (looking-at "(")) (looking-back "'"))
            (unless (sp-backward-up-sexp)
              (error "No enclosing expression")))
          ;; Jump to first symbol
          (forward-symbol 1)
          (symbol-at-point)))
      ""))

Jcaw14:11:21

^ Just wrote that, it'll get the current expression. (Requires smartparens)

Jcaw14:11:08

Then all you need to do is put that into the header line, or a popup, etc.

Jcaw14:11:34

(E.g. hook an idle timer to cursor movement in clojure-mode)

Jcaw15:11:33

Oop - forgot smartparens doesn't throw errors. Fixed.