conorjh

Just another WordPress.com site

Merging files in emacs

I used the emacs merge function for, weirdly, the first time today. It is fabulous. You start it by typing

M-x emerge-files

and it prompts for the two file names, it afterwards refers to these as A and B. It gives a split window with the two parent files on the top and the merged file at the bottom. The merged file is initially equal to A. You move from difference to difference using

C-c C-c n for forward and C-c C-c p for back.

The difference is marked out in all three windows and you type

C-c C-c b

to change to the B version, or

C-c C-c a

to go back to the A version. If you want to make further changes you need to enter edit mode, using

C-c C-c e

The buffer containing the merged file can be saved in the usual way. The only thing I disliked about it was that the keystrokes, with their C-c C-c prefixes, were longer than need be.

Advertisements

Single Post Navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: