cpitclaudel/compact-docstrings

Doesn't work

notevenaperson opened this issue · 2 comments

Hi I couldn't get this to work in any kind of buffer that I've tried. After enabling the mode nothing changes visually. For the sake of example this is my buffer:

image

I did a bit of digging to figure out what may be wrong: The empty lines haven't been assigned the compact-docstrings-face (i saw this using describe-char). So of course no effect is applied. My font-lock-keywords: Is it broken?

Value in #<buffer *scratch*>
(t
 ((compact-docstrings--matcher . #1=(0 'compact-docstrings-face prepend)))
 (compact-docstrings--matcher #1#))

Please help me debug this.

It seems to be working as expected in your screenshot: there are no docstrings, and hence no lines are made narrower.

I'd suggest starting with the docs in the readme. (add-hook 'some-mode-hook #'compact-docstrings-mode), e.g. with emacs-lisp-mode.

If you want to make all empty lines narrower, not just docstrings, then you don't want to use compact-docstrings--matcher, because what this does is "Find blank line in docstring, (…)."

The code for the whole package is about 50 lines, so I would suggest reading through if you'd like to reuse some of it for a different purpose.

HTH. Will close the issue for now since there doesn't seem to be something to fix.

Oh it seems I misunderstood from the start what this package is about.

Also it wouldn't have worked in the scratch buffer because font-lock-mode wasn't on.

I'll probably just make my own general compact-any-and-all-lines-mode. (In fact I already can:

(defun compact-docstrings--matcher (bound)
  "Find blank line in docstring, looking in point .. BOUND."
  (re-search-forward "^\n" bound t))

(but I'll simplify it to a simpler font lock regex at some point))