Saturday, May 30, 2009

NAME

NOTES

I had fallen way behind in keeping acme-sac code
up to date with inferno-os. I tried to correct that this
week by merging changes and adding files from inferno-os.

I wrote a script,
part of this labs files, to check the differences
between inferno-os and acme-sac.
I'm hoping by using this script I'll stay up to date
with inferno-os as changes are made.
The script compares sub-trees, such as the limbo
source code hierarchy, the C source code, the manual pages,
and the /lib directory. It prints out commands to
diff the files or copy the file over.

After comparing these sub-trees I built a list of files
that were intentionally
removed and files locally
changed.
Any file found "missing", where inferno-os added
new functionality, was copied over. Files that were
not marked as locally changed but nevertheless contained changes
were merged, usually overwritten with the latest from inferno-os.
There is also a list of files
added to acme-sac apart from anything
below /acme.

I found it useful to use the side-by-side
diff functionality from
lab 95.
I added some simple
interactive merge functionality that worked if you start from the
end of the file and stepped backwards through the diffs
using a PrevDiff command on the adiff output and calling
the command Merge to apply the currently highlighted change.
The implementation of this Merge command was pretty simple
because it involved just copying the selected text from the
source file over to the target. Given acme's filesystem interface
this is literally a file copy,

cp /mnt/acme/$b/rdsel /mnt/acme/$a/wrsel

The PrevDiff commands does the work of setting up
the selected texts correctly, properly handling the case
of added, changed, or deleted text.

The list of files in the changed list should be reduced. Some of these are changes that could be pushed to inferno-os. E.g., diff adds the -u flag, os has changes from rog implementing host file name translation.
Some files will need to be continually merged, such as the man page indices.

The list of files and directories removed are mostly just functionality either specific to running inferno as a native os, or the Tk functionality. There shouldn't be anything there people would really miss in an acme-sac environment. Though if there is let me know.

FILES

Monday, May 18, 2009

NAME

lab 98 - acme Ctag

NOTES

Ctag is a new client for acme that reads the
tags file generated by ctags. In particular
I worked with
Exuberant Ctags
on windows. While working on acme content-assist in
lab 94 I thought a next possible step was using ctags
for code completion.
So in writing this program I wanted to explore using exuberant ctags by doing something easier, that is by providing assistance with
code navigation.

Exuberant ctags understands many languages,
but for the current effort I tried it on Java and Python.

For example, I generated tags for the python standard
libraries,

cd:/Python30
ctags -R --excmd=number --exclude=test

Then run the client on the tags file,

Ctag /n/D/Python30/tags

What you start with is a blank window. In the tagline
is a File command. Give it an argument of a filename
which it will grep for in the ctags file.

File mailbox

It will then show all classes and methods within matching
files. You can right-click on a method name to open the
file at the line where the method is defined.

Ctag gives a top down view of a project. It is like the
Outline view of some IDEs.
A next step would be to implement the reverse direction,
but probably as part of the content assist.

FILES

NAME

lab 97 - acme Navigator

NOTES

I created a simple directory browser for acme.
Called Navigator, it opens directories in the same
window. This makes descending
deep but unfamiliar directory hierarchies
easier because it avoids the proliferation of windows
that clutter the desktop.

The client understands the command
Pin for creating a standard acme directory window
for the current directory (to pin the current directory to the desktop).
This is an example for a rather simple client for acme.

Saturday, May 16, 2009

NAME

lab 95 - acme side-by-side diff

NOTES

Here's a script I wrote to help do side-by-side diffs in Acme.
Run adiff as normal inside acme. And then
in the adiff output window type the command NextDiff.
Executing this command will step through each diff in
the adiff output and highlight the changed region in each file.

The script will highlight each line, avoiding the
cursor jump to highlighted regions as happens by plumbing
or right-clicking on a file pattern. Though the cursor jump
will occur the first time the diffed files are opened, for subsequent
execution of NextDiff for diffs within the same files the cursor
will remain over the NextDiff command and the highlighted regions
will change with file scrolling to show at least part of the
changed regions.

When the files first open you'll still need to manually arrange
the files side by side. There is no acme API for window placement.
However, the command will save some amount of scrolling, clicking,
and mouse movement within the adiff output.

Here's the script for acme-sac. Some slight changes might need to be made
for inferno, and something very similar should work in p9p acme.