Add with_loc convenience function.