From 584467d9d54c5e4142ceac222c6a5920d0172d72 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Tue, 21 Jul 2009 12:35:17 +0200 Subject: [PATCH] Search crossref The command ebib-search-crossref has been added (by default bound to 'N'). This searches the database for entries crossreferencing the current entry. --- manual/ebib-manual.css | 2 +- manual/ebib-manual.muse | 64 +++++++++++++++++++++++++++---------------------- src/ChangeLog | 6 +++++ src/ebib.el | 11 ++++++++- 4 files changed, 53 insertions(+), 30 deletions(-) diff --git a/manual/ebib-manual.css b/manual/ebib-manual.css index f67ec66..cf8e846 100644 --- a/manual/ebib-manual.css +++ b/manual/ebib-manual.css @@ -39,7 +39,7 @@ img { top: 120px; width: 250px; background-color: #a01c1c; - height: 700px; + height: 740px; padding: 10px; color: #c9c9c9; } diff --git a/manual/ebib-manual.muse b/manual/ebib-manual.muse index 5588091..355e1f3 100644 --- a/manual/ebib-manual.muse +++ b/manual/ebib-manual.muse @@ -488,34 +488,40 @@ i.e. the database that was active when Ebib was lowered with =z=. ** Cross-referencing #cross-referencing -BibTeX has a cross-referencing facility. Suppose you have an entry -=jones1998=, which appeared in a book that is also in your database, say -under =miller1998=. You can tell BibTeX that =jones1998= is contained in -=miller1998= by putting =miller1998= in the =crossref= field. When BibTeX finds -such a cross-reference, all the fields of =jones1998= that don't have a value -inherit their values from =miller1998=. At the very least, this saves you -some typing, but more importantly, if two or more entries cross-reference -the same entry, BibTeX automatically includes the cross-referenced entry in -the bibliography (and puts a reduced reference in the cross-referencing -entries). - -When you fill in the =crossref= field in Ebib, Ebib displays the values of -the cross-referenced entry in the entry buffer. To indicate that they are -just inherited values, they are marked with =ebib-crossref-face=, which by -default is red. (You can customise it, of course. See the customisation -option [[#crossref-face][Crossref Face]].) These values are just displayed for convenience: -otherwise, Ebib treats these fields as if they are empty. That is, they -cannot be edited (to edit them, you need to edit the cross-referenced -entry), and it's not possible to copy these values to the kill ring. - -If you're viewing an entry that has a cross-reference, and want to go to -the cross-referenced entry you can type =F=. This command reads the value of -the =crossref= field and then displays that entry. - -Note that if you want to use BibTeX's cross-referencing options, you need -to set the option [[#save-xrefs-first][Save Xrefs first]]. This tells Ebib to save all entries -with a =crossref= field first in the =.bib= file. Without this, BibTeX's -cross-referencing will not work reliably. +BibTeX has a cross-referencing facility. Suppose you have an entry =jones1998=, +which appeared in a book that is also in your database, say under =miller1998=. +You can tell BibTeX that =jones1998= is contained in =miller1998= by putting +=miller1998= in the =crossref= field. When BibTeX finds such a cross-reference, all +the fields of =jones1998= that don't have a value inherit their values from +=miller1998=. At the very least, this saves you some typing, but more importantly, +if two or more entries cross-reference the same entry, BibTeX automatically +includes the cross-referenced entry in the bibliography (and puts a reduced +reference in the cross-referencing entries). + +When you fill in the =crossref= field in Ebib, Ebib displays the values of the +cross-referenced entry in the entry buffer. To indicate that they are just +inherited values, they are marked with =ebib-crossref-face=, which by default is +red. (You can customise it, of course. See the customisation option +[[#crossref-face][Crossref Face]].) These values are just displayed for convenience: otherwise, Ebib +treats these fields as if they are empty. That is, they cannot be edited (to +edit them, you need to edit the cross-referenced entry), and it's not possible +to copy these values to the kill ring. + +If you're viewing an entry that has a cross-reference and you want to go to the +cross-referenced entry you can type =F=. This command reads the value of the +=crossref= field and then displays that entry. If you want to do the reverse, +i.e., see if the current entry is cross-referenced by any other entries, you can +use the key =N=. What this command actually does is to make the key of the current +entry the current search string and to search for its first occurrence *after* the +current entry. Like the normal search command =/=, =N= does not wrap and only +searches forward. So if you want to search for the next cross-referencing entry +you need to press =n= (i.e., lowercase =n=), and to continue searching from the +first entry, press =g= followed by =n=. + +Note that if you want to use BibTeX's cross-referencing options, you need to set +the option [[#save-xrefs-first][Save Xrefs first]]. This tells Ebib to save all entries with a =crossref= +field first in the =.bib= file. Without this, BibTeX's cross-referencing will not +work reliably. ** Printing the Database @@ -1337,6 +1343,8 @@ of references formatted by BibTeX. =(ebib-latex-database)= =n= :: find next occurrence of the search string. =(ebib-search-next)= + =N= :: search for entries cross-referencing the current one. =(ebib-search-crossref)= + =C-n= :: equivalent to =Down=. =M-n= :: equivalent to =PgDn=. diff --git a/src/ChangeLog b/src/ChangeLog index 9c85d3c..0dba0ab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-07-13 Joost Kremers + + * ebib.el (ebib-search-crossref): new. + (ebib-entry-summary): modified to use with-help-window instead of + with-output-to-temp-buffer. + 2009-07-12 Joost Kremers * ebib.el (ebib-push-bibtex-key): renamed from ebib-push-entry-key diff --git a/src/ebib.el b/src/ebib.el index 7792645..84fb9d3 100644 --- a/src/ebib.el +++ b/src/ebib.el @@ -1359,6 +1359,7 @@ killed and the database has been modified." (ebib-key index "m" ebib-mark-entry) (ebib-key index "M" ebib-merge-bibtex-file) (ebib-key index "n" ebib-search-next) +(ebib-key index "N" ebib-search-crossref) (ebib-key index [(control n)] ebib-next-entry) (ebib-key index [(meta n)] ebib-index-scroll-up) (ebib-key index "o" ebib-load-bibtex-file) @@ -2284,6 +2285,14 @@ only that field is searched." entry)) result)) +(defun ebib-search-crossref () + "Searches the database for the key of the current entry. +This is useful in searching the entries that cross-reference the +current entry." + (interactive) + (setq ebib-search-string (car (edb-cur-entry ebib-cur-db))) + (ebib-search-next)) + (defun ebib-edit-strings () "Edits the @STRING definitions in the database." (interactive) @@ -3578,7 +3587,7 @@ be found." (error "Entry `%s' not found" key) (let ((index-window (get-buffer-window ebib-index-buffer))) (if (not index-window) - (with-output-to-temp-buffer "*Help*" + (with-help-window "*Help*" (ebib-format-fields entry 'princ)) (with-selected-window index-window (setq ebib-cur-db database) -- 2.11.4.GIT