emacs-devel
[Top][All Lists]
Advanced

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

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


From: arthur miller
Subject: Sv: Partial wdired (edit just filename at the point)
Date: Fri, 19 Mar 2021 20:40:47 +0000

Yes, of course, I had `wdired-allow-to-change-permissions' set to t; it is the pre-requisita.

It works fine when `wdired-allow-to-change-permissions' is set to 'advanced. Than the read only
property of permissions part is set to nil. But in ordinary case the read-only property does not
seem to be modified by the preprocessing routine. Instead preprocessing just marks where
permission part starts and ends. and it seems like actuall manipulation is done elsewhere in code
below.

Thanks for clarifying steps involved; I understand now, I didn't really understood them :-).

Ok, originally permissions flags are preprocessed before change to wdired is finalized. So something somewhere in
wdired setup is checking for permission bits? I think.

Från: Stefan Monnier <monnier@iro.umontreal.ca>
Skickat: den 19 mars 2021 17:18
Till: Arthur Miller <arthur.miller@live.com>
Kopia: emacs-devel@gnu.org <emacs-devel@gnu.org>
Ämne: Re: Partial wdired (edit just filename at the point)
 
> 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]