unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64121: 28.2; C-SPC not working in term char mode
@ 2023-06-17  0:06 Al Petrofsky
  2023-06-17  6:12 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Al Petrofsky @ 2023-06-17  0:06 UTC (permalink / raw)
  To: 64121

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

   emacs-28.2 -Q
   M-x term RET RET
   C-SPC

This should send an ASCII NUL (a zero byte) to the pty, but instead it
displays "Mark set" in the echo area.

To fix it, C-SPC needs to get special handling akin to the handling of
C-/.  Here's a patch that also makes C-M-SPC and C-M-/ work.

--- term.el 2022-09-06 17:31:54.000000000 -0400
+++ term-c-spc-fixed.el 2023-06-15 11:21:41.780140053 -0400
@@ -916,6 +916,9 @@
     (define-key map [next] 'term-send-next)
     (define-key map [xterm-paste] #'term--xterm-paste)
     (define-key map [?\C-/] #'term-send-C-_)
+    (define-key map [?\C- ] #'term-send-C-@)
+    (define-key map [?\C-\M-/] #'term-send-C-M-_)
+    (define-key map [?\C-\M- ] #'term-send-C-M-@)
     map)
   "Keyboard map for sending characters directly to the inferior process.")

@@ -1359,6 +1362,9 @@
 (defun term-send-del   () (interactive) (term-send-raw-string "\e[3~"))
 (defun term-send-backspace  () (interactive) (term-send-raw-string "\C-?"))
 (defun term-send-C-_  () (interactive) (term-send-raw-string "\C-_"))
+(defun term-send-C-@  () (interactive) (term-send-raw-string "\C-@"))
+(defun term-send-C-M-_  () (interactive) (term-send-raw-string "\e\C-_"))
+(defun term-send-C-M-@  () (interactive) (term-send-raw-string "\e\C-@"))

 (defun term-char-mode ()
   "Switch to char (\"raw\") sub-mode of term mode.

[-- Attachment #2: Type: text/html, Size: 1640 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#64121: 28.2; C-SPC not working in term char mode
  2023-06-17  0:06 bug#64121: 28.2; C-SPC not working in term char mode Al Petrofsky
@ 2023-06-17  6:12 ` Eli Zaretskii
  2023-06-17  6:26   ` Al Petrofsky
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-06-17  6:12 UTC (permalink / raw)
  To: Al Petrofsky; +Cc: 64121

> From: Al Petrofsky <al@petrofsky.org>
> Date: Fri, 16 Jun 2023 20:06:57 -0400
> 
>    emacs-28.2 -Q
>    M-x term RET RET
>    C-SPC
> 
> This should send an ASCII NUL (a zero byte) to the pty, but instead it
> displays "Mark set" in the echo area.

I cannot reproduce this here: I don't see "Mark set" in the echo area.

Maybe this somehow depends on the terminal emulator?  (I use PuTTY.)

How to verify that the null character is sent to the pty?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#64121: 28.2; C-SPC not working in term char mode
  2023-06-17  6:12 ` Eli Zaretskii
@ 2023-06-17  6:26   ` Al Petrofsky
  2023-06-17  6:40     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Al Petrofsky @ 2023-06-17  6:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64121

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

On Sat, Jun 17, 2023 at 2:12 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Al Petrofsky <al@petrofsky.org>
> > Date: Fri, 16 Jun 2023 20:06:57 -0400
> >
> >    emacs-28.2 -Q
> >    M-x term RET RET
> >    C-SPC
> >
> > This should send an ASCII NUL (a zero byte) to the pty, but instead it
> > displays "Mark set" in the echo area.
>
> I cannot reproduce this here: I don't see "Mark set" in the echo area.
>
> Maybe this somehow depends on the terminal emulator?  (I use PuTTY.)
>

I should have mentioned this bug won't show up if emacs is running in a
tty. The bug
stems from the subtle difference between C-SPC and C-@ input events on
graphical
terminals.  On a tty, C-SPC and C-@ become the same thing before they get
to emacs.


> How to verify that the null character is sent to the pty?
>

You can start an emacs -nw inside the term. Then pressing C-SPC should
result in a "Mark set" in the inner emacs's echo area.

[-- Attachment #2: Type: text/html, Size: 1693 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#64121: 28.2; C-SPC not working in term char mode
  2023-06-17  6:26   ` Al Petrofsky
@ 2023-06-17  6:40     ` Eli Zaretskii
  2023-06-17  7:08       ` Gregory Heytings
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-06-17  6:40 UTC (permalink / raw)
  To: Al Petrofsky; +Cc: 64121

> From: Al Petrofsky <al@petrofsky.org>
> Date: Sat, 17 Jun 2023 02:26:40 -0400
> Cc: 64121@debbugs.gnu.org
> 
> On Sat, Jun 17, 2023 at 2:12 AM Eli Zaretskii <eliz@gnu.org> wrote:
> 
>  > From: Al Petrofsky <al@petrofsky.org>
>  > Date: Fri, 16 Jun 2023 20:06:57 -0400
>  >
>  >    emacs-28.2 -Q
>  >    M-x term RET RET
>  >    C-SPC
>  >
>  > This should send an ASCII NUL (a zero byte) to the pty, but instead it
>  > displays "Mark set" in the echo area.
> 
>  I cannot reproduce this here: I don't see "Mark set" in the echo area.
> 
>  Maybe this somehow depends on the terminal emulator?  (I use PuTTY.)
> 
> I should have mentioned this bug won't show up if emacs is running in a tty. The bug
> stems from the subtle difference between C-SPC and C-@ input events on graphical
> terminals.  On a tty, C-SPC and C-@ become the same thing before they get to emacs.

Then I'm afraid I cannot evaluate this bug and its proposed solution,
as I don't have access to a platform where I can run a GUI Emacs with
"M-x term" still supported.

Could someone else please reproduce this and review the proposed
changes?  TIA.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#64121: 28.2; C-SPC not working in term char mode
  2023-06-17  6:40     ` Eli Zaretskii
@ 2023-06-17  7:08       ` Gregory Heytings
  2023-06-18  6:34         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gregory Heytings @ 2023-06-17  7:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Al Petrofsky, 64121


>
> Could someone else please reproduce this and review the proposed 
> changes?  TIA.
>

I can reproduce this (with Emacs 29), and the proposed changes LGTM.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#64121: 28.2; C-SPC not working in term char mode
  2023-06-17  7:08       ` Gregory Heytings
@ 2023-06-18  6:34         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2023-06-18  6:34 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: al, 64121-done

> Date: Sat, 17 Jun 2023 07:08:25 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: Al Petrofsky <al@petrofsky.org>, 64121@debbugs.gnu.org
> 
> > Could someone else please reproduce this and review the proposed 
> > changes?  TIA.
> 
> I can reproduce this (with Emacs 29), and the proposed changes LGTM.

Thanks, installed on the master branch, and closing the bug.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-18  6:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17  0:06 bug#64121: 28.2; C-SPC not working in term char mode Al Petrofsky
2023-06-17  6:12 ` Eli Zaretskii
2023-06-17  6:26   ` Al Petrofsky
2023-06-17  6:40     ` Eli Zaretskii
2023-06-17  7:08       ` Gregory Heytings
2023-06-18  6:34         ` Eli Zaretskii

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).