;; Database. ;; Emacs-Time-stamp: "2007-11-22 08:57:33" (setq file-stamp "Emacs-File-stamp: \"/home/ysverdlov/leninist.biz/lb-db.el\"") (defun lb-db-make-book-instance-directory nil "Call interactively from a book's subdirectory in dired mode" ;; (interactive) (let (_dired-full-path _YYYYMMDD _rc) ;; fix! 20070631 invalid: S/B 20070701. (save-match-data (save-excursion (if (not (string= "dired-mode" (symbol-name major-mode))) (error "%s: %s" "Expecting" "dired-mode") (if (not (string-match lb-re-path-year+book (setq _dired-full-path (_-dired-get-fullpath)))) (error "%s: %s" "Dired not browsing" lb-re-path-year+book) (make-directory (setq _rc (concat _dired-full-path (if (not (string-match "/$" _dired-full-path)) "/") (setq _YYYYMMDD (lb-db-book-instance-get-next))))))) ) (revert-buffer) (goto-char (point-min)) (sfr (concat " " _YYYYMMDD "$")) (message "%s" (concat "Made directory: " _YYYYMMDD)) ) _rc)) ;; (lb-db-book-instance-get-next) (defun lb-db-book-instance-get-next nil "" (let ( _rc) (save-match-data (save-excursion (with-temp-buffer (shell-command (concat " find " lb-home " -follow -type d " " -name " lb-re-YYYYMMDD) t) ;; Should be NO trailing slash. (goto-char (point-min)) (while (sfr ".*/" nil t) (replace-match "")) ;; Check data. (progn (goto-char (point-min)) (while (and (= 0 (current-column)) (looking-at lb-re-YYYYMMDD) (goto-char (match-end 0)) (progn (forward-char 1) t))) (if (not (= (point) (point-max))) (error "%s: %s" "Data inconsistency" (_-buffer-substring-from-)))) (sort-lines t (point-min) (point-max)) (goto-char (point-min)) (setq _rc (int-to-string (1+ (string-to-int (_-current-line))))) ;;(error "%s" (_-buffer-substring-from-)) ) )) _rc)) ;; (lb-db-load-tabbish "~/leninist.biz/en/last-numbered-page.tab" 4) (defun lb-db-load-tabbish (arg1pf &optional arg2n-keyfld) "Read file ARG1 and split lines with a tab. Optional ARG2 is key field number for associative array" ;; (let (_array _key _rc) (save-match-data (save-excursion (with-temp-buffer (progn (if (null arg2n-keyfld) (setq arg2n-keyfld 1)) (insert-file-contents-literally arg1pf) (goto-char (point-min))) (while (search-forward-regexp "\t" nil t) (setq _array (split-string (_-current-line) "\t")) (if (and ;; Does it have field ARG2? (>= (length _array) arg2n-keyfld) ;; Does field ARG2 have anything in it? (> (length (setq _key (nth (1- arg2n-keyfld) _array))) 0)) (setq _rc (append _rc (list (list _key _array)))) ) ;; if (assoc "./1989/HCM242" _rc) (end-of-line) )))) _rc)) (defun lb-db-insert-<<>> (arg1p) "" ;; (interactive "p") (let (lb-pf) (when (mark) (if (< (point) (mark)) (exchange-point-and-mark)) (save-excursion (goto-char (mark)) (insert "<<")) ;; (forward-char -1) ;; ?? (insert ">>") (if (looking-at "[,:.;]+") (goto-char (match-end 0))) (if (not (looking-at "\n")) (insert "\n ")) (end-of-line) (recenter) (set-mark (point))))) (defun lb-db-fill-paragraph (arg1) "" (interactive "p") (lb-db-fill-paragraph-non-interactive)) ;; fix! ;; lb-db-fill-paragraph-non-interactive used by .tx files (local-write-file-hooks) ;; Need lb-tx-fill-paragraph-non-interactive because the ... ;; (defun lb-db-fill-paragraph-non-interactive nil " NOTE: How to disable this function during save?" ;; (let (lb-pf lb-n lb-__-tag (lb-__-length-max 0) (lb-spacesssss (concat " " " " " ")) lb-double-newlines ;; ;; fix! build this list from file "__". (lb-list-indent-extra '("APPEARRR" "COVER" "SOURCE" "NOTE")) lb-rc) (when (not (eq 'fundamental-mode major-mode)) (when (not (_-blank-line-p)) ;; What is longest __TAG__ tag name? (save-excursion (goto-char (point-max)) (while (search-backward-regexp ;; 2007.01.01 ;; lb-re-__ (concat "^" lb-re-__) nil ;; (car lb-double-newlines) t) (setq lb-__-tag (match-string 1)) (if (> (setq lb-n (length (match-string 1))) lb-__-length-max) (setq lb-__-length-max lb-n))) lb-__-length-max) ;; Indent lines beginning with whitespace. (save-excursion (goto-char (car (_-where-double-newlines))) (while (and (setq lb-double-newlines (_-where-double-newlines)) (search-forward-regexp ;; "^[ \t]+" ;; 2006.01.03 ...ignore lines w/ just one space. "^[ \t][ \t]+" (cdr lb-double-newlines) t)) ;; Now point is after 2nd or Nth space-or-tab character. (save-match-data (save-excursion (setq lb-__-tag (if (search-backward-regexp ;; 2007.01.01 ;; lb-re-__ (concat "^" lb-re-__) ;; 2006.11.13 (car lb-double-newlines) t) (match-string 1))))) ;; end save-match-data HERE! ;; (if lb-__-tag (replace-match (substring lb-spacesssss 0 (+ 6 ;; "__" and "__" and " " 2 ;; indentation (if (member lb-__-tag lb-list-indent-extra) 5 0) lb-__-length-max)))))) ;; Indentation after __TAG__. (save-excursion (setq lb-double-newlines (_-where-double-newlines)) (goto-char (car lb-double-newlines)) (while (and (setq lb-double-newlines (_-where-double-newlines)) (search-forward-regexp ;; 2007.01.01 ;; lb-re-__ (concat "^" lb-re-__) (cdr lb-double-newlines) t)) (setq lb-__-tag (match-string 1)) (setq lb-n (length (match-string 1))) (if (looking-at "[ \t]+") (replace-match (substring lb-spacesssss 0 (+ 2 (if (member lb-__-tag lb-list-indent-extra) 5 0) (- lb-__-length-max lb-n))))))) ) ) ;; *Must* return nil when used in local-write-file-hooks, otherwise, ;; buffer will *not* be saved. (setq lb-rc nil) )) (defun lb-db-check-dot-indexes-batch nil "" (lb-db-check-dot-index nil)) (defun lb-db-check-dot-indexes (arg1p) "" ;; (lb-db-check-dot-indexes nil) => nil (interactive "p") (let (lb-pf) (loop for dir in (lb-find-to-list " -type d") do (setq lb-pf (concat dir (unless (string-match "/$" dir) "/") ".index")) (lb-db-check-dot-index lb-pf)) (if (not (null arg1p)) (message "No errors.")))) (defun lb-db-check-rec-counters (arg1p) ; 2005.05.21 "" (interactive "p") (unless (featurep 'lb-batch) (save-some-buffers)) (let (lb-pf lb-pt lb-n0 lb-n1) (save-excursion (goto-char (point-min)) (unless (looking-at lb-re-bracketed-para-integer-top-of-file) (error "%s: %s" "Missing record counter at top-of-file" (buffer-string))) (setq lb-n0 (match-string-no-properties 1)) (goto-char (point-max)) (search-backward-regexp "[^ \t\n]") ;; Should be lb-n1 (setq lb-pt (search-backward-regexp "\n")) ;; Between here and previous non-whitespace char must be a \n (save-excursion (search-backward-regexp "[^ \t\n]") (unless (search-forward-regexp "\n" lb-pt t) (error "%s: %s" "Missing record counter at bottom-of-file" (buffer-string)))) (unless (looking-at "[ \t\n]*\\([0-9]+\\)") (error "%s: %s" "Missing record counter at top-of-file" (buffer-string))) (setq lb-n1 (match-string-no-properties 1)) (unless (string= lb-n0 lb-n1) (error "%s: %s" "Record counter at top and bottom do not match" (buffer-string))) ) (string-to-int lb-n0))) (defun lb-db-check-dot-index (arg1pf) "" ;; (lb-db-check-dot-index "~/leninist.biz/en/npaph/.index") (interactive) (let (lb-str lb-rec-cnt-expected lb-pt (lb-rec-cnt 0)) (with-temp-buffer (_-ifcl arg1pf) (goto-char (point-min)) (setq lb-rec-cnt-expected (lb-db-check-rec-counters nil)) (while (search-forward-regexp (concat "^" lb-re-date "\t" (int-to-string lb-rec-cnt) "\t" "\\([A-Z]+\\)[ ]*" "\t" "ysverdlov" "\n") nil t) (setq lb-str (match-string-no-properties 1)) (if (or (and (string= "SUBDIRECTORY" lb-str) (/= 0 lb-rec-cnt) nil) ;; Allow 2nd, 3rd, etc. occurrences. (and (not (string= "SUBDIRECTORY" lb-str)) (= 0 lb-rec-cnt))) (error "%s: %s" "SUBDIRECTORY record must be" "first record")) (setq lb-rec-cnt (1+ lb-rec-cnt))) ;; Old check: (if nil (error "%s: %s" (concat "Invalid start-of-record in " arg1pf) (buffer-substring-no-properties (point) (save-excursion (end-of-line) (point))))) (if (/= lb-rec-cnt-expected lb-rec-cnt) (error "%s: %s" "Record counter error" (concat "Counters at top and bottom must match, and," " must be one more than total records in file" " (assuming all records" " properly numbered from 0 to N, step +1)."))) (if (= 0 lb-rec-cnt) (error "%s: %s" "Must have 0=SUBDIRECTORY record" arg1pf)) ;; ;; Book must have __PUBL__ in first record. (when (string-match lb-re-file-book-index lb-bfn) (goto-char (point-min)) (search-forward-regexp lb-re-db-rec-header) (save-excursion (setq lb-pt (search-forward-regexp lb-re-db-rec-header))) (unless (search-forward "__BINDTYPE__" lb-pt t) (error "%s: %s" "First record missing" "__BINDTYPE__")) nil)))) (defun lb-db-insert-rec-date (arg1p) "" (interactive "p") (let (lb-n0) (beginning-of-line) (insert (lb-date) "\t") (end-of-line) ; past record number (insert "\tTABLEname\t" (lb-user-fake-login-name)))) (defun lb-db-empty-p-obsolete (arg1p) ; 2005.05.21 "" (interactive "p") (save-excursion (goto-char (point-min)) (if (looking-at "0\n\n0") (insert "\n"))) (if (string= lb-db-empty (buffer-substring-no-properties (point-min) (point-max))) t nil)) (defun lb-db-insert-rec (arg1p) ; 2005.05.21 "" (interactive "p") (unless (featurep 'lb-batch) (save-some-buffers)) ;; TO-DO: SPECIAL CASE: zero records (counter = 0). (let (lb-pf lb-pf lb-n0 lb-empty lb-rec-cnt (_dflt "BOOK") _rc) (if (save-excursion (goto-char (point-min)) (not (looking-at lb-re-bracketed-para-integer-top-of-file))) (error "%s: %s" "Top of buffer is not" lb-re-bracketed-para-integer-top-of-file)) ;; (if (lb-db-empty-p nil) (setq lb-empty t)) (setq lb-rec-cnt (lb-db-check-rec-counters nil)) ;; Add 1 to counter at top. (progn (goto-char (point-min)) (search-forward-regexp "[0-9]+") (replace-match (format "%d" (+ 1 (string-to-int (match-string-no-properties 0)))))) ;; Add date to counter at bottom. (progn (goto-char (point-max)) (search-backward-regexp "[0-9]") (search-backward-regexp "[^0-9]") (search-forward-regexp "[0-9]+") (setq lb-n0 (match-string-no-properties 0)) ;; (if lb-empty (replace-match "1")) (lb-db-insert-rec-date nil) (end-of-line) (insert "\n__TYPE__ " "\n__MEANING__ ")) ;; Add next counter. (progn (save-excursion (insert "\n\n" (format "%d" (+ 1 (string-to-int lb-n0)))))) ;; (search-backward "TABLE") (when (= 0 lb-rec-cnt) (search-forward-regexp "TABLE[a-zA-Z]*") (replace-match "SUBDIRECTORY") (search-forward "__TYPE__") (end-of-line)) (message (concat (if (< 0 lb-rec-cnt) "INSERT TABLE NAME ") "(" (buffer-file-name) ")")) (save-excursion (if (looking-at "TABLEname") (replace-match (substring (concat (read-input (concat "TABLEname (default: " _dflt "): ") nil ;; See `read-from-minibuffer' for details of HISTORY argument. (cons 'lb-db-tablenames 0) _dflt) " ") 0 8)))) ;; (search-forward-regexp "__TYPE__[ ]*" nil t) (recenter))) (defun lb-db-insert-dot-index-type nil "" (let (lb-pf lb-type lb-str (lb-hist lb-list-publ-abbrev-dash-long) _rc) ;; SEE: lb-db-find-file-hook. ;; If a copy subdirectory ("20050524") make __TYPE__ COPY and ;; insert another record. (if (string-match (concat "/" lb-re-YYYYMMDD "/.index$") (buffer-file-name)) (setq lb-type "COPY") (if (string-match (concat "/" ".index" "$") (buffer-file-name)) (setq lb-type "BOOK"))) (progn (insert lb-type) (end-of-line) (forward-char 1) (if (looking-at "__MEANING__[^\n]*") (replace-match "")) (if (string= lb-type "BOOK") (insert "__BINDTYPE__ book\n")) ;; (save-buffer 0) ;; 2006.11.18 - need just one at end? ) (progn (lb-db-insert-rec nil) (kill-word 1) (insert lb-type (substring " " 0 (- 9 (length lb-type)))) (end-of-line) (forward-char 1) (end-of-line) (if (string= "COPY" lb-type) (insert "ID") (if (string= "BOOK" lb-type) (insert " BIBLIO"))) (end-of-line) (forward-char 1) (delete-region (point) (cdr (_-where-double-newlines)))) (progn (when (string= "COPY" lb-type) (insert "__OWNER__ ") (save-excursion (insert "\n" "__REDDOT__ \n" "__APPEAR__ \n" "__BLEMISHES__ " "\n"))) (when (string= "BOOK" lb-type) (insert "__PUBL__ " (progn (while (not (member (setq lb-str (read-input "Enter publisher (or up-arrow): " "" (cons 'lb-hist 0))) lb-list-publ-abbrev-dash-long)) (setq lb-hist lb-list-publ-abbrev-dash-long)) lb-str) "\n") (insert "__WHO__ ") (save-excursion (insert "\n" "__TITLE__ \n" "__TRANSL__ \n" "__SOURCE__ \n" ;; Not sure how to abbreviate Spanish titles. (if (string= lb-lang lbg-lang-espanol) "__ABBREV__ \n" "") "\n")))) (save-buffer 0) ;; Insert value after "__TYPE__" ...and a few more fields. _rc)) (defun lb-db-shell-grep-titl2 (arg1path) "Find entries with same root letters" ;; (lb-db-shell-grep-titl2 "en/1974/FLUUR9/") (let (lb-pf lb-array lb-str lb-stub) ;; Remove .db and .index. (if (string-match "/\\([.][a-z]+\\)$" arg1path) (setq arg1path (replace-match "" nil nil arg1path 1))) (setq lb-array (split-string arg1path "/")) (setq lb-str (nth (1- (length lb-array)) lb-array)) ;; assumes no "/" @end. (if (string= "" lb-str) (nth (- (length lb-array) 2) lb-array)) (setq lb-stub (substring lb-str 0 (string-match "[0-9]" lb-str))) (if (< lb-int-db-book-hook-stub-length (length lb-stub)) (setq lb-stub (substring lb-stub 0 lb-int-db-book-hook-stub-length))) ;; Sometimes newly-created files are not listed. ;; No, that was not it. Was using "| tail" in shell-command. ;; ;; Ignore concrete books, e.g., en/1984/AP470/20050704/.index (when (< 0 (length lb-stub)) (sleep-for 0.5) (shell-command (concat "find " lb-home " -follow -type d -name '" lb-stub "*' " "| awk -F[/] '{print $(NF), \"\t\", $0 " "\"/" lb-file-dot-index "\"" ";}' " "| sort"))))) (defun lb-db-insert-dot-index-book (arg1p &optional arg2lang) " This function may change global variable lb-lang a.k.a. lbg-lang. Returns .index buffer" ;; (interactive "p") ;; fix! ;; Don't save after 1st record inserted, in case aborted. (let (lb-pf lb-path (lb-path-default arg1p) (lb-yr "") (lb-book "no lowercase letters before number") lb-message lb-rc) ;; Check optional language and maybe setq lb-lang. (if arg2lang (if (not (assoc arg2lang lb-assoc-lang)) (error "%s: %s" (prin1-to-string arg2lang) lb-assoc-lang) (setq lb-lang arg2lang))) (if (not (stringp lb-path-default)) (setq lb-path-default (concat lb-lang "/")) (if (not (string= "/" (substring lb-path-default (1- (length lb-path-default))))) (setq lb-path-default (concat lb-path-default "/"))) ;; setq lb-lang because this function intended to be used interactively. (setq lb-lang (nth 0 (split-string lb-path-default "/"))) (setq lb-yr (nth 1 (split-string lb-path-default "/"))) (setq lb-book (nth 2 (split-string lb-path-default "/")))) (setq lb-path lb-path-default) (while (or (or (if (null lb-lang) (setq lb-message "A null value: LANGUAGE")) (if (null lb-yr) (setq lb-message "A null value: YEAR")) (if (null lb-book) (setq lb-message "A null value: BOOK-ABBREVIATION"))) (if (not (string-match (concat "^" lb-re-path-year+book "$") lb-path)) (setq lb-message (concat "Not matched: " lb-path ": " lb-re-path-year+book))) (if (_-lowercase-before-optnumber-p lb-book) (setq lb-message (concat "_-lowercase-before-optnumber-p: " lb-book))) (if (not (eq 'integer (type-of (_-string-to-int lb-yr)))) (setq lb-message (concat "Not an integer: " lb-yr))) (if (or (< (_-string-to-int lb-yr) 1945) ;; fix? ;; why 2545? (> (_-string-to-int lb-yr) 2545)) (setq lb-message "Out of bounds: " lb-yr)) ) (when lb-message (message "%s" lb-message) (sleep-for 2) (setq lb-message nil)) ;; TO-DO: filename completion. (setq lb-path (read-input "Enter LL/YYYY/ABCDE999/: " lb-path)) (progn (setq lb-lang (nth 0 (split-string lb-path "/"))) ;; (setq lb-pub (nth 1 (split-string lb-path "/"))) (setq lb-yr (nth 1 (split-string lb-path "/"))) (setq lb-book (nth 2 (split-string lb-path "/"))))) (make-directory (concat lb-home lb-path) t) (setq lb-pf (concat lb-home lb-path ".index")) (progn (setq file-name-history (append (list lb-pf) file-name-history)) (if (file-exists-p lb-pf) (find-file lb-pf) (find-file lb-pf) ;; What to do when file is new. ;; fix! With prefix argument, suppress search for similar abbreviations. (if (and (integerp arg1p) (/= 4 arg1p)) (lb-db-shell-grep-titl2 lb-path)) ) (standard-display-european 1) (add-hook 'local-write-file-hooks '_-tex2unibyte) (setq lb-rc (current-buffer)) ) lb-rc)) (defun lb-db-__-namedatum-normalize-A-dot (arg1str) "Return '.' if it looks like '.' was chopped from end of 'A.' or 'A.A.'" ;; (lb-db-__-namedatum-normalize-A-dot "A") ;; (lb-db-__-namedatum-normalize-A-dot "Ab") (let (lb-str) ;; (if (= 1 (length arg1str)) "." (if (and (> (length arg1str) 2) (string= "." (substring arg1str 1 2))) ".")))) ;; fix! Why does one *-normalize have arg1str optional and the other mandatory? (defun lb-db-__-namedatum-normalize (&optional arg1str arg2__flag) "Normalize proper name data" ;; (with-temp-buffer (insert "<>") (lb-db-__-namedatum-normalize)) ;; (lb-db-__-namedatum-normalize "__TAG__ Postyshev, Vladimir.") ;; (lb-db-__-namedatum-normalize "Postyshev, Vladimir.") ;; (lb-db-__-namedatum-normalize "Malov, Yuri") ;; (lb-db-__-namedatum-normalize "E.V. Ilyenkov.") ;; (lb-db-__-namedatum-normalize ">") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "__TAG__ <> (Ed.)") ;; (lb-db-__-namedatum-normalize "__TAG__ <>>> (Ed.)") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "I. Adabashev.") ;; (lb-db-__-namedatum-normalize "I. Adabashev, et al.") ;; (lb-db-__-namedatum-normalize "Tumanov, V.A.") ;; (lb-db-__-namedatum-normalize "I. Adabashev.") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "Panov, Victor G.") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "Yu. N. Popov") ;; (lb-db-__-namedatum-normalize "I. Adabashev.") ;; (lb-db-__-namedatum-normalize "<>") ;; (lb-db-__-namedatum-normalize "") (save-match-data (let (lb-pf lb-str lb-pt0 lb-pt1 lb-i lb-len lb-msnp0 lb-msnp1 lb-msnp2 lb-msnp3 (lb-flag t) (lb-arg1 (if arg1str arg1str (buffer-string)))) (with-temp-buffer (progn (if (string= "" lb-arg1) (setq lb-arg1 "zzzzzzzzzz")) (insert lb-arg1) (_-compress-delete-whitespaces) ;; (lb-db-__-namedatum-normalize "Tumanov, V.A.~") (if (string= "~" (buffer-substring-no-properties (1- (point-max)) (point-max))) (delete-region (1- (point-max)) (point-max))) (setq lb-arg1 (buffer-string)) (goto-char (point-min))) ;; Try to normalize stuff between "<<>"" if __TAG__ present (goto-char (point-max)) (if (string-match lb-re-__ lb-arg1) ;; TOO MANY MESSAGES ;; Mark set ;; Replaced 6 occurrences ;; Mark set ;; Replaced 0 occurrences ;; Mark set ;; Replaced 0 occurrences ;; Mark set ;; Replaced 0 occurrences ;; Mark set ;; Replaced 0 occurrences ;; Mark set ;; Replaced 1 occurrence ;; ... ;; (while (search-forward-regexp "<<\\([^>]+\\)>>" nil t) ;; (replace-match ;; (lb-db-__-namedatum-normalize (match-string-no-properties 1)) ;; t t nil 1)) (while (> (point) (point-min)) (forward-char -1) (when (looking-at "<<") (delete-region (point) (+ 2 (point))) (setq lb-pt0 (point)) (while (and (not (looking-at ">>")) (< (point) (point-max))) (forward-char 1)) (delete-region (point) (+ 2 (point))) (setq lb-pt1 (point)) (goto-char lb-pt0) (setq lb-str (buffer-substring-no-properties lb-pt0 lb-pt1)) (delete-region lb-pt0 lb-pt1) (insert (lb-db-__-namedatum-normalize lb-str)))) ;; Default action (arg1str is just a name). (goto-char (- (point-max) 2)) (if (looking-at ">>") (replace-match "")) (goto-char (point-min) ) (if (looking-at "<<") (replace-match "")) (setq lb-msnp3 nil) ;; 1 space; 0 comma (no '.'). (when (and lb-flag (or ;; AaAaA AaAaA (looking-at (concat "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\) " "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\)[.]?$")) )) (setq lb-flag nil) (setq lb-msnp1 (match-string-no-properties 1)) (setq lb-msnp2 (match-string-no-properties 2)) ;; NOTE: Never need to add "." chopped from end of "A.". (replace-match (concat lb-msnp2 " (" lb-msnp1 ")"))) ;; 1 space; 0 comma ('.'). (when (and lb-flag (or ;; A. AaAaA ;; A.A. AaAaA ;; fix! ;; In lb-defvar.el, need lb-re-multilingual-a-z-UPPER. ;; In lb-defvar.el, need lb-re-multilingual-a-z-LOWER. (looking-at (concat "\\([A-Z][a-z]?[.][ ~]?\\)?" "\\([A-Z][.]\\)" "[ ~]" "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\)[.]?$")) )) (setq lb-flag nil) (setq lb-msnp1 (match-string-no-properties 1)) (setq lb-msnp2 (match-string-no-properties 2)) (setq lb-msnp3 (match-string-no-properties 3)) ;; NOTE: Never need to add "." chopped from end of "A.". (replace-match (concat lb-msnp3 " (" lb-msnp1 lb-msnp2 ")"))) ;; 1 space; 1 comma. (when (and lb-flag (or ;; AaAaA, AaAaA ;; AaAaA, A. ;; AaAaA, A.A. (looking-at (concat "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\), " "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\)[.]?$")) (looking-at (concat "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\), " ;; fix! ;; In lb-defvar.el, need lb-re-multilingual-a-z-UPPER. ;; In lb-defvar.el, need lb-re-multilingual-a-z-LOWER. "\\([A-Z][.][A-Z]\\)[.]$")) )) (setq lb-flag nil) (setq lb-msnp1 (match-string-no-properties 1)) (setq lb-msnp2 (match-string-no-properties 2)) (replace-match (concat lb-msnp1 " (" lb-msnp2 (lb-db-__-namedatum-normalize-A-dot lb-msnp2) ")"))) ;; 2 spaces; 1 comma. (when (and lb-flag (or ;; AaAaA, AaAaA G. (looking-at (concat "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\), " "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\) " "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\)[.]?$")) ;; AaAaA, AaAaA A. (looking-at (concat "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\), " "\\([" lb-re-multilingual-a-z ;"a-zA-Z" "]+\\) " ;; fix! ;; In lb-defvar.el, need lb-re-multilingual-a-z-UPPER. ;; In lb-defvar.el, need lb-re-multilingual-a-z-LOWER. "\\([A-Z][.][A-Z]?\\)[.]?$")) )) (setq lb-flag nil) (setq lb-msnp1 (match-string-no-properties 1)) (setq lb-msnp2 (match-string-no-properties 2)) (setq lb-msnp3 (match-string-no-properties 3)) (replace-match (concat lb-msnp1 " (" lb-msnp2 " " lb-msnp3 (lb-db-__-namedatum-normalize-A-dot lb-msnp3) ")"))) (downcase-region (point-min) (point-max)) (upcase-initials-region (point-min) (point-max))) ;; (_-compress-delete-whitespaces) (setq lb-arg1 (buffer-string))) ;; (if (string-match "Et[ ~]Al[.]" lb-arg1) (setq lb-arg1 (replace-match "et~al." t t lb-arg1))) ;; " Of " (cannot use string-match because " Of " case-INsensitive). (setq lb-arg1 (_-downcase-nonsignifs lb-arg1)) ;; DONE. (if (string= lb-arg1 "Zzzzzzzzzz") (setq lb-arg1 "")) (if arg1str lb-arg1 (delete-region (point-min) (point-max)) (insert lb-arg1))))) (defun lb-db-__-get- (arg1__ arg2pf &optional arg3norm-ws arg4keepers) "Return data from field __'ARG1'__ in file ARG2 (a .db created by lb.sh). Returns a string except for: NAMEDATA => ((\"AUTHOR\") . \"__AUTHOR__ Michajlovic, Viktor Cchikvadze\\n\") YEAR => (\"en\" \"1982\" \"FMLP480\") Optional ARG3, if non-nil, normalizes whitespace. Optional list ARG4 will keep certain types of markup like '<>'" ;; (lb-db-__-get- "NAMEDATA" "~/leninist.biz/en/1972/LIT9/.db") ;; (lb-db-__-get- "NAMEDATA" "~/leninist.biz/en/1974/FMLP662/.db") ;; (lb-db-__-get- "TITLEE" "~/leninist.biz/en/1972/LIT9/.db") ;; (lb-db-__-get- "TITLE" "~/leninist.biz/en/1972/LIT9/.db") ;; (lb-db-__-get- "TITLE" "en/1972/LIT9") ;; (lb-db-__-get- "AUTHORS" "~/leninist.biz/en/1982/FMLP480/.db") ;; (lb-db-__-get- "YEAR" "~/leninist.biz/en/1982/FMLP480/.db") ;; OBSOLETE: ;; (lb-db-__-get- "PUBLISHER" "~/leninist.biz/en/1982/FMLP480/.db") ;; (lb-db-__-get- "PUBL" "~/leninist.biz/en/1982/FMLP480/.db") (let (lb-pf lb-msnp1 lb-msnp2 lb-msnp3 lb-msnp4 lb-str lb-list (lb-list-__-in-path ;; fix? YEAR good. What about language and ebookid? '("YEAR" "PUBLISHER" "PUBLLLLL")) lb-rc) (save-match-data (setq arg1__ (lb-db-__-del-__ arg1__)) ;; If arg2pf is not a pathfile for .db: (when (not (string-match lb-file-db arg2pf)) ;(file-exists-p arg2pf)) (if (not (= 3 (length (split-string arg2pf "/")))) ;; Accept any pathfile that has a book id. (setq arg2pf (lb-get-id-from-path arg2pf))) ;; Accept book id (lang/year/ZZ999). (setq arg2pf (concat lb-home arg2pf "/" lb-file-db))) ;; (setq arg2pf (command-line-normalize-file-name-then-some arg2pf)) ;; (cond ((member arg1__ lb-list-__-in-path) (if (not (string-match lb-re-path-year+book arg2pf)) (error "%s: %s" "Not a valid lb-re-path-year+book" arg2pf) (setq lb-rc (list (setq lb-msnp1 (match-string-no-properties 1 arg2pf)) (setq lb-msnp2 (match-string-no-properties 2 arg2pf)) (setq lb-msnp3 (match-string-no-properties 3 arg2pf)))))) (t (save-excursion (with-temp-buffer (_-ifcl arg2pf) ;; Important! ;; replace-match("
A close-up: ... ;; Signaling: (error "Invalid use of `\\' in replacement text") (_-tex2unibyte) ;; 2006.12.20 (loop for elt in arg4keepers do (cond ((string= "<<" elt) t) (t (error "%s: %s" "Invalid choice" elt)))) ;; << (when (not (member "<<" arg4keepers)) (goto-char (point-min)) (while (search-forward-string "<<" nil t) (replace-match "") (search-forward-string ">>") (replace-match ""))) (goto-char (point-max)) (cond ((string= "NAMEDATA" arg1__) (progn (search-backward "__TITLE__") (search-backward "__PUBL__")) (setq lb-str (buffer-substring-no-properties (point-min) (point))) (setq lb-rc (cons (with-temp-buffer (setq lb-list nil) (insert lb-str) (goto-char (point-min)) (while (search-forward-regexp lb-re-__ nil t) (setq lb-list (append lb-list (list (match-string-no-properties 1))))) lb-list) lb-str))) ;; end of NAMEDATA. (t (if (not (search-backward (concat "__" (lb-db-__-del-__ arg1__) "__") nil t)) nil (if arg3norm-ws (setq lb-rc (_-normalize-whitespace (lb-db-__))) (setq lb-rc (lb-db-__))))))))))) lb-rc)) (defun lb-db-__-table (arg1__ arg2dblist &optional arg3stale) "Return pathfile of table with variable __ARG1__ and corresponding .db file from database list ARG2. Potentially create \".ARG1\" (.TITLE and .PEOPLE). Optional ARG3, if non-nil, will simply return pathfile w/o checking time stamps. Optional ARG3, if non-nil, may return pathfile w/ a stale table" ;; (lb-db-__-table "TITLE" (lb-get-diskfilename ".db.list" nil t)) ;; (lb-db-__-table "TITLE" (lb-get-diskfilename ".db.list" nil t) t) ;; ;; What Is Property?: ~/leninist.biz/en/./1987/WP9/.db ;; What Is Socialism? ~/leninist.biz/en/./1986/WS9/.db ;; What Is The State? ~/leninist.biz/en/./1986/WTS9/.db ;; (setq arg1__ (lb-db-__-del-__ arg1__)) ;; => "TITLE" (let (lb-pf lb-str lb-secs (lb-secs-max 0) (lb-fnd (file-name-directory arg2dblist)) arg9lang lb-pf-rc) (setq arg9lang lb-lang) (if (not (file-exists-p arg2dblist)) (error "%s: %s" "File not found" arg2dblist)) (setq lb-pf-rc (concat lb-home arg9lang "/." arg1__)) ;; (if (and arg3stale (file-exists-p lb-pf-rc)) lb-pf-rc (save-match-data (with-temp-buffer (_-ifcl arg2dblist) (goto-char (point-min)) ;; (if (not (file-exists-p lb-pf-rc)) (setq lb-secs-max nil) ;; Find most recently created file in this list. (while (< (point) (point-max)) (if (> (setq lb-secs (_-file-seconds (concat lb-fnd (setq lb-str (_-current-line))))) lb-secs-max) (setq lb-secs-max lb-secs)) (end-of-line) (forward-char 1))) ;; (when (or (not lb-secs-max) (> lb-secs-max (or (_-file-seconds lb-pf-rc) 0))) (if (string= "PEOPLE" arg1__) (progn (erase-buffer) ;; Files "TA-authors.tab" through "TZ..." in "en" were ;; created by lb-mu-spawn-authdata-by-letter (loop for i in (split-string ;; lb-az lb-AZ "") do (setq lb-pf (concat lb-home arg9lang "/" ;; 2006.11.17 ;; i (concat "T" i "-authors.tab") )) (_-ifcl (if (member i '("s" "t" "m" "b")) ;; Always try to insert common ones. ;; If one of these does not exist, something wrong. lb-pf (if (file-exists-p lb-pf) lb-pf "/dev/null")))) (goto-char (point-min)) (flush-lines "^[^A-Z]")) (goto-char (point-min)) (while (< (point) (point-max)) (setq lb-pf (concat lb-fnd (_-current-line))) (if (not (setq lb-str (lb-db-__-get- arg1__ lb-pf))) (delete-region (point) (save-excursion (end-of-line) (1+ (point)))) (insert (lb-db-__-title-normalize lb-str) "\t" lb-fnd) (end-of-line) (forward-char 1)))) (sort-lines nil (point-min) (point-max)) (write-region (point-min) (point-max) lb-pf-rc)))) lb-pf-rc))) (defun lb-db-__-title-normalize (arg1str &optional arg2__flag) "Normalize title string, such as move 'A' and 'The' to end after a comma. Optional ARG2 is passed to _-compress-delete-whitespaces (remove __TAG__?)" ;; (lb-db-__-title-normalize "My Title") => "My Title" ;; (lb-db-__-title-normalize "A Title") => "Title, A" ;; (lb-db-__-title-normalize "A Title:") => "Title:, A" ;; (lb-db-__-title-normalize "A A Title") => "Title, A A" (save-match-data (let (lb-pf lb-msnp0 lb-msnp1 lb-rc lb-flag-comma lb-beg lb-end lb-n-total (lb-n 0)) (with-temp-buffer (progn (insert arg1str) (_-compress-delete-whitespaces nil arg2__flag) (setq lb-n-total (length (buffer-string)))) (goto-char (point-min)) (while (and (setq lb-beg (point)) ;; fix? ;; lb-re-multilingual-a-z ? (search-forward-regexp "\\([a-zA-Z0-9.~]+\\)[', ]*" (if (> (- lb-n-total lb-n) (point)) (- lb-n-total lb-n) nil) t)) (setq lb-end (match-end 0)) (setq lb-msnp0 (match-string-no-properties 0)) (setq lb-msnp1 (match-string-no-properties 1)) (setq lb-n (+ lb-n (length lb-msnp0))) (if ;; fix! ;; Also use a regexp. ;; EG, lb-re-title-nonsignif-first (handle both "A" and "V."). (not (member lb-msnp1 lb-list-title-nonsignif-first)) (goto-char (point-max)) (goto-char (point-max)) (when (not lb-flag-comma) (insert ", ") (setq lb-flag-comma t)) (insert lb-msnp0) (goto-char (point-min)) (delete-region (point) (1+ (- lb-end lb-beg))))) (_-compress-delete-whitespaces) (buffer-string))))) (defun lb-db-__-del-__ (arg1__ &optional arg2del-all) "Delete both '__' from string '__FOO__' Optional ARG2, if non-nil, deletes 'FOO' too" ;; (lb-db-__-del-__ "__FOO__") => "FOO" ;; (lb-db-__-del-__ "__FOO__ bar" t) => " bar" ;; (lb-db-__-del-__ "FOO") => "FOO" (let (lb-pf lb-str _rc) (save-match-data (setq _rc (upcase arg1__)) ;; Delete "__" from arg. (when (string-match ;; "\\(__\\)[^ \t]+\\(__\\)" _-re-__ _rc) (setq lb-str (match-string-no-properties 1 _rc)) (setq _rc (replace-match (if arg2del-all "" lb-str) nil nil _rc)))) _rc)) (defun lb-db-__ (&optional argopts) "" ;; Return data from field with point when visiting a .db/.index file. (let (lb-pf lb-str) (save-excursion (save-match-data (end-of-line) (progn (search-backward-regexp lb-re-__) (goto-char (match-end 0))) (setq lb-str (buffer-substring-no-properties (point) (if (search-forward-regexp lb-re-__ nil t) (match-beginning 0) (if (search-forward-regexp lb-re-db-rec-header nil t) (match-beginning 0) (if (save-excursion ;; .index or .db? (search-backward-regexp lb-re-db-rec-header nil t)) (progn (goto-char (point-max)) (search-backward-regexp "[0-9]") (search-backward-regexp "\n") (point)) ;; .index (point-max)))))) ;; .db (with-temp-buffer (insert lb-str) (_-tex2unibyte) ;; (when nil ;; DO NOT Delete <<>> markers. (goto-char (point-max)) (while (search-backward ">>" nil t) (delete-region (point) (+ 2 (point))) (search-backward "<<" nil t) (delete-region (point) (+ 2 (point))))) (buffer-string)))))) ;; (lb-db-__-search- "forward") (defun lb-db-__-search- (arg1dir &optional arg2re arg3pf) "Searches in direction ARG1 (forward or backward) for optional REGEXP ARG2. Returns list with point, match-string 0, and match-string 1" ;; (let (_msnp0 _msnp1 _rc) (if (not arg2re) (setq arg2re lb-re-__)) (progn (if (string= "forward" arg1dir) (setq _rc (search-forward-regexp arg2re nil t)) (if (string= "backward" arg1dir) (setq _rc (search-backward-regexp arg2re nil t)) (error "%s: %s" "Expecting" "'forward' or 'backward'"))) (if _rc (setq _rc (list _rc (setq _msnp0 (match-string-no-properties 0)) (setq _msnp1 (match-string-no-properties 1)))))) ;; fix? ;; Compare tagname with list of tagnames in __? ;; Or do that outside of Emacs Lisp (cron job)? (when _rc ;; 2006.09.05 ;; To left should be whitespace including two newlines. (when (or (null arg3pf) (and (not (string= "__" (file-name-sans-directory arg3pf))) (not (string= ".db" (file-name-sans-directory arg3pf))) (not (string= ".db" (file-name-sans-directory arg3pf))))) (when (and (not (eq 'xml-mode major-mode)) ) (save-excursion (goto-char (match-beginning 0)) (save-match-data (_-move-backward-whitespace) (if (not (looking-at (concat "[ \t]*" "[\n]" "[ \t]*" "[\n]"))) (error "%s: %s" (concat "Expecting blank line above __TAG__") (concat "\n" (_-buffer-substring-from-)))))))) ;; ) _rc)) ;; (lb-db-get-__-tags "~/leninist.biz/en/html/htmm/book.htmm") ;; (lb-db-get-__-tags "~/leninist.biz/__") ;; (lb-db-get-__-tags lbg-text-indextx) ;; (lb-db-get-__-tags "~/leninist.biz/en/1980/CCCWP251/.db") (defun lb-db-get-__-tags (&optional arg1text) "Return list of all __TAGS__ in file" (_-dfun-hook "lb-db-get-__-tags") ;; (let (lb-str lb-list (lb-current-buffer (current-buffer)) ) (with-temp-buffer (progn (if (not arg1text) (set-buffer lb-current-buffer) (_-ifcl arg1text) ;; 2006.12.05 - need to know major-mode (normal-mode)) (goto-char (point-min))) ;; (while (lb-db-__-search- "forward" nil arg1text) (setq lb-str (match-string 0)) (if (and (not (string-match "_COMMENT__$" lb-str)) (not (member lb-str lb-list))) (setq lb-list (append lb-list (list lb-str)))))) lb-list)) ;; (lb-db-list-__-fields) (defun lb-db-list-__-fields nil "" (let (lb-rc lb-list lb-item) (with-temp-buffer (_-ifcl lb-pf-__) (goto-char (point-min)) (keep-lines "^[<][<]WHO[0-9][0-9][>][>]") (loop for lb-item in (_-something-to-list (buffer-string)) do (setq lb-list (split-string lb-item)) (setq lb-rc (append lb-rc (list (nth 1 lb-list)))))) lb-rc)) (defun lb-db-insert-region-into-index-tab (arg1) " fix! Make prefix argument accept very large regions but not more than 1000" ;; (interactive "p") ;; fix! Error if not in instance directory, e.g., en/1972/CMTTC290/20070511 ;; fix! Change n+tilde (n-ye) to "n". Etc. (for other Spanish letters). (let (_str2ins _item _row _hist _list _cons _bfn _fn _tag _tag-flag _index-tab _flag _rc) (when (and tx (string-match "__" (car (_-para))) (or (string= lb-file-tx (setq _fn (file-name-sans-directory (bfn)))) (string-match lb-re-tx-100pages _fn))) (progn ;; Get string from .tx file ;; Trap goofs. (if (and (/= (point) (mark)) (> (abs (- (mark) (point))) 170 )) (error "%s: %s" "Too much region" "Change threshold or use prefix arg")) ;; (if (< (point) (mark)) (exchange-point-and-mark)) ;; C-space sets mark to point. If so, take CDATA. (when (= (point) (mark)) (setq _cons (_-where-double-newlines)) (if (or (not (string-match ">" (car (_-para)))) ;; 2007.07.14 - if only BR tag(s): (not (save-excursion (goto-char (car _cons)) (setq _tag-flag nil) (while (sfr "<\\([a-zA-Z]+\\)" (cdr _cons) t) (if (not (string= "br" (match-string-no-properties 1))) (setq _tag-flag t))) _tag-flag))) ;; No SGML markup (maybe except BR) in LVL paragraph. (progn (goto-char (car _cons)) (if (looking-at lb-re-__-lvl) (goto-char (match-end 0)) (error "%s: %s" "err" "ror")) (_-move-forward-whitespace) (set-mark (point)) (goto-char (cdr (_-where-double-newlines nil t)))) ;; Got SGML markup. (goto-char (cdr _cons)) (while (and (search-backward-string ">" (car (_-where-double-newlines)) t) ;; Skip back over BRs. ;;2007.07.14 (save-excursion (sbr "<") ;;2007.07.14 (looking-at "<[bB][rR]")) (set-mark (1+ (point))))) (while (and (search-forward-string "<" (cdr (_-where-double-newlines)) t) ;; Skip forward over BRs. ;;2007.07.14 (save-excursion (sbs "<") ;;2007.07.14 (looking-at "<[bB][rR]")) )) (forward-char -1))) ;; (setq _str2ins (buffer-substring-no-properties (point) (mark)))) (progn ;; View .tab before answering prefix question. (delete-other-windows) (split-window) (find-file-other-window (concat (file-name-directory (bfn)) (if (not (string= _fn lb-file-tx)) "../" ;; If inside index.tx do not back up one subdirectory. "") lb-file-indextab)) (if (= 1 (point-max)) (_-ifcl (concat (file-name-directory (setq _bfn (bfn))) "../../" (file-name-sans-directory _bfn)))) (goto-char (point-max))) (setq _hist (car minibuffer-history)) (setq ;; Construct row. _row (concat "hrefs\t01\t" (setq _GLOBAL-str4prefix (read-input "Prefix (no trailing dash): " (when _hist (cond ;; 2007.10.03 - no numbering: en/1986/SCAD300 ((string= "" _GLOBAL-str4prefix) _GLOBAL-str4prefix) ;; Add 1 to number. ((string-match "^[0-9]+$" _hist) (format (concat "%0" (int-to-string (length _hist)) "d") (1+ (string-to-int _hist)))) ((string-match ;; "^\\([0-9]+[.]\\)+\\([0-9]+\\)$" "[.-]\\([0-9]+\\)$" _hist) (replace-match (format (concat "%0" (int-to-string (length (match-string-no-properties 1 _hist))) "d") (1+ (string-to-int (match-string-no-properties 1 _hist)))) t t _hist 1)) (t _hist))))) ;; (if (> (length _GLOBAL-str4prefix) 0) "-" "") ;; (with-temp-buffer (insert _str2ins) ;; ON-THE-FLY. ;; 2007.08.23 (goto-char (point-min)) (while (sfs """ nil t) (replace-match "")) (goto-char (point-min)) (while (search-forward-regexp (concat "['" ;; , ":!`?]") nil t) (replace-match "")) ;; (goto-char (point-min)) (while (search-forward-string "<" nil t) (_-sgml-del-tag)) ;; ;; fix! make into a function. (goto-char (point-min)) (while (search-forward-regexp "[\\]." nil t) (replace-match "")) ;; ;; fix! accented characters to plain keyboard characters. (progn (goto-char (point-min)) (while (sfr "[\r]\\([-][0-9][0-9]?\\)" nil t) (replace-match "" t t nil 1)) ;; (_-compress-delete-whitespaces)) (goto-char (point-max)) (while (search-backward-string " " nil t) (replace-match ".")) ;; Remove accents from letters for URL names. ;; fix! do this for lb-db-insert-region-into-index-tab too! (goto-char (point-min)) (while (sfr "." nil t) (if (setq _list (assoc ;; 2007.08.07 ;; (match-string-no-properties 0) ;; (string-to-char (format "%c" 243)) _> 243 (string-to-char (match-string-no-properties 0)) lb-assoc-espanol-accented-to-un)) (replace-match (nth 1 _list)))) ;; 2007.07.16 - leading integer, period, and space-as-period. (goto-char (point-min)) (if (looking-at "[0-9][0-9]?[.][.]") (replace-match "")) ;; 2007.10.03 - trailing period. (goto-char (point-max)) (if (looking-at-backward "[,.]") (replace-match "")) (goto-char (point-min)) (while (sfr "[,][.]" nil t) (replace-match ",")) ;; 2007.11.22 (goto-char (point-min)) (while (sfs ".." nil t) (replace-match ".")) ;; 2007.11.22 (_-strip-^^-anchors) (buffer-string) ) ;; ON-THE-FLY. ;; "\t.\t.\n")) (progn (search-backward-string "ALPHA_LVL0") (beginning-of-line) (insert _row) (forward-line -1) (sfr "[\t]") (sfr "[\t]") ;; 2007.03.28 (if (> (length _GLOBAL-str4prefix) 0) (forward-char (+ (length "-") (length _GLOBAL-str4prefix)))) (recenter)) (setq _flag t)) (if _flag (message "%s" "Renumber col. 2 with M-x tab-renumber-col-") (message "%s: %s" "FAILED. POSSIBILITIES" (concat " 1=missing__TAG " " 2=not-tx " " 3=not-index.tx " " 4=not-999.tx " ) )) _rc)) ;; (lb-db-go-speed-racer-inventory) (defun lb-db-go-speed-racer-inventory nil "" (interactive) (let (lb-inventory-el lb-inventory-disk _pathfile _str (lb-go-speed-racer-self "lb-go-speed-racer") (lb-re-lang-plus (concat "\\(" lb-re-lang "/" "[^\"\n]+" "\\)")) _rc) (save-match-data (save-excursion (with-temp-buffer (_-ifcl (concat lb-home lb-go-speed-racer-self ".el")) (goto-char (point-min)) (setq _str nil) (while (sfr (concat "(" "lb-ht" _-whitespaces-noM "\"" lb-re-lang-plus) nil t) (setq _pathfile (match-string-no-properties 1)) (setq _str (concat _str _pathfile "\n"))) (erase-buffer) (insert _str) (sort-lines nil (point-min) (point-max)) (setq lb-inventory-el (_-buffer-to-list))) (with-temp-buffer (loop for lang in lb-list-lang do (insert (lb-list-index-text lang))) (sort-lines nil (point-min) (point-max)) (goto-char (point-min)) (while (sfr (concat "/" lb-re-lang-plus "/index") nil t) (setq _pathfile (match-string-no-properties 1)) (_-app 'lb-inventory-disk _pathfile))) (loop for i in lb-inventory-disk do (if (not (member i lb-inventory-el)) (error "%s: %s" (concat "Not in " lb-go-speed-racer-self) i))) )) _rc)) (provide 'lb-db) ;;; ;