I recently spell-checked all of LeoDocs.leo. I copied my local version of
the spelling dictionary, spellpyx.txt to leo-editor/ekr-spellpyx.txt. This
will serve both as a backup and a recommended starting point for
leo/plugins/spellpyx.txt. Not that git does *not* track this latter file,
on the theory that people's local changes to this file should not affect
Leo's git repo.
As part of checking my spell checking, I created the following one-line
@button script, to be applied to the body text of a node containing the
spelling dict::
p.b = ''.join(sorted(set(g.splitLines(p.b.rstrip()+'\n'))))
This replaces p's body text by it's previous text, sorted, with all
duplicate lines removed, ensuring a trailing newline. Quite a one-line Leo
script :-)
This was good for prototyping, but it's too dangerous for general use.
Here is a safer script, now in scripts.leo:
if 1:
fn =
g.os_path_finalize_join(g.app.loadDir,'..','..','ekr-spellpyx.txt')
with open(fn) as f:
s = ''.join(sorted(set(g.splitLines(f.read().strip()+'\n'))))
with open(fn,'w') as f:
f.write(s)
g.es('done',len(s))
else:
p.b = ''.join(sorted(set(g.splitLines(p.b.rstrip()+'\n')))
Yet another reason why I love Python.
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.