Sams Teach Yourself Emacs in 24 Hours |
|||||||||||||||||
Hour 8: Searching for Text in Multiple Files |
|||||||||||||||||
|
When you use TAGS to jump to definitions, you might often want to go back to the location where you came from. You can use bookmarks to locate the place you came from, but bookmarks are not made for this job, so they are very cumbersome to use for this. An alternative solution exists in sams-lib .
sams-lib offers two functions: sams-cm-save-point to make or delete a mark to get back to, and sams-cm-rotate to jump to the next mark. You might have several marks set around in several buffers, which you can jump to using these functions. When you invoke the function sams-cm-save-point, you insert a new mark in the ring of marks unless you are located on one of the marks; in that case, you will instead remove the mark from the ring of marks.
When you invoke the function sams-cm-rotate, Emacs jumps to the most recent mark that's been set or visited. If you invoke the function once more, Emacs will jump to the previously set mark, and so on.
The set of marks is called a ring, because Emacs jumps to the most recently set mark if you invoke sams-cm-rotate when you are at the oldest mark. To get a feel for how this jumping works, create a buffer with four lines, set a mark on each line, and then invoke the function M-x sams-cm-rotate several times to see how it jumps around.
Caution - Although the word marks is used several times in the preceding paragraph, these marks have nothing to do whatsoever with the mark that is used to describe the region. |
Sams Teach Yourself Emacs in 24 Hours |
|||||||||||||||||
Hour 8: Searching for Text in Multiple Files |
|||||||||||||||||
|