refactor mark-lines-cmds into macro