all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: kediez@gmail.com, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 66181@debbugs.gnu.org
Subject: bug#66181: Subject: 29.1; Occur changes don't affect Dired buffer
Date: Mon, 25 Sep 2023 11:42:28 +0300	[thread overview]
Message-ID: <837coe3aq3.fsf@gnu.org> (raw)
In-Reply-To: <83bkdq3e42.fsf@gnu.org> (message from Eli Zaretskii on Mon, 25 Sep 2023 10:29:17 +0300)

> Cc: 66181@debbugs.gnu.org
> Date: Mon, 25 Sep 2023 10:29:17 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Maske <kediez@gmail.com>
> > Date: Sun, 24 Sep 2023 13:32:04 +0200
> > 
> > I read a post, where Occur is used to edit a Dired buffer. Well, it
> > doesn't work:
> > 
> > - Tested in emacs -q
> > - Make Dired buffer writable
> > - Launch Occur
> > - Make Occur buffer editable
> > - Make changes in Occur buffer
> > - Changes are not saved in Dired buffer.
> 
> The last item is inaccurate.  The changes in the Occur buffer _are_
> reflected in the Dired buffer, but typing "C-c C-c" in the Dired
> buffer doesn't commit the changes to disk; instead it says "No changes
> to be performed" and reverts to the previous display of Dired.

This happens because WDired relies on before-change-functions to mark
the portions of the Dired buffer which were edited.  But Occur Edit
mode modifies the target buffer from an after-change function, so
buffer-modification hooks are disabled when the modifications are
performed, and the before-change function installed by WDired isn't
called.

Which also means that any mode that relies on buffer-modification
hooks will fail with the same symptoms when its buffer is edited
indirectly via Occur Edit.

Stefan, do we have any safe means of running the hooks in this case?
I thought about running the buffer-local values of before- and
after-change-functions by hand from occur-after-change-function,
skipping the t entry, but I'm not sure this is safe.  It is certainly
messy, so if there's a more elegant way, I'd like to know.





  reply	other threads:[~2023-09-25  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24 11:32 bug#66181: Subject: 29.1; Occur changes don't affect Dired buffer Maske
2023-09-24 16:21 ` Garjola Dindi
2023-09-25  7:29 ` Eli Zaretskii
2023-09-25  8:42   ` Eli Zaretskii [this message]
2023-09-25 13:07     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 13:29       ` Eli Zaretskii
2023-09-25 13:52         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 16:39           ` Eli Zaretskii
2023-09-25 17:04             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=837coe3aq3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66181@debbugs.gnu.org \
    --cc=kediez@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.