[NTG-context] How can I remove a blank leading line from a buffer

Hans Hagen j.hagen at xs4all.nl
Wed Aug 15 09:07:37 CEST 2018


On 8/15/2018 5:31 AM, Aditya Mahajan wrote:
> On Tue, 14 Aug 2018, Rik Kabel wrote:
> 
>> I really think, though, that a buffers.strip function would be the way 
>> to go, instead of futzing after the damage is done.
> 
> In lua, buffers.getcontent('name') gives the contents of the buffer 
> labelled 'name'. You can post-process this in whatever way you want. For 
> example, you could write a lua function userdata.strip that strips the 
> leading and ending black spaces from a string, and then call
> 
> context(userdata.strip(buffers.getcontent('name)))
local s = [[

foo

bar


bar

]]

print(string.fullstrip(s))



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list