Re: [Ext] [code] How to auto save?

From: James Reynolds <reynolds.att.biology.utah.edu>
Date: Wed, 24 Jun 2020 21:48:16 +0000

My goal is to minimize a lot of problems I'm having because the files I open are located on a file share. If I disconnect the fileshare one problem is that I can't save the file unless I remount the fileshare. So periodic saving would solve that problem.

I'm assuming this isn't checking to see if the buffer has changed since the last save. How hard is that? And is it possible to force open a "save as" dialog if the buffer doesn't have a filename? I know I could look this up but I am still really overwhelmed by the documentation... I'm hoping you can give me some quick hints.

Another problem I have is if I try to open Textadept (or a session file) and the files in the session are located on the fileshare but the fileshare isn't mounted. Obviously it can't open the files but the problem is that Textadept immediately saves the session and excludes the previously open files so that the next time I open the session the files are not even attempted. Is there a way to not save the session file if one of the files in it doesn't load but instead to only save if I make a change to the session?

> Textadept does not report when its window loses focus.

Is this because of Scintilla? I'm just thinking about this and everything I want to change to make it more Mac like is probably because of Scintilla/GTK. I know Cocoa apps are notified when they lose focus. I have no intention of asking anyone of doing this or doing it myself, but I'm curious how difficult it would be to swap Scintilla/GTK with a native Cocoa app... If most of the logic of Textadept is in the Lua files, and if it's less than 4000 lines of code (or something), then maybe it wouldn't be that hard...

James Reynolds
Sr Systems Administrator
School of Biological Sciences
The University of Utah
801-585-3086

> On Jun 24, 2020, at 11:55 AM, Mitchell <m.att.foicica.com> wrote:
>
> WARNING: Stop. Think. Read. This is an external email.
>
> Hi James
>
> On Tue, 23 Jun 2020, James Reynolds wrote:
>
>> How do I get TA to save documents whenever I switch to a different tab, different application, or just on a timer?
>
> Try something like this in your *~/.textadept/init.lua*:
>
> events.connect(events.BUFFER_BEFORE_SWITCH, function()
> if buffer.filename then buffer:save() end
> end)
>
> or
>
> timeout(60, function() if buffer.filename then buffer:save() end end)
>
>
> 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.
>
>

-- 
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 24 Jun 2020 - 17:48:16 EDT

This archive was generated by hypermail 2.2.0 : Thu 25 Jun 2020 - 06:42:33 EDT