From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#33458: 27.0.50; dired loses position when reverted from outside place Date: Wed, 28 Nov 2018 02:06:37 +0200 Organization: LINKOV.NET Message-ID: <87zhtudq0i.fsf@mail.linkov.net> References: <87k1l6f9li@posteo.net> <87muq23vsk.fsf@gmx.net> <87h8g9fpl3@posteo.net> <5BF7AF19.4070809@gmx.at> <87bm6fyf78@posteo.net> <5BF84EE6.9020004@gmx.at> <87wop0and5.fsf@mail.linkov.net> <5BFBBDC5.10706@gmx.at> <87efb7fjm1.fsf@mail.linkov.net> <5BFCFB87.6060005@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1543365866 16539 195.159.176.226 (28 Nov 2018 00:44:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Nov 2018 00:44:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Stephen Berman , 33458@debbugs.gnu.org, v88m@posteo.net To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 28 01:44:21 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRnxk-0004C6-D9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2018 01:44:20 +0100 Original-Received: from localhost ([::1]:45256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRnzq-0003lk-KD for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Nov 2018 19:46:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRnzV-0003ks-Dq for bug-gnu-emacs@gnu.org; Tue, 27 Nov 2018 19:46:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRnzQ-00029R-QW for bug-gnu-emacs@gnu.org; Tue, 27 Nov 2018 19:46:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48394) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRnzQ-00029I-N7 for bug-gnu-emacs@gnu.org; Tue, 27 Nov 2018 19:46:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gRnzQ-0002od-L4 for bug-gnu-emacs@gnu.org; Tue, 27 Nov 2018 19:46:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Nov 2018 00:46:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33458 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33458-submit@debbugs.gnu.org id=B33458.154336594710740 (code B ref 33458); Wed, 28 Nov 2018 00:46:04 +0000 Original-Received: (at 33458) by debbugs.gnu.org; 28 Nov 2018 00:45:47 +0000 Original-Received: from localhost ([127.0.0.1]:52644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRnz9-0002n8-9G for submit@debbugs.gnu.org; Tue, 27 Nov 2018 19:45:47 -0500 Original-Received: from cichlid.maple.relay.mailchannels.net ([23.83.214.36]:52695) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRnz5-0002mz-NP for 33458@debbugs.gnu.org; Tue, 27 Nov 2018 19:45:45 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 50C4028350D; Wed, 28 Nov 2018 00:45:42 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (unknown [100.96.20.98]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id F000F28340A; Wed, 28 Nov 2018 00:45:41 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Wed, 28 Nov 2018 00:45:42 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Ski-Arithmetic: 42fc0b8743958ced_1543365942173_44183440 X-MC-Loop-Signature: 1543365942173:4178991070 X-MC-Ingress-Time: 1543365942172 Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTP id A18DF8091F; Tue, 27 Nov 2018 16:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=F69Y5438s9Fc4vRUGbYC+tA5duU=; b= NtPaxZ/ahUIgZ/Q9EjyBkZuBA15dfK2AWmLyfTTbDHMYVMGRX1pj98KxoL1Ludis Wm0KnuskSn1QFZSzNNOsdRU7jizvJHTn0lEIjAJb7vM745Eg2EV81fNn6i3A9bO/ 13Q526XThcmx6Yb5XQoESSW1cS1XT8oJCICn+sgk5vE= Original-Received: from mail.jurta.org (m91-129-107-242.cust.tele2.ee [91.129.107.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTPSA id 54D6380924; Tue, 27 Nov 2018 16:45:37 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a3 In-Reply-To: <5BFCFB87.6060005@gmx.at> (martin rudalics's message of "Tue, 27 Nov 2018 09:08:39 +0100") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedruddvtddgvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdejrddvgedvnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtjedrvdegvddprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgepge X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:152835 Archived-At: >> Maybe marker-position should allow to call a function? >> For example, like 'isearch-push-state-function' remembers >> an additional state as a lambda, and when an old state is >> restored, a pop-fun lambda is called. The function that >> restores the buffer in the window could be the same. > > The problem we face here is almost exclusively restricted to reverting > buffers and 'marker-position' is too heavily used as to be affected by > that. Now, if we talk about dired buffers only, they have a very > helpful restriction that invariably permeates all file systems: The > file names in a directory must be unique. So if a marker is on the > line of a file name it can quite easily return to that name after > reversal (provided the file still exists). A similar argument should > hold for non-file visiting buffers like Buffer List buffers. Finally, > in quite a number of cases 'auto-revert-tail-mode' should take care of > markers in the unchanged initial part of a file. While 'isearch-push-state-function' could be used for example to save and restore window start positions on returning to previous search hits: (setq isearch-push-state-function (lambda () `(lambda (cmd) (when isearch-success (set-window-start nil ,(window-start)))))) wouldn't it be possible to use something like this to restore Dired point from the saved dired-filename. And in non-dired buffers maybe at least when a window is restored from the window configuration or from the window state, then simply restore window point from the saved point when the saved point-marker is invalidated (its value is 1). Currently window-state-get when not used with the WRITABLE arg, saves only point-marker, but maybe should save both: point and point-marker, for the case when point-marker invalidates after the buffer is reverted. > Do we have many other auto-reverted buffers? See for example how point is preserved in an intelligent way at the end of revert-buffer-insert-file-contents--default-function that uses insert-file-contents to preserve some marker positions.