Tomas Nordin writes: [...] > NEW: if non-nil, hunk is already applied > OLD: if non-nil, hunk is not applied Those notes might be correct for the normal case but when REVERSE is non-nil, the notion of NEW and OLD is reversed. [...] So I added a check to only satisfy the NEW *and* OLD case when REVERSE is not given. What do you think? (Also aligned the leading whitespace with original code). In my manual tests it seems to work. I learned about the splitting of hunks and it doesn't seem broken.