unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Peter Mao <peter.mao@gmail.com>, 63676@debbugs.gnu.org
Subject: bug#63676: cancelling editable dired causes UI problems with dired
Date: Sat, 27 May 2023 02:55:56 +0200	[thread overview]
Message-ID: <87jzwupp7n.fsf@web.de> (raw)
In-Reply-To: <83ilcing54.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 24 May 2023 14:05:43 +0300")

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> I seem to be unable to reproduce this.  But your recipe lack some
> details, so I'm unsure.  Would you please describe exactly what to
> type after "C-c ESC" to demonstrate that some commands don't work, and
> what did you expect those command to do?

I think this should be appropriate:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-Fix-cancellation-of-Wdired.patch --]
[-- Type: text/x-diff, Size: 976 bytes --]

From 59a7929f5e7653be1baa72208e2b89ef452962ea Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Sat, 27 May 2023 02:26:09 +0200
Subject: [PATCH] Fix "Fix cancellation of Wdired"

* lisp/wdired.el (wdired-abort-changes): Call
`dired-build-subdir-alist' instead of `dired-revert'.
---
 lisp/wdired.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/wdired.el b/lisp/wdired.el
index 70e908b3a38..e6a7ca1841d 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -473,9 +473,8 @@ wdired-abort-changes
     (insert wdired--old-content)
     (goto-char wdired--old-point))
   (wdired-change-to-dired-mode)
-  ;; Make sure the display is in synch, and all the variables are set
-  ;; correctly.
-  (dired-revert)
+  ;; Update markers in `dired-subdir-alist'
+  (dired-build-subdir-alist)
   (set-buffer-modified-p nil)
   (setq buffer-undo-list nil)
   (message "Changes aborted"))
--
2.30.2


[-- Attachment #3: Type: text/plain, Size: 662 bytes --]


Background: Aborting wdired (`wdired-abort-changes') erases the
buffer and insert the original buffer contents, then re-enters
dired-mode.  Positions in `dired-subdir-alist' (that are necessary for
$) are represented as markers.  These just have to be updated.


A less invasive way of aborting wdired could just undo any user changes.
I think this should be doable using change groups.  Then we would not
loose any kind of marker positions.  `wdired-finish-edit' does not
suffer from these kind of problems because it only touches buffer parts
that correspond to changed file lines.  Currently aborting is more
invasive than actually making changes.

Michael.

  parent reply	other threads:[~2023-05-27  0:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  4:51 bug#63676: cancelling editable dired causes UI problems with dired Peter Mao
2023-05-24 11:05 ` Eli Zaretskii
2023-05-24 12:09   ` Stephen Berman
2023-05-25  1:14   ` Peter Mao
2023-05-26  9:25     ` Eli Zaretskii
2023-05-26 23:51   ` Michael Heerdegen
2023-05-27  0:55   ` Michael Heerdegen [this message]
2023-05-27  2:39     ` Michael Heerdegen
2023-05-27  6:26       ` Eli Zaretskii
2023-05-27  6:24     ` Eli Zaretskii
2023-05-28  1:36       ` Michael Heerdegen
2023-05-28  4:09         ` Thierry Volpiatto
2023-05-28  5:01           ` Michael Heerdegen
2023-05-28  5:08             ` Thierry Volpiatto
2023-05-28 16:04             ` Drew Adams
2023-05-28 16:21               ` Thierry Volpiatto
2023-05-28 19:17                 ` Drew Adams
2023-05-29  3:43                   ` Thierry Volpiatto
2023-05-29  5:16                     ` Drew Adams
2023-05-29  9:43                       ` Thierry Volpiatto
2023-05-29 17:11                         ` Drew Adams
2023-05-28 16:05           ` Drew Adams
2023-05-28  3:39       ` Michael Heerdegen
2023-05-28  6:43         ` Eli Zaretskii
2023-05-29  1:35           ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzwupp7n.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=63676@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=peter.mao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).