> -----Original Message----- > From: Eli Zaretskii > Sent: Wednesday, December 20, 2023 7:47 PM > To: DE BACKER Jurgen (EXT) > Cc: 67930@debbugs.gnu.org > Subject: Re: bug#67930: 29.1; emacs 29.1 follows symlinks when a grep result > is selected > > > Date: Wed, 20 Dec 2023 13:54:19 +0000 > > From: Jurgen De Backer via "Bug reports for GNU Emacs, the Swiss > > army knife of text editors" > > > > Since emacs 29.1 (possibly already in 28.x), symlinks are resolved > > whenever a file is selected in a grep result in the *grep* buffer. > > For our project, we preferred the old behaviour to remain in the > > symlink's directory. > > Also, when symlinks are resolved and a new grep is done, we may end up > > grepping in another directory than we started from. > > > > Attached is a patch o revert the behaviour, and to add a custom > > variable compilation-follow-symlinks to disable/enable this behaviour. > > > > It may be useful to allow the user to select either behaviour. > > Thanks, but I don't think this is a matter of user preferences. We replaced > expand-file-name there by file-truename because in some cases the former > doesn't work: it expands to a file that doesn't exist. See bug#8035, where > such cases are presented. We cannot ask the user to set or reset this option > each time they need to work with these or those file names. > > So I don't think the fix you propose is the right one. I think we need to use > expand-file-name where it works, and file-truename where expand-file- > name doesn't work. Or maybe just try expand-file-name first, and if that > produces a file name that fails file-exists-p, try file-truename. > > Would you like to propose and test a patch along these lines? Hi Eli, Please find attached a patch that does this: first we try to expand the file name with expand-file-name and if this fails, retry with file-truename. ____ This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful. Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy. Any views expressed in this message are those of the sender.