Enable duplicating a region when mark is active 

Provide a duplicate-line-or-region function :
when mark is active, duplicate the selected region,
when mark is not active, duplicate the current line by reusing the existing duplicate-line function.