unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to revert buffer from "Save file?" prompt?
Date: Tue, 08 Jun 2021 20:15:28 +0300	[thread overview]
Message-ID: <87lf7kb7m7.fsf@osv.gnss.ru> (raw)
In-Reply-To: <83sg1se53s.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Jun 2021 18:41:27 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sergey Organov <sorganov@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Tue, 08 Jun 2021 18:18:46 +0300
>> 
>> > Why do you need to revert?  If you answer 'n' (= NO), the compilation
>> > will use the version on disk, without saving your edits.  You can
>> > later revert the buffer, but that's a separate operation.
>> 
>> Yes, and that's exactly the problem. It will ask me again and again
>> every time I compile. Annoying as hell.
>
> Do you want to compile the file, or do you want to revert it?

I want to compile, and that obviously involves some files. The buffer in
question could be entirely unrelated to the compilation, or it could be
related, it doesn't matter for the issue at hand.

> These are two orthogonal things, so it sounds strange to me that you
> seem to use "M-x compile" as the means to find all the changes buffers
> and revert them.

It's not the means to find such buffers, it's just that I often notice
such buffers when compiling or switching desktops, or leaving emacs. But
on exit there is at least final "exit anyway" option that discards
changes.

>
>> > IOW, if all you want is to revert the buffer _without_ compiling, just
>> > type C-g to abort "M-x compile" and then revert.
>> 
>> No, I want to compile, and I don't need the changes in some buffer(s)
>> anymore.
>
> Then how come you left those buffers modified?  And what does that
> have to do with compilation?

I left those buffers modified, sorry, my mistake. Maybe I thought I'll
need the modification, and now I see I don't anymore.

Now otherwise unrelated compilation annoyingly asks me every time if I
want to save these buffers. No, I don't!

>
>> Probably something like revert-some-buffers (similar to
>> save-some-buffer) would help as well, but a feature to discard changes
>> from the "save file" prompt would be definitely more helpful.
>
> Then this isn't about "M-x compile", right?  It's about being able to
> revert some of the modified buffers, either as a separate command, or
> as part of "C-x s".  Right?

Right, "M-x compile" is just an example where the lack of feature gets
most annoying. As for "C-x s", it could run the would-be function with
the "revert" feature disabled, if it makes more sense.

>
>> As I've asked in another mail: is there a practical way to add
>> keybindings to this prompt? I'd then opt for adding "C-M-g: revert the
>> buffer" and be finally done with it.
>
> See save-some-buffers-action-alist.

Will check, thanks!

-- Sergey Organov




  reply	other threads:[~2021-06-08 17:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 14:24 How to revert buffer from "Save file?" prompt? Sergey Organov
2021-06-07 14:28 ` Eli Zaretskii
2021-06-08 15:18   ` Sergey Organov
2021-06-08 15:41     ` Eli Zaretskii
2021-06-08 17:15       ` Sergey Organov [this message]
2021-06-10 17:14       ` Sergey Organov
2021-06-08 15:51     ` Stefan Möding
2021-06-08 17:56       ` Sergey Organov
2021-06-07 15:23 ` Óscar Fuentes
2021-06-07 15:42   ` Sergey Organov

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=87lf7kb7m7.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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).