Here's a patch that does what I mean. It changes the original "if" form to "cond" form and adds a condition branch for the case when the point is at the end of logical line: (cond ((eolp) (goto-char (1+ (point)))) ...) The semantics of the original "if" form is reproduced in the place of "..." above, that is, as other "cond" branches.