]>
code.delx.au - gnu-emacs-elpa/blob - packages/notes-mode/mkindexcache
5 # $Id: mkindexcache,v 1.12 2008/08/08 17:41:14 johnh Exp $
7 # Copyright (C) 1994-2006 by John Heidemann.
8 # Comments to <johnh@isi.edu>.
10 # This file is under the Gnu Public License.
15 usage: $0 <index >index.el
17 Converts a processed index into elisp code to intern
18 the symbols and font-lock the buffer.
23 require 5.006; # for IO handling of :locale
25 # Force unicode for input and output.
26 # Without this requirement, unicode on the input results in incorrect
27 # (byte-level, not character-level) values of $seek,
28 # and since emacs' put-text-property is char-level,
30 use open ':locale'; # Now let $ENV{LANG} and $ENV{LC_CTYPE} determine input encoding; previously we forced utf8, but not all are pure.
33 my(@sstart, @send) = ();
40 push(@send, $seek + length($1));
43 # my $l1 = length($_);
45 # do { use bytes; $l2 = length($_); };
46 # print "; $l1 $l2\n";
49 sub round_to_power_of_8
{
51 return 8 ** (length(sprintf("%o", $n)));
54 print ";; auto-generated by mkindexcache\n";
55 print "(defun notes-index-parse-buffer-cached ()\n";
56 my($asize) = round_to_power_of_8
($#subjects) - 1;
57 print " (setq notes-subject-table (make-vector $asize 0))\n";
59 # output intern'ing code
60 print " (mapcar (function (lambda (a) (intern a notes-subject-table))) '(\n";
63 $qsubject =~ s/(["\\])/\\$1/g; #"
64 print "\t\"$qsubject\"\n";
68 # output font-lock code
69 print " (if notes-use-font-lock\n" .
71 " (remove-text-properties (point-min) (point-max) '(face nil))\n" .
72 " (mapcar (function (lambda (a)\n" .
73 " (put-text-property (car a) (cdr a) 'face notes-bold-face)))\n" .
76 print "\t\t($sstart[$_] . $send[$_])\n";