Peter Tury said: > However, the more serious problem is that it "forgets" such > eliminations when it searches for `old' expansion in case of repeated > calls of `dabbrev-expand' (i.e. when the check "(eq last-command > this-command)" in this function results t) what results in weird text > in some cases. I think I've got a fix for this. The problem is that dabbrev--substitute-expansion alters EXPANSION before using it in the substitution, but dabbrev-expand has no idea that it's done this, so it assumes the unaltered EXPANSION is still valid and saves it. The patch makes dabbrev--substitute-expansion return EXPANSION, and dabbrev-expand saves that version instead. I considered making a new function to remove the whitespace and using it in both dabbrev-expand and dabbrev--substitute-expansion, but returning the value actually used strikes me as safer, in case anything else is done to it.