From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#30028: 24.5; behavior and doc of `revert-buffer' wrt markers Date: Sat, 12 Dec 2020 12:20:53 +0100 Message-ID: <87a6uj6zje.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8003"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 30028@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 12 12:22:48 2020 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 1ko2zA-0001yi-ST for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Dec 2020 12:22:48 +0100 Original-Received: from localhost ([::1]:36948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ko2z9-00070n-Nz for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Dec 2020 06:22:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ko2yQ-0006yX-8Z for bug-gnu-emacs@gnu.org; Sat, 12 Dec 2020 06:22:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ko2yP-0001mh-VW for bug-gnu-emacs@gnu.org; Sat, 12 Dec 2020 06:22:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ko2yP-0000Yc-Rq for bug-gnu-emacs@gnu.org; Sat, 12 Dec 2020 06:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Dec 2020 11:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30028 X-GNU-PR-Package: emacs Original-Received: via spool by 30028-submit@debbugs.gnu.org id=B30028.16077720752061 (code B ref 30028); Sat, 12 Dec 2020 11:22:01 +0000 Original-Received: (at 30028) by debbugs.gnu.org; 12 Dec 2020 11:21:15 +0000 Original-Received: from localhost ([127.0.0.1]:44039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ko2xf-0000XB-Ei for submit@debbugs.gnu.org; Sat, 12 Dec 2020 06:21:15 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:45720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ko2xd-0000Wh-8P for 30028@debbugs.gnu.org; Sat, 12 Dec 2020 06:21:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Tb/YNTu+u4H7X7vUikotjIn0oZjrO5BjCIkElon4Z0w=; b=ZVCXMi1vxc69D+82XQo5+uaJQB op62ODsLtmUwoTeNu9WIW0sZbTwP6LYGKBxhJMpHfkgIIEKIcaYgGEFw1EeWH7UdBYRj8Xr9+8jJw 8j1SSCaWjrNEgQbmQpd/AEFGw4DUdKolEtPy11hQhswMUANxnZL/dqU4Dfzv5wtOAKnE=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ko2xK-0004wY-BF; Sat, 12 Dec 2020 12:21:06 +0100 X-Now-Playing: Shopping's _All Or Nothing_: "About You" In-Reply-To: (Drew Adams's message of "Mon, 8 Jan 2018 09:35:48 -0800 (PST)") 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" Xref: news.gmane.io gmane.emacs.bugs:195838 Archived-At: Drew Adams writes: > That markers are typically restored when you revert is important. > This behavior is not very well documented, I think. > > 1. Doc: The elisp manual (node `Reverting'), but not the doc string, > mentions that markers at the beginning and end of the buffer (after > changes) are generally preserved (restored). The doc string should > mention this also - it says nothing about markers. I've now mentioned this in the doc string (and punting to the manual for details). > 2. Doc: This restoring of markers happens for visited files, but not > necessarily for other buffers, presumably. The doc in at least the > manual should make this clear. Yes, it's up to the specific `revert-buffer-function'. I've now mentioned this in the manual. > 3. Behavior: The manual says that preserving other markers, besides > those described, "would be problematical". (You might want to change > that to "problematic", but this is not important - > http://grammarist.com/usage/problematic-problematical) Done. > I can understand that in some cases restoring a marker would not > position it correctly. But I don't see why Emacs wouldn't/couldn't > restore all markers anyway. Or does it? The doc does not make clear > whether markers that are not "preserved" are deleted or just not > necessarily in the correct positions. Please make clear just how > (all) markers are handled. > > What criteria does Emacs use for filtering out markers that it > decides not to restore? The manual says: --- If they are not identical, reverting does change the buffer; in that case, it preserves the markers in the unchanged text (if any) at the beginning and end of the buffer. --- So it restores markers in identical text at the start and end. I don't see what's unclear about that. > 4. Trying to track down where the marker handling > (e.g. saving/restoring) takes place sent me down multiple levels > of code. My guess (I don't have the C sources) is that it is > actually done in `insert-file-contents'. But the doc for that > function (both (elisp) `Reading from Files' and doc string) says even > less about marker handling than does the doc for `revert-buffer'. > Can we please get more informative doc about this handling? The Reverting node is actually describing what's happening in that function, which is why that section starts with: --- Reverting tries to preserve marker positions in the buffer by using the replacement feature of @code{insert-file-contents}. --- The `insert-file-contents' doc string is more vague here... I'll add the sentence about the start/end bits. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no