reddit / emacs

How to wrap-proofing a region: Excluding parts of a buffer from wrapping?

vidbina ยท 2022-10-22 09:31
In my config https://github.com/vidbina/dotfiles/tree/reorg-for-lit-prog/emacs#-text you may spot that I use visual-fill-column-mode and adaptive-wrap-mode to improve the readability of text in Emacs. โš ๏ธ The gotcha is that I sometimes have bits of context that I want to exclude from being "wrapped" such as tables. My current UX on this is poor as I usually want to see the table fully extended while simultaneously sneaking a peak at text in the paragraphs around it. Is there a way to do this (exclude a region from being wrapped) or is there a term that describes what I'm looking for that I should factor into my web-search queries? ๐Ÿค” There is never really a use case where the wrapped table is even readable for me so it's just a lost piece of screen real estate when I wrap the buffer. It may as well be folded away to be conjured up through something similar to C-c C-v v where can open expanded code into a preview buffer (to see how all the noweb refs resolve). How do you deal with wrapping when tables are present? Hoping to learn what I can improve about my usage to minimize this "pain". ๐Ÿ’ก For now I keep toggling between the wrapped and non-wrapped states and now that I'm typing this, I'm thinking that I can open a cloned frame or buffer. That way I can show the table non-wrapped or extended in one buffer, while I look at the wrapped peripheral text in a cloned buffer and thus have a way to keep the wrapped states apart. This however does alter the layout of buffers which is again a bit of a UX killer as it disturbs the y-flow of the text in the original buffer if you catch my drift. Looking fwd to getting schooled. Thanks for helping think along. ๐Ÿ™๐Ÿฟ
walseb ยท 2022-10-23 22:52
The package `phscroll` can be used to do this. However I found it causes emacs to hang at times. I'm using heavily customized `emacs` with `exwm` so that might have something to do with it. https://github.com/misohena/phscroll
vidbina ยท 2022-10-26 18:54
Exactly what I needed. Been happily using it for a few days not. ๐Ÿ™๐Ÿฟ Still have to manually phscroll-mode a region now and am open to pointers on how to auto phscroll all tables in an org file. Maybe my settings require a restart.
walseb ยท 2022-10-26 21:00
`phscroll` does support automatically enabling on org-tables. I think you just have to do this: (require 'org-phscroll)