On 11/6/2021 10:41 AM, Michael Albinus wrote: > The general rule is, to keep all this specific handling away from > files.el and companions. Emacs has the concept of file name handlers, > and if there is something to be done special, a file name handler shall > offer an alternative implementation. Thanks for the pointers. I've attached a new version of the patch, along with updated benchmark results. When abbreviating Tramp files, not only is this version faster than my previous patch, it's also 2-4x faster(!) than Emacs trunk. I included a couple of related patches in this series, although I can split them out if it would be easier. The first patch just reorders a couple of Tramp tests that got added in the wrong order previously (I only did this because I wanted to add my new test to the end, and figured it would be simpler to fix the order first). The second patch is the main patch and uses a file name handler as you suggested. Hopefully I got everything right here; I'm not very familiar with these parts of Tramp. The test I added passes for me, though a bunch of the other Tramp tests fail for me (with or without my patches). Finally, since I already had them lying around, I added a few tests for `abbreviate-file-name' for local files. They're pretty simple, but should help catch any regressions in the future.