[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgreek:00069] Re: progress report



>>>>> "TAKAHASHI" == TAKAHASHI Naoto <ntakahas@xxxxxxxxx> writes:

    TAKAHASHI> 3. Description decoder (written in Emacs Lisp):
    TAKAHASHI> extracts description information (e.g. level y = Bekker
    TAKAHASHI> page, level z = line) from a tlg*.idt file.

This sounds much more efficient than my approach (my tlgidt2emacs is
just a filter, based on your tlg2emacs, that emits lisp code which is
then evaluated  by emacs).  

    TAKAHASHI> Now I am working on the jump features (e.g. `go to
    TAKAHASHI> Bekker page 32 line 5 of this work', `go to the De
    TAKAHASHI> Anima section in this file').  When finished, I resume
    TAKAHASHI> the Unicode version.

I do have a version of tlg-util.el with a working (but very simple)
jump program (tlg-goto-ref).  This prompts for the citation one
component at a time (including the full level name in the prompt
and only prompting for levels that exist in the work).  I was just
about to circulate another version of tlg-util (with a slightly
improved tlgcites2emacs that fixes a problem with titles containing
Greek in beta code: beta code backslashes were being treated as
escapes when evaluated by emacs, so grave accents disappeared).  
For what it's worth, here's an almost-functional jump function
(biggest problem is graceful error recovery from an out-of-range
reference):


(defun tlg-goto-ref ()
  "Go to a TLG line citation in the current TLG work."
  (interactive)
  (goto-char (point-min))
  (catch 'out-of-range
    (let (pl no-n no-v no-w no-x no-y no-z)
      (setq pl (list 'zref nil))
      (if tlg-level-n-name
	  (let (no-n)
	    (plist-put pl 'nref  (read-string (format "%s: " tlg-level-n-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'nref) (plist-get pl 'nref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'nref)))
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range"))))
	(setq no-n t)
	)
      (if tlg-level-v-name 
	  (let (no-v)
	    (plist-put pl 'vref  (read-string (format "%s: " tlg-level-v-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'vref) (plist-get pl 'vref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'vref)))
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range"))))
	(setq no-v t)
	)
      (if tlg-level-w-name 
	  (let (no-w)
	    (plist-put pl 'wref  (read-string (format "%s: " tlg-level-w-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'wref) (plist-get pl 'wref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'wref)))
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range"))))
	(setq no-w t)
	)
      (if tlg-level-x-name 
	  (let (no-x)
	    (plist-put pl 'xref  (read-string (format "%s: " tlg-level-x-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'xref) (plist-get pl 'xref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'xref)))	  
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range"))))
	(setq no-x t)
	)
      (if tlg-level-y-name 
	  (let (no-y)
	    (plist-put pl 'yref  (read-string (format "%s: " tlg-level-y-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'yref) (plist-get pl 'yref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'yref)))
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range"))))
	(setq no-y t)
	)
      (if tlg-level-z-name 
	  (let (no-z)
	    (plist-put pl 'zref  (read-string (format "%s: " tlg-level-z-name)))
	    (while (and 
		    (not (equal (get-text-property (point) 'zref) (plist-get pl 'zref)))
		    (< (point) (point-max)))
	      (goto-char (next-single-property-change (point) 'zref)))
	    (if (= (point) (point-max)) (throw 'out-of-range (message "out of range")))
	    )
	(setq no-z t)
	)
      (if (and 
	   (or no-n (equal (plist-get pl 'nref) (get-text-property (point) 'nref)))
	   (or no-v (equal (plist-get pl 'vref) (get-text-property (point) 'vref)))
	   (or no-w (equal (plist-get pl 'wref) (get-text-property (point) 'wref)))
	   (or no-x (equal (plist-get pl 'xref) (get-text-property (point) 'xref)))
	   (or no-y (equal (plist-get pl 'yref) (get-text-property (point) 'yref)))
	   (or no-z (equal (plist-get pl 'zref) (get-text-property (point) 'zref))))
	  (message "Reference match")
	(message "Reference not found"))
      )
    )
  )

FWIW, I've also made a number of cosmetic improvements to tlg-util
(the authtab directory and lists of works now open files on spacebar;
they open in read-only buffers; the current line is highlighted if it
contains a filename; buffer names are now less ugly, and tlg-read-authtab
and tlg-find-idt-file just go to the relevant buffer if it already exists
rather than rereading the file, while tlg-open-single-work reopens the
work requested in the same buffer if the buffer already exists; there is
a tlg-make-tlg-frame function that creates a 3-window frame with windows
for the authtab directory, an idt file listing, and a work; modes are
defined for these (tlg-mode, tlg-dir-mode, tlg-worklist-mode), with 
what I think are more useful modelines)).  I was planning to circulate
this tomorrow. Is there still a point in doing so?

    TAKAHASHI> (Maybe it would be better to write a interface to
    TAKAHASHI> Heslin's Diogenes than to write yet another TLG
    TAKAHASHI> converter.  But I have already started and cannot stop
    TAKAHASHI> myself. :-)

Heslin's search functions are particularly impressive, and they show
how horrible the tlg format is for searching.  

I am looking forward to your new set of tools.

Robin Smith              
Department of Philosophy            rasmith@xxxxxxxx
Texas A&M University                Voice (409) 845-5696
College Station, TX 77843-4237      FAX   (409) 845-0458