Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||||||||||
Hour 14: Finding Differences Between Files |
||||||||||||||||||||||
|
If you have been a good boy or girl and done what I've told you, you will have a directory with all your Lisp configuration. Furthermore if you use Emacs both at home and at work, you will have this directory located on two different machines. You have already learned that you can use Ediff to keep files synchronized, but because you have a whole directory of files to keep synchronized, you need bit extra to ease your work.
Emacs has four functions that let you work on directories of files: ediff-directories, ediff-directories3, ediff-merge-directories, and ediff-merge-directories3. The functions that end in 3 are functions that work with a directory of ancestors. All functions work by creating a buffer such as the one in Figure 14.6, from which you can start individual Ediff or ediff-merge sessions.
When you invoke one of the functions listed earlier, Emacs asks you for a regular expression that the filename must match to get in the list.
Pressing the second mouse button or the Enter key over one of the sessions starts an Ediff or ediff-merge with the files listed for the given session. When you quit the given session, Emacs returns to this buffer. You can also return to it by pressing M, as listed in the help text in the top of the buffer.
If the directories contain many files, you might want to remove some of the sessions from the session group. This can be done with a regular expression as described earlier, but this method has one drawback: It is hard to develop a regular expression that excludes some files. For example, it would be hard to write a regular expression that excludes all files ending in .elc. An other solution is to press h ( h for hide) when point is located on top of a session that you do not want to see. This marks the given session for hiding. When you have selected some buffers for hiding, you can press x ( x for e xecute), which does the actual hiding.
If the session contains two subdirectories rather than two files, Emacs brings up a session group for the files of the two subdirectories.
By pressing = in this buffer you tell Emacs to flag all sessions that have files that are not different. This can help you when you are trying to merge two directories coming from different machines. Unfortunately the mark that Emacs put on these files cannot be used to hide the files with x. Fortunately, you have learned about macros in Hour 13, "Macros," so you are capable of developing a macro that can hide all files flagged as different. (See the exercise at the end of the hour.)
Only files located in both directories are shown in the session group buffer, so press D to see which files are not in both directories.
Sessions that have been invoked are flagged with a minus sign in the first column.
Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||||||||||
Hour 14: Finding Differences Between Files |
||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.