emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Partial wdired (edit just filename at the point)


From: Stefan Monnier
Subject: Re: Partial wdired (edit just filename at the point)
Date: Fri, 19 Mar 2021 12:18:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Indeed, I was only concentrated on "interactive" editing, didn't thought
> so much of other elisp functions.

That's the advantage of `before-change-functions`: you just don't need
to think about all the many different cases.

> Jere is a sketch with region, however, I am not able to get
> editing permissions correctly. I am not really sure what is going on.

I assume you tried with `(setq wdired-allow-to-change-permissions t)`.
I think I see what's going on:

- I go to the permissions of a "fresh" line (one that hasn't yet been
  processed by `wdired--before-change-fn`).
- I hit `x` with the intention to toggle the execute bit.
- Because it's "fresh" there's no keymap set so the key lookup decides
  I want to run `self-insert-command` rather than `wdired-set-bit`.
- Then we see another problem: the "read-only" test is performed before
  running the `before-change-functions` so the insertion of `x` is
  allowed even though we will end up placing a `read-only` property over
  that text just before the `x` is actually inserted.

I see other problems linked to this ordering problem:

- Go to the "non-editable" part of a "fresh" line.
- Hit `C-y`
- The yank is happily accepted.
- Worse: the text we yanked doesn't have the `read-only` property so you
  can keep modifying it (tho the rest of line now is marked `read-only`).

Hmm....


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]