From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Liu Hui Newsgroups: gmane.emacs.bugs Subject: bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position Date: Sun, 26 Mar 2023 09:26:22 +0800 Message-ID: References: <83tty9caku.fsf@gnu.org> <83y1nkc3vc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40629"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62413@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 26 03:27:25 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 1pgFAK-000AHj-PK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Mar 2023 03:27:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgFA0-0000MI-1B; Sat, 25 Mar 2023 21:27: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 1pgF9y-0000Lv-IJ for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 21:27: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 1pgF9y-0000WD-AC for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 21:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgF9x-0003KW-JP for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 21:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Liu Hui Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2023 01:27: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.167979400512777 (code B ref 62413); Sun, 26 Mar 2023 01:27:01 +0000 Original-Received: (at 62413) by debbugs.gnu.org; 26 Mar 2023 01:26:45 +0000 Original-Received: from localhost ([127.0.0.1]:43708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgF9h-0003K0-Hd for submit@debbugs.gnu.org; Sat, 25 Mar 2023 21:26:45 -0400 Original-Received: from mail-oa1-f44.google.com ([209.85.160.44]:42839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgF9g-0003Jp-DK for 62413@debbugs.gnu.org; Sat, 25 Mar 2023 21:26:44 -0400 Original-Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-17aceccdcf6so5754409fac.9 for <62413@debbugs.gnu.org>; Sat, 25 Mar 2023 18:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679793995; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bWGy+Tc48/tCbON/I4hpSGtVr2QfG5L0QmmECRAvcrk=; b=kmLI20N8R0t8VL1KLBDBF2I0jufq5j+lhlchXYxpy5kVSEGEiN2fh9c/OK67kfxNwo QUU8uk8MkrS/XXjPXfiM2YkDfmbyxMc9fRqs4Q5TnQIYLJD4+oQBvtNNFGxu//yv/vtG 5YOcKU/Rb6VP8GJzFssy3SZAxtpK2Ibdhlns9FDOKgxgTzS2wG0BC5UAvwwXudg8QVJ5 m9HV8QholV+knNf2v2MtI9VJ6TPi9TbS0qYZnnwwYKIplBmI06oB/cEiav5Y6FpWRqii hI8rulPBglXWdRNvppnxC+0b1F6eZKWfVXGaluhkS7rl6Q8L6wot7qY14SABAwATWVvG InGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679793995; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWGy+Tc48/tCbON/I4hpSGtVr2QfG5L0QmmECRAvcrk=; b=mMW7GOew2ZbdZcnSV0dWtrcHqUAGcIcNFmJRy4LiCdiBwTg8/GPqKlvDvX8ixogRUs vgM39yVcKipB1fm5uv/Fm/nO1OilxQOVTL+I9Ozk2lXaxwIJRiiS4+eQ+xOyveQb690P nLeltouVLWAnJtH9jstRdqIqfnuxAa+G9pDAvMFdEj8ylZS3UAbR4rbLQaOtlcO/2L4s /be2AiIdavbem2BdujlGWQN2FowKFMiQhj9ivMpI3Qxp5zcnrqdFdANe/JPR+L9Mc+j+ 6kDrtkVMVTnjmcx+bwobp3miMSr4yp5I9yDoT9FKz8jVuKjRNsYcZRfyx23SfnP/waT8 J+aw== X-Gm-Message-State: AAQBX9eV8zZMQ0/m5Qr7ZWPZnO82EGA0ULC1HpVAIMeNz4JGv11EQl9U Vb51KnUEDzZyRau+08ZYO+prQoHTzBbgO3yJjlQ= X-Google-Smtp-Source: AKy350bFad2C3tYB8VXTKvjiwxYINmT5kNic7KnNHvanUtp0Dgzm6itm0N1ilKKD8F0yVx/0mRRD6cBuX21BiI3uGsc= X-Received: by 2002:a05:6870:1059:b0:177:a0de:992 with SMTP id 25-20020a056870105900b00177a0de0992mr2872032oaj.3.1679793993686; Sat, 25 Mar 2023 18:26:33 -0700 (PDT) In-Reply-To: <83y1nkc3vc.fsf@gnu.org> 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:258639 Archived-At: Eli Zaretskii =E4=BA=8E2023=E5=B9=B43=E6=9C=8825=E6=97=A5=E5= =91=A8=E5=85=AD 22:17=E5=86=99=E9=81=93=EF=BC=9A > > 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-na= me) > > + 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. I don't think so. Consider the following case: - open file A and then close the buffer: (buffer-file-name . position1) is saved in save-place-alist - then set save-place-abbreviate-file-names to t - open file A, scroll the buffer and close it: (abbreviated-file-name . position2) is saved - open file A again, and the point will be at position1 if buffer-file-name is tested first. But I would expect the point is at position2.