Skip to content
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

Maybe not enable visual-line-mode by default? #45

Closed
larstvei opened this issue May 20, 2020 · 3 comments
Closed

Maybe not enable visual-line-mode by default? #45

larstvei opened this issue May 20, 2020 · 3 comments

Comments

@larstvei
Copy link
Collaborator

Hi!

I'm wondering if it would be better not to have visual-line-mode enabled by default? To me, this seems like a preference thing, more than a vital part of the mode.

I prefer setting truncate-lines to t, so that lines that go outside the window just "disappear" with only a slight indication that the line does continue. This workes well with Olivetti and visual-line-mode disabled. visual-line-mode overrides this behavior, so I need to explicitly disable it for Olivetti.

This isn't to argue that truncating lines is better in any way, but that visual-line-mode seems more like an opt-in feature to me. My suggestion would be to add a note in the README that Olivetti plays nice with visual-line-mode, and with the appropriate lisp-code to enable it together with Olivetti. Alternatively, it can be added as an option.

Feel free to close this issue with no changes if you prefer to keep visual-line-mode enabled by default 👍

@rnkn
Copy link
Owner

rnkn commented May 21, 2020

Interesting. I had always thought of Olivetti as an extension of visual-line-mode, and that it would only be used for prose writing, but I've since seen plenty of people using it for code (which I find weird but that's cool).

Yeah we could just add as a default hook with it in the :options so it appears as a checked checkbox, and remove the hardcoded stuff.

Two things I think we should consider though...

The option olivetti-recall-visual-line-mode-entry-state seems obvious to have if visual lines are hardcoded, but weird if just a hook. The thing that I'm stuck on is how to then write the doc string for this option without it sounding convoluted/complicated.

The other thing is tangential to this but I think will absorb much attention; given I'd only ever seen Olivetti as an extension of visual lines, and for writing prose, I never bothered much with compatibility with line numbering. When display-line-numbers-mode was introduced I put some fruitless effort into trying to add compatible with it, but display-line-numbers-mode is written into the C code and provides scant interfacing to Elisp. The function line-number-display-width is supposed to return the width used for displaying line numbers in the selected window (e.g. lines up to 99 return 2, up to 999 return 3) but it's never accurate. The result is you can't calculate the offset correctly and scrolling will causes the window text to jump back and forth by a column. When I approached the maintainer about this he dismissed the problem.

So I guess my feeling is without hardcoded visual lines it might present an obligation to be compatible with line numbering, which seems like a bigger problem. What do you think?

@larstvei
Copy link
Collaborator Author

Thanks for the quick reply! I never thought about the tight connection between Olivetti and visual-line-mode, because I use auto-fill-mode by default for everything, so it's is only once in a while I actually observe lines that are wrapped.

For the question of olivetti-recall-visual-line-mode-entry-state, would it be sufficient to add a note saying something like "Setting this variable will only have an effect if olivetti-enable-visual-line-mode is non-nil"?

I tried running display-line-numbers-mode and didn't see any odd-looking behavior. Is the problem that the line numbers are moved along with the margin? I don't really see the connection between visual-line-mode and line numbering (and never use line numbering anyways), so I don't see it as an issue. But then again, I think you have a better perspective on how other people use the package, and I can only speak for my usage.

In any case, I think visual-line-mode only happens to play nice with the core functionality of Olivetti, which makes me think of it as an opt-in feature. A strong argument for making it enabled by default is that there might be many users who will have to edit their configs if this is changed. I would think that most people who prefer visual-line-mode will already have it configured to be enabled for text/org/markdown buffers, but this is a mere guess.

@rnkn
Copy link
Owner

rnkn commented May 21, 2020

Cool, let's worry about line numbers another day then.

I would rather just add visual-line-mode to the hook and to its :options keyword. Does that makes sense? Can you whip up a PR?

Don't worry about the doc of olivetti-recall-visual-line-mode-entry-state, I'll think about it afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants