Re: [code] Buffer title and buffer keys

From: Mitchell <m.att.foicica.com>
Date: Wed, 8 Apr 2020 11:34:42 -0400 (EDT)

Hi,

nOn Wed, 8 Apr 2020, bai bai wrote:

> Is there a way to set buffer title? The name of new buffer is always
> "untitled", I create some scratch buffers frequently and want to rename such
> buffers.

By convention, Textadept sets a `buffer._type` property for things like the message buffer, find in files buffer, etc., and this property is of the form '[...]' (I think primarily for session saving purposes, buf I could be wrong). You could probably utilize this property.

> I find there is a "keys.mode" feature. I read the api and can only use it as
> a global key mode. I want to make a buffer only use the keys.mode I want. For
> example:
> After Switch the buffer, set key.mode = xxx, leave the buffer set key.mode
> =nil. There are events but I didn't know how to find the buffer.
>
> The main question is the first one, if I can set buffer title, or there is a
> title property, I can use the title to find buffer to solve the second one.

You can iterate over `_BUFFERS` and check if `_BUFFERS[i] == _G.buffer`. No need to check for a title, filename, etc.

Cheers,
Mitchell

-- 
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 Wed 08 Apr 2020 - 11:34:42 EDT

This archive was generated by hypermail 2.2.0 : Thu 09 Apr 2020 - 06:27:49 EDT