This will allow it to find user-defined or modified bibtex/tm-STYLE.scm
files both when the supports_db() returns true and when it returns false
and the bibtex command is not found.

I will need this for upcoming support for using Juris-M / Zotero as a
citation backend. It will be similar to the support for Zotero in
OpenOffice.
diff --git a/src/TeXmacs/progs/database/bib-manage.scm b/src/TeXmacs/progs/database/bib-manage.scm
index 3ef9e42..5183e08 100644
--- a/src/TeXmacs/progs/database/bib-manage.scm
+++ b/src/TeXmacs/progs/database/bib-manage.scm
@@ -264,10 +264,17 @@
 (define (bib-file? f)
   (and (url? f) (== (url-suffix f) "bib")))
 
+(tm-define (is-tm-bibtex-style? style)
+  (let ((style (or (and (string-starts? style "tm-")
+                        (string-drop style 3))
+                   style)))
+    (not
+     (not
+      (search-path %load-path (string-append "bibtex/" style ".scm"))))))
+
 (define (bib-compile-sub prefix style names . bib-files)
   (set! names (list-remove-duplicates names))
-  (if (in? style (list "tm-abbrv" "tm-acm" "tm-alpha" "tm-elsart-num"
-                       "tm-ieeetr" "tm-plain" "tm-siam" "tm-unsrt"))
+  (if (is-tm-bibtex-style? style)
       (let* ((all-files `(,@bib-files :default :attached))
              (l (apply bib-retrieve-entries (cons names all-files)))
              (bl (map db->bib (map cdr l)))
diff --git a/src/src/Edit/Process/edit_process.cpp b/src/src/Edit/Process/edit_process.cpp
index 83594c8..0f8fa0b 100644
--- a/src/src/Edit/Process/edit_process.cpp
+++ b/src/src/Edit/Process/edit_process.cpp
@@ -110,16 +110,13 @@ edit_process_rep::generate_bibliography (
       }
     }
     else t= bibtex_load_bbl (bib, bbl_file);
+    // cout << "bibtex_load_bbl:" << t << "\n";// DEBUG
   }
   else {
     if (!bibtex_present () && !starts (style, "tm-")) {
-      if (style == "abbrv") style= "tm-abbrv";
-      else if (style == "acm") style= "tm-acm";
-      else if (style == "alpha") style= "tm-alpha";
-      else if (style == "elsart-num") style= "tm-elsart-num";
-      else if (style == "ieeetr") style= "tm-ieeetr";
-      else if (style == "siam") style= "tm-siam";
-      else if (style == "unsrt") style= "tm-unsrt";
+      if (as_bool (call (string ("is-tm-bibtex-style?"), "tm-" * style))) {
+	style= "tm-" * style;
+      }
       else style= "tm-plain";
     }
     if (supports_db () && !is_rooted (bib_file))
_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to