minad/osm

Grid is offset

Closed this issue ยท 12 comments

When I run osm-home I get the following:
Screen Shot 2022-03-16 at 3 42 11 pm

How can I set osm to fill the buffer properly?

Setup

  • M1 Pro Macbook
  • macOS 12.0.1
  • emacs-plus@28
minad commented

Ist this spacemacs? It seems there is some global setting which breaks osm and we should umdo that setting in the osm-mode buffer.

Yep, spacemacs. What do you recommend I do to narrow down the issue?

minad commented

Let's ping some of the Spacemacs maintainers. Hopefully they can be of assistance. cc @lebensterben

minad commented

Please check if truncate-lines is non-nil in the osm-mode buffer. Does Spacemacs overwrite this setting globally?

That fixed it! For some reason truncate-lines was nil for me.

Screen Shot 2022-03-16 at 8 13 38 pm

minad commented

Great! Please ensure that this setting is not overwritten in your buffer, since osm-mode relies on it.

@shirdekel
use SPC t l to toggle truncate-lines.
Also do you call osm-home from Spacemacs home buffer? That's where line-wrap is on. And probably osm-home somehow inherited the setting. (Haven't checked it)

Turns out the issue was actually because I use (global-visual-line-mode t) in my init.el. What's the best way to keep that off only for osm-mode?

@shirdekel

Try

(add-hook 'osm-mode-hook (lambda () (truncate-lines-mode -1)))

(hand-typed on my phone, so you need to check I made no typo)

minad commented

@shirdekel I'd avoid global minor modes. Most of them are too intrusive. Also if you use global modes from packages they prohibit lazy loading of the package. Personally I use only very few benign global modes and activate most of the modes specifically only in prog or text buffers. I just checked my config and I have only these global modes for example: global-hl-todo-mode, global-auto-revert-mode, global-diff-hl-mode, corfu-global-mode. Everything else is enabled on a case by case basis. In any case, if you use global modes, carefully check what they do. global-visual-line-mode seems broken to me if it is turned on even in special mode buffers as in this case. Of course osm-mode is quite special since it only displays images.

Cool so I ended up doing this instead of the global mode:

(add-hook 'text-mode-hook (lambda () (visual-line-mode t)))

Thank you for taking the time to help!

FYI a :predicate keyword for define-globalized-minor-mode was introduced 2 years ago. However, this is not yet used frequently because it is not compatible with older Emacs versions.
Anyway, the hook works well of course, but you could also 'manage modes' by redefining the mode using define-globalized-minor-mode, and for sure it is handy to know about the :predicate keyword (and its corresponding variable) in the future.

@minad pdf-tools uses a pdf-view-incompatible-modes to check for incompatible modes. Maybe you'd like to add such mechanism also (or maybe not :)