--- Begin Message ---
- To: Kenji Mizuochi <knj_miz@xxxxxxxxxxxxx>
- Subject: Re: I modified your tlg-util.el
- From: Robin Smith <rasmith@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Jul 2000 12:53:55 -0500
- In-reply-to: Your message of "Fri, 14 Jul 2000 01:32:46 +0900." <20000714013246D.knj_miz@d1.dion.ne.jp>
Thank you for your modifications to my tlg-util.el. In the meantime, I have been working on a rewritten version of tlg2emacs and some further additions to tlg-util.el. One change is an expanded set of options for printing references. I've also cleaned up the output so that a reference is emitted only once per line (e.g. '12a5' in Plato will be emitted as "\n12a5 <text of line>", not as "\n12\na\n5 <text of line>. I also have a simple reader for .idt files that extracts the start and end blocks for specific works, to make it possible to read only a single work (at this point, I have a rather crude patch that takes the start and end block numbers and calls a simple filter that opens the file goes to the starting offset, and dumps everything up to the ending offset to stdout; this output is then piped to tlg2emacs). Finally, I have been working on an easy way to embed references in a file. The idea is this: first, the file is read using tlg2emacs with a command line option that causes it to put the line citations up front in the format "%s_%s_%s_%s_%s\t" (I chose _ because it doesn't seem to occur in any actual TLG reference strings). Then I have a little emacs-lisp code that parses these strings to extract the reference, creates a marker at point, and adds that marker to a tree structure of references for the file. Thus, there is a marker at the beginning of every line. It is then possible to go straight to a reference just by passing the reference (as a series of components) to a function. When I have it done, I'll transfer the business of formatting the print references here: that is, the processing function that creates the list of references will delete the reference from the text buffer and replace it with a custom formatted string. As soon as I have a chance to clean it up a little, I will send you the revised tlg2emacs replacement and tlg-util.el. Crude working verions of the relevant functions are here (I'm obviously *not* an emacs-lisp programmer, but these probably give the idea): (defun tlg-reference-at-point (ref) " Create a cons cell (REF . marker) for point." (cons ref (point-marker)) ) (defun tlg-add-cite-marker (ref reflist) " Create a marker for the current point and append (REF . marker) to REFLIST unless there is already an entry for REF." ( if (not (assoc ref reflist)) (setcdr reflist (append-element (cdr reflist) (tlg-reference-at-point ref))) (message "Error: %s is already in list " ref )) ) (defun tlg-add-reflist (refname reflist) "Add an alist entry with key REFNAME and value NIL to REFLIST, if no entry exists." (if (not (assoc refname reflist)) (setcdr reflist (append-element (cdr reflist) (cons refname nil))) (message "value %s already present" refname) ) ) (defun tlg-create-level (levelname) " Return a new level list." (cons (cons levelname nil) (cons "0" "0")) ) (defun tlg-add-ref (reflist ref1 &optional ref2 ref3 ref4 ref5) "Called with only REFLIST and REF1, add reference REF1 to reference list REFLIST (using tlg-add-cite-marker). If any optional arguments are present, REF1 and all but the last are interpreted as higher-level reference values, with additions made to REFLIST as needed using tlg-add-reflist." (if ref2 (tlg-add-reflist ref1 reflist)) (if ref2 (tlg-add-ref (assoc ref1 reflist) ref2 ref3 ref4 ref5) (tlg-add-cite-marker ref1 reflist)) ) I haven't had a chance to look at your modified version yet; you may already have anticipated my ideas. With best wishes, Robin Smith
--- End Message ---