-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adaptive fill mode broken in docstring #660
Comments
That's related to #241, right? |
I'm not entirely sure. There is somebody complaining about forcing every line to be indented after two spaces in a docstring, if I understand correctly overriding other intended indentation effects. In that regard the issue would be related. |
I was under the impression that it is a standard to have the 2 leading spaces indentation on every line in Clojure docstrings. I don't recall seeing many (any?) docstrings formatted differently. |
Indeed, also many Clojure core docstrings are formatted like this. Some research shows that it affects how |
Interestingly, many core 'nses have their docstring without the two-space indent. The two space rule seems somewhat inconsequential. Could it be that it was just overlooked in Rich's editor settings when he wrote docstrings for clojure.core and somehow became a "convention"? Edit: Indeed its different. I took some metrics manually
So these ns'es all have different second line indendation in their docstring and clojure.repl/doc prints them differently bad (ymmv, I wouldn't care, but users seem to). Still for function docstrings users can hold up the argument that 2 spaces became a convention and that probably its irreversible. Anyways, maybe these data points are more relevant to the other ticket. This ticket was supposed to point out a bug with respect to adaptive fill mode not working in docstrings. I think it can be solved without changing anything about the two space indent. |
When filling in a docstring, there is no proper adaptive filling and it always seems to fill to the beginning column of the docstring. This problem has annoyed me for more than 5 years, so I stepped a bit through the debugger, but I don't understand Emacs Lisp well enough to provide a proper fix.
Put the cursor somewhere into the indented section and press M-q. In Clojure mode, it will ruin the indentation. Proper adaptive filling will cut
as dfa sdf
and put in on the next line at col 9.My best solution so far is to set
adaptive-fill-function
toignore
andfill-paragraph-function
tonil
. So far, I haven't observed any adverse side effects but sure it breaks something.In general, there seems to be a bunch of logic implemented around docstrings in Clojure mode, but it is not very well documented and probably not working properly. Probably one could draw inspiration for how docstring indentation is solved in other LISP major modes.
I noticed that in Emacs Lisp for instance, docstrings have no special indentation behavior, and in Clojure there are two spaces prepended to each line. Its a weird convention but it seems to be somehow rooted in Clojure core? Is that what all the logic is about? Maybe getting rid of that is too much to ask for, but it would be nice if you can make adaptive filling work.
The text was updated successfully, but these errors were encountered: