Next: , Up: Cross referencing   [Contents][Index]


6.1 Cross-referencing records using foreign keys

When a record field is a reference to another record, it is possible to use navigate from the referring field to that record. Consider the following record:

%rec: Book
%type: Published int
%type: Author rec Author

Title: Cat's Cradle
Published: 1963
Author: KurtVonnegut

Title: Breakfast of Champions
Published: 1973
Author: KurtVonnegut

Title: The Left Hand of Darkness
Published: 1969
Author: UrsulaKLeGuin

%rec: Author
%key: Id

Id: UrsulaKLeGuin
Name: Ursula K. Le Guin

Id: KurtVonnegut
Name: Kurt Vonnegut, Jr.

6.1.2 Finding record references

On the other hand, in the above example, navigating anywhere on an Author record, it is possible to list all the records referring that record using M-? (xref-find-references). This works on any field of the record, since we foreign keys to the record work on the record level.

6.1.3 Commands for cross-referencing

M-.
M-x xref-goto-definition

Jump to the record referenced by this field, if possible. Use M-. and C-M-, to jump between the results.

M-?
M-x xref-find-references

List all the records that reference this record. The record referenced must have a %key in its descriptor for this to work, and to get any results the referring records must have properly used foreign keys.

For more keybindings, See Looking Up Identifiers in Gnu Emacs Manual. For more info about foreign keys in recutils, See Foreign Keys in Recutils Manual.


Next: Cross referencing by selection, Up: Cross referencing   [Contents][Index]