Hi,

I thought I'd try my hand at writing a leo button/command/thing to rename
an external file to match the current node headline. I'm stuck at getting
the previous headline contents. How does one get to the undo history?  (and
am I even going about this the right way?)

Here's the @button stub:

-----
@
Rename an external file (any of @file, @auto, @edit, @shadow) to match the
current node name.

Typical use:

1) edit the node title: "@file foobaz.py" --> "@file bazfoo.py"
2) push rename button --> file is renamed in the filesystem
@c

d = c.scanAllDirectives(p)
#g.es(g.dictToString(d))   #uncomment to show results of above in log pane

path = c.getNodePath(p)

old_name = p.h.before_last_edit #<-- what goes here?
if old_name:
    g.os_path_finalize_join(path, old_name)

name = p.anyAtFileNodeName()
if name:
   name = g.os_path_finalize_join(path,name)
   g.es("os.rename(%s, %s)" % (old_name, name))
-----

thanks,

-matt

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to