Trying it out got me to thinking that it would be handy to be able to log 
quick little notes.  The following script writes the cursor line on the 
body to a note log file, whose path can optionally be specified in a 
setting.  The idea is that you could write a brief one-line note and pop it 
right into the log file with a time stamp -

"""Write cursor line to a log file."""
from pathlib import Path
import time

LOG = c.config.getString('notelog') or '~/.leo/temp/notelog.txt'
ACTUALPATH = Path(LOG).expanduser()

w = c.frame.body.wrapper
j = w.getInsertPoint()
s = c.p.b
beg, end = g.getLine(s, j)
line = s[beg:end]

if line:
    now = time.time()
    localtime = time.strftime("%Y-%m-%d %H:%M", time.localtime(now))
    with open(ACTUALPATH, 'a', encoding = 'utf-8') as f:
        f.write(f'{localtime}\t{line}\n')

You could do the same thing by keeping a text editor window with the log 
file open all the time, but if you are working with Leo anyway this would 
be more convenient.
On Wednesday, May 17, 2023 at 5:26:25 AM UTC-4 Edward K. Ream wrote:

> On Tuesday, May 16, 2023 at 5:31:04 PM UTC-5 tbp1...@gmail.com wrote:
>
> The script registers as an idle time handler.  If a minute has elapsed 
> since the last check, the script looks to see if the currently focused 
> outline and node have changed since the last check.  If so, it writes the 
> time and the node's UNL to the log file.
>
>
> Clever idea. I use the github issue tracker for almost everything I do. 
> That's usually a good enough reminder :-)
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/8de20fe6-3374-4d1f-8861-b08abea9ee24n%40googlegroups.com.

Reply via email to