Thank you Eli! On Wed, 25 Oct 2023 at 15:15, Eli Zaretskii wrote: > > From: dalanicolai > > Date: Sat, 21 Oct 2023 17:39:17 +0200 > > Cc: 66542@debbugs.gnu.org > > > > You are right (of course :) > > So I have attached another patch which only strips the file name > (applies file-name-directory) if the file > > is not a directory. > > > > If the file is not a directory, then that stripped name should also be > returned by the function, i.e. in the > > 'cond`, root should be set to the stripped file name. Therefore, the > patched version simply 'checks > > and sets' the file name first inside the setq. > > > > Also, now we can remove the check in the first clause of the 'if' (of > 'setq try'), because 'file' is > > guaranteed to be a directory name, and the existence of the directory > name is already checked by > > the 'file-exists-p'. > > > > This change does not affect other parts of the function (except that it > speeds it up a little, because it > > excludes the cycles, that only strip the file names in case file is a > 'real' file. > > Indeed, the function should only check for 'parent directories' (not > files). > > Thanks, installed on master, and closing the bug. >