[Ebib-users] ebib: bug?
Brought to you by:
joostkremers
From: Thomas A. S. <tho...@un...> - 2006-09-19 15:02:44
|
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 |