2

I'm using the answer from https://stackoverflow.com/questions/13559061/emacs-how-to-keep-the-indentation-level-of-a-very-long-wrapped-line but can't make it do exactly what I want

If I have this long line of code:

if some_condition:
then
    some very long long long long long long long line
fi

With:

(add-hook 'visual-line-mode-hook 'adaptive-wrap-prefix-mode)
(visual-line-mode t)

it turns to:

if some_condition:
then
    some very long long long long long
    long long line
fi

but I would like this to turn to

if some_condition:
then
    some very long long long long long
    ... long long line
fi

This doesn't work:

(setq wrap-prefix "... ")
  • One option would be to use the built-in feature and customize the variable adaptive-wrap-extra-indent, but that will not add the ellipsis. It would be necessary to modify the source code if a user wishes to see a leading ellipsis. The extra indent (for wrapped lines subsequent to the first line) can be a positive or negative number or 0. For more information about the aforementioned variable, type: M-x describe-variable RET adaptive-wrap-extra-indent RET – lawlist Oct 15 '15 at 19:45
  • The adaptive-wrap package is not built-in, but is available on GNU Elpa: elpa.gnu.org/packages/adaptive-wrap.html – Kaushal Modi Oct 16 '15 at 3:59
  • (setq adaptive-wrap-extra-indent 4) does nothing for me.. – obadz Oct 16 '15 at 9:39
  • I ended up hardcoding my elipsis in adaptive-wrap.el and now it works as I want. – obadz Oct 16 '15 at 10:57
  • @obadz Could you post the solution you found as an answer? – ShreevatsaR May 23 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.