Send Ebib-users mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/ebib-users
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ebib-users digest..."


Today's Topics:

   1. ebib: bug? (Thomas A. Schmitz)


----------------------------------------------------------------------

Message: 1
Date: Tue, 19 Sep 2006 17:01:15 +0200
From: "Thomas A. Schmitz" <[EMAIL PROTECTED]>
Subject: [Ebib-users] ebib: bug?
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

OK, since a mail I wrote a couple of days ago wound up on this list,  
I also subscribed. I've been working on and off with ebib for a  
couple of days now, and I like much of what I see. An option to sort  
the database would be nice to have, but the quick tab completion is  
very welcome and impressive. I have one possible and quite serious  
bug to report and one suggestion.

OK, first the bug: In emacs bibtex-mode, dates are stored as raw  
strings. If such a year is the last value of a bibtex entry, the last  
sign in the line is the right brace closing the entire entry, like so:

@article{name,
   author = ZZZ,
   title = ZZZ,
   year = 1999}

If I open a database with such entries with ebib, edit and save, it  
will have modified this entry like so:

@article{name,
   author = ZZZ,
   title = ZZZ,
   year = 199
}

It inserts a newline before the closing brace and gobbles the last  
character of the date. I hope you'll agree that this is a serious bug  
- I have just realized that ebib corrupted an entire bib file this  
way. Fortunately, there are backups, but I would appreciate if this  
could be fixed...

Now the suggestion: I mainly use ConTeXt for TeXing. Would it be  
possible to add defuns for the ConTeXt commands \cite[] and \nocite[]  
instead of the usual LaTeX \cite{} syntax? I have inserted this by  
simple copy-and-paste into ebib.el; there is certainly a more elegant  
way of doing this:

--- ebib.el   2006-08-18 13:50:58.000000000 +0200
+++ ebib.el.new     2006-09-19 16:57:16.000000000 +0200
@@ -2187,6 +2187,49 @@
           (when key
             (insert (format "{%s}" key)))))))))
+
+(defun ebib-insert-context-bibtex-key ()
+  "Inserts a BibTeX key at POINT, surrounded by braces.
+
+The user is prompted for a BibTeX key and has to choose one from the
+database of the current LaTeX file, or from the current database if  
there
+is no \\bibliography command. Tab completion works."
+  (interactive)
+  (if (null ebib-databases)
+      (error "No database loaded")
+    (let ((db (ebib-get-local-database)))
+      (cond
+       ((null db)
+       (error "Database %s not loaded." ebib-local-bibtex-filename))
+       ((= (hash-table-count (edb-database db)) 0)
+       (error "No entries in database %s" ebib-local-bibtex-filename))
+       (t
+       (let* ((collection (ebib-create-collection (edb-database db)))
+              (key (completing-read "Key to insert: " collection nil  
t nil ebib-minibuf-hist)))
+         (when key
+           (insert (format "\\cite[%s]" key)))))))))
+
+(defun ebib-insert-context-nocite-key ()
+  "Inserts a BibTeX key at POINT, surrounded by braces.
+
+The user is prompted for a BibTeX key and has to choose one from the
+database of the current LaTeX file, or from the current database if  
there
+is no \\bibliography command. Tab completion works."
+  (interactive)
+  (if (null ebib-databases)
+      (error "No database loaded")
+    (let ((db (ebib-get-local-database)))
+      (cond
+       ((null db)
+       (error "Database %s not loaded." ebib-local-bibtex-filename))
+       ((= (hash-table-count (edb-database db)) 0)
+       (error "No entries in database %s" ebib-local-bibtex-filename))
+       (t
+       (let* ((collection (ebib-create-collection (edb-database db)))
+              (key (completing-read "Key to insert: " collection nil  
t nil ebib-minibuf-hist)))
+         (when key
+           (insert (format "\\nocite[%s]" key)))))))))
+
+
(defun ebib-entry-summary ()
    "Shows the fields of the key at POINT.

Thomas



------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

------------------------------

_______________________________________________
Ebib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ebib-users


End of Ebib-users Digest, Vol 2, Issue 4
****************************************

Reply via email to