From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position Date: Sat, 25 Mar 2023 17:17:11 +0300 Message-ID: <83y1nkc3vc.fsf@gnu.org> References: <83tty9caku.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22727"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62413@debbugs.gnu.org To: Liu Hui Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 15:18:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pg4ip-0005cN-Gm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 15:18:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg4ia-0001Jt-5g; Sat, 25 Mar 2023 10:18:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg4iY-0001Jc-Bs for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 10:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg4iY-0002MQ-4J for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 10:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg4iX-0008Ex-V4 for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 10:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 14:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62413 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62413-submit@debbugs.gnu.org id=B62413.167975384231620 (code B ref 62413); Sat, 25 Mar 2023 14:18:01 +0000 Original-Received: (at 62413) by debbugs.gnu.org; 25 Mar 2023 14:17:22 +0000 Original-Received: from localhost ([127.0.0.1]:43172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg4ht-0008Dv-VN for submit@debbugs.gnu.org; Sat, 25 Mar 2023 10:17:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg4hs-0008DV-5a for 62413@debbugs.gnu.org; Sat, 25 Mar 2023 10:17:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg4hm-0002EA-UZ; Sat, 25 Mar 2023 10:17:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kWGO1C9g44H/UnYqcdc4Z7xencQopuQw6hFpoG5+G9Y=; b=Ix4+xtiFemp5 cXgp8ANp01cQqTnO/xfebIZioDJrZmOOP6/ikcuPhM3n5ItsG1rJWJSq4AhazIH+rfJLDvesqDLFF 7nnIV/2ssWNlYpjWMiLjBMmj6mfGwFaiSFtGEJirAQhmVjz6gq7b8EaSSFqSvYNWUkRxZhNAfRZ9e gtlv/LKp2dPO+NBSXCNYc5/aKEL/xVT+gaquoXI0P+Zphw5OwPWlyzFlEH51IcS1k3adUECWj7mlP Co0AlA6duQH4Y/6DsTv/XnTYObp0vHyk5b48mYiCYJOHPEOM0AnZR5iFxjpW+VmgGOj7igLDTMuQ2 xFr0wZ3v5KGT84vhoJlFoA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg4hm-00022E-1s; Sat, 25 Mar 2023 10:17:14 -0400 In-Reply-To: (message from Liu Hui on Sat, 25 Mar 2023 22:14:02 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258578 Archived-At: > From: Liu Hui > Date: Sat, 25 Mar 2023 22:14:02 +0800 > Cc: 62413@debbugs.gnu.org > > > Wouldn't it be best to always test for abbreviated file name if the > > full file name fails to match? E.g., it could be that the user turned > > on save-place-abbreviate-file-names for a while, then turned it off > > (or vice versa), thus causing mixed file names in the saved history. > > It would also make the code simpler, I think. > > I agree that it is better to consider mixed file names. Please see the > updated patch. > > From ad5f2d4f3c878a15c2fd1d2eca09e2f2fbecec15 Mon Sep 17 00:00:00 2001 > From: Liu Hui > Date: Fri, 24 Mar 2023 10:08:12 +0800 > Subject: [PATCH] Restore positions for abbreviated file names in saveplace.el > > * lisp/saveplace.el (save-place-find-file-hook): Use abbreviated file > name when `save-place-abbreviate-file-names' is non-nil. > --- > lisp/saveplace.el | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/lisp/saveplace.el b/lisp/saveplace.el > index 7512fc87c5d..6c3ed34f198 100644 > --- a/lisp/saveplace.el > +++ b/lisp/saveplace.el > @@ -353,7 +353,14 @@ save-place-find-file-hook > "Function added to `find-file-hook' by `save-place-mode'. > It runs the hook `save-place-after-find-file-hook'." > (or save-place-loaded (save-place-load-alist-from-file)) > - (let ((cell (assoc buffer-file-name save-place-alist))) > + (let ((cell (and (stringp buffer-file-name) > + (if save-place-abbreviate-file-names > + (or (assoc (abbreviate-file-name buffer-file-name) > + save-place-alist) > + (assoc buffer-file-name save-place-alist)) > + (or (assoc buffer-file-name save-place-alist) > + (assoc (abbreviate-file-name buffer-file-name) > + save-place-alist)))))) > (if cell But now testing save-place-abbreviate-file-names here should be redundant, right? Also, I think we should first test buffer-file-name, and only after that its abbreviated variant.