1

Is it possible to have hide-show folding display multiple lines (probably 3) in the folded version? This would get us practically to having a codox-like view right inside a buffer.

What I'm trying to accomplish is using clojure-mode to display the function signature and docstring. AFAICT, hs-toggle-hiding (and hs-hide-* etc) always collapse to a single line. If hide-show isn't capable of this, do you know of another tool that could do the job?

Presently, a multi-line fn loses some key parts.

Today

(defn foo
  "Does something really fancy, and there are. Maybe. Multiple. Sentences/lines. Here."
  [x y]
  (some code ,,,))

becomes:

(defn foo...)

which is informationally kinda useless.

Goal

Instead, folds to:

(defn foo
  "Does something really fancy, and there are. Maybe. Multiple. Sentences/lines. Here."
  [x y] ...)

or maybe optimally:

(defn foo
  "Does something really fancy, and there are..." 
  [x y] ...)

Attempts

I've tried setting things like this, but I still don't see that hide-show support multi-line display:

(setq hs-special-modes-alist '((clojure-mode "(defn [-a-z]+ \"[^\"]+\"" ")" ";; " nil nil)))

(A workaround is to use set-selective-display with an argument of 3, but that only operates at a whole-buffer level, and shows other unwanted things.)

0

1 Answer 1

0

For Clojure, I'm now using cider-browse-ns as a compromise, which does a decent job of listing all the vars with their docstrings. It works in a browse-ns mode that offers:

RET     cider-browse-ns-operate-at-point
^       cider-browse-ns-all
d       cider-browse-ns-doc-at-point
n       next-line
p       previous-line
q       cider-popup-buffer-quit-function
s       cider-browse-ns-find-at-point

I found it more convenient if tweaked for an easy binding and assume we want the namespace I'm already visiting:

(key-chord-define-global "BG" (lambda () (interactive) (cider-browse-ns (cider-current-ns))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.