emacs

ag 2025-04-07T18:03:25.992539Z

Has anyone ever attempted to solve "wrapped lisp code" minor annoyance? i.e., when you have too narrow of a window splits and the code wraps around, I would like it to wrap "within the same indent space", not from the beginning of line. So the code that normally looks like this: https://i.imgur.com/QfOE5Dy.png with a narrower window becomes: https://i.imgur.com/KNF8dKQ.png This isn't huge deal, with experience you can even learn how to quickly mentally parse it, yet the code appears "jumbled". If only I could force it to be indented, while wrapped, something like this: https://i.imgur.com/5004tFq.png Of course then, there's a problem with strings, but in general, is there a mechanism in Emacs that would make it possible? To make things appear in a nicer way, without actually affecting the code indentation in the file?

solf 2025-04-10T12:41:18.619629Z

Thanks @l0st3d, this thread has improved my life in a non-negligible way

πŸ‘ 3
peterh 2025-04-10T17:54:10.616419Z

I’ve always been one of those 80-character guys in Emacs, since I often work in a horizontal split view on my laptop and hate to see wrapped lines or having the window scroll horizontally when I don’t wrap. But with Lisp it can often be annoying with deeply nested code where I manually tweak the aesthetics for way too long. Maybe knowing about adaptive wrap mode, I will finally try switching to auto-format on save and invest those saved minutes into hammock time. πŸ‘€

βž• 2
yuhan 2025-04-08T04:02:06.818259Z

I've hacked together something for multiline strings before: https://github.com/yuhan0/multilign which could probably be adapted to work with wrap-prefixes outside of strings

1
Ed 2025-04-09T11:04:20.050369Z

does https://elpa.gnu.org/packages/adaptive-wrap.html do what you want?

ag 2025-04-09T15:00:35.161009Z

Hmm, interesting. Will give it a try. Thanks @l0st3d

Ed 2025-04-09T15:37:56.872359Z

it looks like a version of this is now bundled with emacs 30 (if you've already upgraded πŸ˜‰ ) https://www.emacswiki.org/emacs/AdaptiveWrap

3
ag 2025-04-09T15:46:35.274579Z

Holy mother of Turing, this is exactly what I needed. Thanks a lot!

πŸŽ‰ 1