emacs preview duplicate lines before removing

397 views Asked by At

Context: I'm working with a large text file that is almost excel-like and I'm adding/editing entries. It is a shared file so others can have already edited the file.

I'm working with emacs and I found that they added the command delete-duplicate-lines. This command seems great for pruning extra entries, but it would be nice to know which lines were duplicates (i.e. already existed in the file) so that I would know which entries had already been added. Is there a command that is similar to delete-duplicate-lines, but only points out which lines are duplicates without removing them?

1

There are 1 answers

2
Drew On BEST ANSWER

You can use command hlt-highlight-line-dups-region from the Highlight library, to highlight all sets of duplicate lines in the region or (if no active region) in the buffer.

By default, leading and trailing whitespace are ignored when checking for duplicates, but this is controlled by option hlt-line-dups-ignore-regexp. And with a prefix arg the behavior effectively acts opposite to the value of that option. So if the option says not to ignore whitespace and you use a prefix arg then whitespace is ignored, and vice versa.

You can also control the colors/faces used to highlight each set of duplicates.