[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: Adding refactoring capabilities to Emacs
From: |
Alfred M. Szmidt |
Subject: |
Re: [External] : Re: Adding refactoring capabilities to Emacs |
Date: |
Tue, 26 Sep 2023 11:22:20 -0400 |
Is this whole discussion, or even much of it, really about whether
to keep diff-mode buffers read-only by default, and whether to
provide refactoring commands/keys that let you change the content
in special ways when the buffer is read-only?
You need to define what a "diff buffer" is first. Is it a file you
open, is it the output from M-x diff-buffer-with-file, is it the
output from C-x v = ?
I don't really see a fundamental difference between a diff buffer
and, say, a grep or an occur buffer. (But yes, you often _apply_
the diff content, so you want to ensure it keeps to a proper
formatting.)
Occur and grep buffers are by default read-only (and there is a
regression in that too -- you can no longer edit a grep/occur buffer
easily due to strange font lock or other properties).
They are also not files, if you open a file (any file really) you will
expect to be able to edit it using normal commands not specific to the
mode (i.e. self-inser-command ...). vc-diff etc, are more akin to
occur and grep -- the user doesn't work against the file, but rather a
buffer.
We already have, and are used to, the universal idiom of `C-x C-q'
to toggle a buffer read-only. I use that in grep and occur buffers
without a second thought. Why isn't that "sufficient" for diff
buffers as well?
Because we are also talking about files on disk. If you save a
compilation buffer (essentially the same thing as M-x grep or M-x
occur) to disk, and re-open it, it will not be read-only -- and it
would make little sense for it to be so. Where as M-x compile _will_
be read-only.
I can see that some might want commands/keys that act on the buffer
content, including to change it in
structured/"legitimate"/refactoring ways, while keeping it
read-only.
One can have both, diff-mode already allows you to edit the file, and
act on it in a structure manner -- much like any programming mode.
That way, by default, diff buffers would still be read-only by
default, quitable with `q', but also modifiable in all the usual
ways after `C-x C-q'.
But diff buffers aren't read-only -- it depends on their context.
- Re: Adding refactoring capabilities to Emacs, (continued)
- Re: Adding refactoring capabilities to Emacs, Yuri Khan, 2023/09/26
- Re: Adding refactoring capabilities to Emacs, Dmitry Gutov, 2023/09/26
- Re: Adding refactoring capabilities to Emacs, Eli Zaretskii, 2023/09/29
- Re: Adding refactoring capabilities to Emacs, Eli Zaretskii, 2023/09/29
- Re: Adding refactoring capabilities to Emacs, Alfred M. Szmidt, 2023/09/29
- RE: [External] : Re: Adding refactoring capabilities to Emacs, Drew Adams, 2023/09/26
- Re: [External] : Re: Adding refactoring capabilities to Emacs,
Alfred M. Szmidt <=
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Eli Zaretskii, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Robert Pluim, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Stefan Monnier, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Alfred M. Szmidt, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, João Távora, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, João Távora, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Stefan Monnier, 2023/09/29
- RE: [External] : Re: Adding refactoring capabilities to Emacs, Drew Adams, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Eli Zaretskii, 2023/09/29
- Re: [External] : Re: Adding refactoring capabilities to Emacs, Alfred M. Szmidt, 2023/09/26