From: Logan Perkins <logan@lp-programming.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39687@debbugs.gnu.org
Subject: bug#39687: 26.3; Add customize-variable option for not locking keyboards
Date: Mon, 18 May 2020 18:15:15 -0700 [thread overview]
Message-ID: <6a23af03-d597-6e3e-ceb4-5fb1305a496a@lp-programming.com> (raw)
In-Reply-To: <83pne7hsyp.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 4097 bytes --]
On 2/22/20 1:27 AM, Eli Zaretskii wrote:
> > Also, are you implicitly saying that several persons work
>> > simultaneously vis-à-vis the same Emacs server? Because if not, I'm
>> > not sure I understand how simultaneous need to input from different
>> > clients could even happen.
>>
>> That's exactly the use-case where it matters most. If you're familiar
>> with Ludum Dare and similar code-sprints, it's pretty common to
>> have multiple people working on the same files at the same time. Having
>> a shared editor makes it faster and easier to draw attention to exactly
>> where one person needs help. It's also great for teaching (when you
>> aren't physically in front of the same computer), or for onboarding new
>> team members. Screen (the terminal multiplexer) can be used to similar
>> effect, but the ability to simultaneously edit the *same* file is
>> specific to emacs.
> I don't understand what you expect Emacs to do in these use cases. If
> we process inputs from several clients as they arrive, we could
> produce results that are unexpected and even disastrous. For example,
> suppose we receive C-x from one client followed by C-u from another
> followed by C-s from the first one -- if we process these in the order
> they were received, the result will be none of what the two clients
> intended.
>
> Maybe you thought that our input code will process input in chunks of
> complete sequences, and thus avoid the above-mentioned disasters, but
> then (a) I think we will need a very thorough restructuring of the
> current code in keyboard.c, as it currently decides on this
> dynamically; and (b) you will still have the same problem if the user
> of one client types C-x and then pauses for some reason.
>
> So I'm afraid I don't see what kind of solution is sought for here,
> please clarify.
Alright, I finally had time to dig in to what commit broke the split input.
The commit was e3cebbb839fc94f314659bf667c6790edebf4297, from 19 October 2019.
It was to fix Bug#37782, and improve the fix for Bug#5095.
Reverting that commit resolves the issue, but obviously reintroduces Bug#37782.
I *think* I have a patch that still fixes the current behavior, and does not
reintroduce those two bugs, I've included it below. Basically, the fix for
Bug#5095 should only be applied if we are in the right context. If we're not,
the if block above puts a Qswitch_frame at the head of the side queue and
triggers replay_entire_sequence, so we just skip the second check. It'll get
run again and catch the interruption on the next pass, but in the right context.
diff --git a/src/keyboard.c b/src/keyboard.c
index f9b9399d50..90ed1d3e9a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9599,17 +9599,23 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt,
(interrupted_kboard,
Fcons (make_lispy_switch_frame (frame),
KVAR (interrupted_kboard, kbd_queue)));
+ mock_input = 0;
+ }
+ else
+ {
+ if (FIXNUMP (key) && XFIXNUM (key) != -2)
+ {
+ /* If interrupted while initializing terminal, we
+ need to replay the interrupting key. See
+ Bug#5095 and Bug#37782. */
+ mock_input = 1;
+ keybuf[0] = key;
+ }
+ else
+ {
+ mock_input = 0;
+ }
}
- if (FIXNUMP (key) && XFIXNUM (key) != -2)
- {
- /* If interrupted while initializing terminal, we
- need to replay the interrupting key. See
- Bug#5095 and Bug#37782. */
- mock_input = 1;
- keybuf[0] = key;
- }
- else
- mock_input = 0;
goto replay_entire_sequence;
}
}
[-- Attachment #2: Type: text/html, Size: 4448 bytes --]
next prev parent reply other threads:[~2020-05-19 1:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 5:01 bug#39687: 26.3; Add customize-variable option for not locking keyboards Logan Perkins
2020-02-21 8:23 ` Eli Zaretskii
[not found] ` <32ea14fb-1ab8-186e-2534-4d3d2a56d6d8@lp-programming.com>
2020-02-22 9:27 ` Eli Zaretskii
2020-02-22 18:00 ` Logan Perkins
2020-05-19 1:15 ` Logan Perkins [this message]
2020-10-01 18:44 ` Lars Ingebrigtsen
2020-10-01 19:23 ` Eli Zaretskii
2021-07-21 15:57 ` Lars Ingebrigtsen
2021-07-21 17:52 ` Logan Perkins
2021-07-21 19:52 ` Eli Zaretskii
2021-07-21 22:08 ` Lars Ingebrigtsen
2021-07-21 22:44 ` Logan Perkins
2021-07-22 12:05 ` Lars Ingebrigtsen
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=6a23af03-d597-6e3e-ceb4-5fb1305a496a@lp-programming.com \
--to=logan@lp-programming.com \
--cc=39687@debbugs.gnu.org \
--cc=eliz@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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).