>Why didn't you introduce a new variable tramp-copy-failed-regexp? This >would make the code more readable, and it would avoid several changes. > > I didn't want to clobber the name space, but I agree that adding a variable makes my change more consistent with the rest of tramp. >I don't know whether it is possible to cut trailing newlines in >general. Some existing regexps claim "The regexp should match at end >of buffer." > Then we better not change it. My patch, whit your change suggestions is attached.