Re: [code] [textadept] How can you store in a session the line wrap mode for a buffer?

From: Mitchell <m.att.foicica.com>
Date: Sat, 13 Oct 2018 16:08:56 -0400 (EDT)

Hi Ardi,

On Sat, 13 Oct 2018, ardi wrote:

> Hi again!
>
> (sorry for posting so much these days, but this is what happens when
> you start using a new tool and you enjoy it :-)

It's not a problem. That's what we are here for :) Responses may not be so quick though.

>
> Quite often, I have in the same session buffers which need line
> wrapping (for example LaTeX source, or plain ASCII documentation, etc)
> and at the same time buffers that are best edited without line
> wrapping (C/C++ source code, for example). If I enable line wrapping
> for the buffers that need it, with the "Toggle Wrap Mode" menu
> command, while keeping the rest with wrapping off, it seems that this
> setting is not saved within the session: When you quit TA and start it
> again, the wrapping mode is lost, and all buffers are reloaded with
> the default mode (off in my case).
>
> Is there any way for keeping each buffer with its better-suited wrapping mode?

You'd have to replace Textadept's *modules/textadept/session.lua* with your own in *~/.textadept/modules/textadept/session.lua*. In your module you would want to save/restore a state that indicates whether or not a buffer is wrapped (`buffer.wrap_mode`[1]). This should be pretty easy to code up. Just start with a copy of Textadept's module and start tweaking from there.

Cheers,
Mitchell

[1]: https://foicica.com/textadept/api.html#buffer.wrap_mode

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 13 Oct 2018 - 16:08:56 EDT

This archive was generated by hypermail 2.2.0 : Sun 14 Oct 2018 - 06:31:33 EDT