unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Must prevent switching from recursive edit buffers
Date: Wed, 18 Dec 2024 10:50:03 +0300	[thread overview]
Message-ID: <2756a07624cab7ceb1c68dd24e671ef7.support1@rcdrun.com> (raw)

I would like to find the solution to prevent me as user to switch away
from the recursive edit.

Recursive edit is not file editing. In my case it is editing of the
database values, in general strings. That is what I am using currently
7200 times per month, and do not need different solution at this moment.

I would like to ensure, that if I am switching away from a buffer
which I am editing with `recursive-edit', that I am warned, or that I
can ensure that switch is detected, so that I can invoke other
functions such as asking user to save buffer, or automatically saving
it, or closing the buffer.

I am testing this variable:
(add-hook 'window-buffer-change-functions 'my-speak nil t)

I can see:

Its value is (my-speak)
Local in buffer *mail*; global value is nil

(defun my-speak (&optional window)
(rcd-message "%s" window)
(rcd-speak "Hello there"))

And I can here voice when I for example, split the window.

And I can see message: #<window 224 on *mail*>

Which is alright, but I cannot hear message when I switch away from
buffer.

If I give it global value, then it will give me message.

That means it will be invoked in the other buffer, but then how do I
recognize that previous buffer is the one with recursive edit?

Maybe I could make function to switch to window quickly, recognize if
it has recursive edit, or maybe recognize if some buffer local
variable has been set, to stop that recursive edit or record value
from inside.

I see this on above change:
#<window 224 on *mail*>

Best would be to have list of recursive edit buffers but sadly I do
not know how to get it. All I can see is in modeline [(Mail WK Fill)]
which indicates there is one or 3-4 or 10 pending recursive buffers,
but they are not shown in any list. 

If I list all buffers, and delete all of them, recursive-edit buffers
still remain hidden.

Maybe solution could be setting up global functions for
'window-buffer-change-functions to detect at other window, if
recursive-edit buffer is still open, in order to close it, save buffer
into the database;

(abort-recursive-edit) is not quite a solution, as that means my
editing my be lost.

Basically, I would like to keep 1 recursive-edit at maximum, not more.

I appreciate if someone finds better approach to solve the problem of
pending recursive-edit buffers.

Jean






                 reply	other threads:[~2024-12-18  7:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2756a07624cab7ceb1c68dd24e671ef7.support1@rcdrun.com \
    --to=bugs@gnu.support \
    --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).