Just another site

Archive for the category “Emacs/LaTeX”

Using emacs/emerge to merge in mercurial

add what’s below to your .hgrc file

merge = emacs

emacs.args = -q --eval "(emerge-files-with-ancestor nil \"$local\" \"$other\" \"$base\" \"$output\" nil 'kill-emacs)"

Some emacs commands I don’t use but want to start.

Here are some emacs commands I want to get in the habit of using:

Move forward or back by one page: ^v and Mv

Uppercase and lowercase a word: Mu and Ml

Capitalize a word: Mc

Uppercase and lowercase a selection: ^x^u and ^x^l, it makes a fuss the first time you use ^x^u since new users apparently find it confusing.

Repeat a command [#] times: ^u [#] [. . . ]

This is the hard one: skip to matching bracket forward is M^f, backwards is M^b but it for { . . .}x your cursor has to be on the x.

Also, did you know there is a mark ring: ^x^x brings you to the mark, ^u^spc moves you back through the mark ring, popping the values as you go.

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.

Post Navigation