Subject: Re: bug#33697: 26.1; file-truename messes with match data

From: Eli Zaretskii <[email-masked]>
Date: Tue, 11 Dec 2018 06:55:33 +0200

merge 33697 31586
thanks

> From: [email-masked] (Kévin Le Gouguec)
> Date: Mon, 10 Dec 2018 22:02:09 +0100
> 
> I set frame-title-format so that it displays the basename of the current
> project's root folder for the active buffer.  However, my $HOME is under
> version control; I do not want this particular "project" to show up in
> the frame's title.
> 
> Here is the code that I use:
> 
>     (require 'subr-x)
> 
>     (defun my/project-name ()
>       (when-let* ((project (project-current))
>                   (root (car (project-roots project))))
>         (when (not (file-equal-p root "~"))
>           (file-name-nondirectory (string-trim-right root "/")))))
> 
>     (setq frame-title-format
>           '(:eval
>             (let ((project (my/project-name)))
>               (concat (when project (format "[%s] " project)) "%b"))))
> 
> After adding the above to my .emacs, I started experiencing weird
> failures with query-replace.  I managed to reproduce this with emacs -Q:
> 
> - evaluate the above
> - move to the beginning of *scratch*
> - M-% a RET b RET
> ⇒ perform-replace: Args out of range: #<buffer *scratch*>, 0, 2
>   (point has moved after the first match)

This is bug#31586, please see the discussions there.