unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: crash-proof emacs use
Date: Sun, 11 Sep 2022 23:26:05 -0400	[thread overview]
Message-ID: <jwvk0699t5l.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: CAJcAo8vAtN1-bQOK1qd_OBos8r_6N_mxjzkL_ERVyCDwg5FMag@mail.gmail.com

> this is open-ended, but would mean something like, you kill some text
> with a "about to move" command so that killing is not conflated with
> moving, and it gets marked as "move operation started".  then you go
> to the location to yank to, and you [if your stm is operating ok] yank
> in the new place with a message that this is supposed to be
> crash-proof.  as part of that yanking, the old text gets deleted.
> this is just a silly example.

It probably depends on lots of things, but AFAIK the normal way Emacs
solves this is by treating everything between two `C-x C-s` as a kind of
transaction, so until you `C-x C-s` all the changes in your buffer
are transient.

Of course, it doesn't help you in cases such as:

- kill, with the intent to yank elsewhere
- forget all about it
- save

If you're worried about that, then most likely you're also worried
about:

- kill, with the intent to replace it with something else
- forget all about it
- save

tho admittedly, in such a case you can easily workaround the problem by
first typing in the replacement, then killing the old version (so that,
if you forget all about it in the middle, you just get both versions
and no info is lost).

FWIW, I fairly often do that kind of "insert first" (or copy first) and
only delete the original code later on.


        Stefan




  reply	other threads:[~2022-09-12  3:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  2:13 crash-proof emacs use Samuel Wales
2022-09-12  3:26 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2022-09-12  6:08 ` Jean Louis
2022-09-12  6:32 ` Yuri Khan
2022-09-12  7:32 ` Marcin Borkowski
2022-09-15  2:49   ` Samuel Wales
2022-09-17 14:22     ` Marcin Borkowski

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=jwvk0699t5l.fsf-monnier+emacs@gnu.org \
    --to=help-gnu-emacs@gnu.org \
    --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.
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).