Discussion:
backspace vs delete problem after running C-x 5 2
Dan Nicolaescu
2006-03-28 23:23:20 UTC
Permalink
With the current version of multi-tty when doing

emacs -Q

C-h k shows that the [delete] key runs delete-char

after doing C-x 5 2 it says that it runs
backspace-delete-char-untabify.

This does not happen with an older version from Jan 22nd.
It also works fine with the current CVS HEAD.

Could it be that the recent frame changes creation changes introduced
this problem?

Can somebody take a look?

Thanks
--dan
Dan Nicolaescu
2006-03-28 23:39:53 UTC
Permalink
Post by Dan Nicolaescu
With the current version of multi-tty when doing
emacs -Q
C-h k shows that the [delete] key runs delete-char
after doing C-x 5 2 it says that it runs
backspace-delete-char-untabify.
This does not happen with an older version from Jan 22nd.
I must have made a mistake when testing this, the problem also happens
with the Jan 22nd version...
Dan Nicolaescu
2006-03-29 03:30:05 UTC
Permalink
Post by Dan Nicolaescu
With the current version of multi-tty when doing
emacs -Q
C-h k shows that the [delete] key runs delete-char
after doing C-x 5 2 it says that it runs
backspace-delete-char-untabify.
The problem is an inverted condition in simple.el. Quite obvious if
you look at the test on the next line...

*** simple.el.orig Mon Mar 27 11:13:28 2006
--- simple.el Tue Mar 28 19:19:14 2006
*************** call `normal-erase-is-backspace-mode' (w
*** 5344,5350 ****
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
(unless frame (setq frame (selected-frame)))
(with-selected-frame frame
! (unless (terminal-parameter nil 'normal-erase-is-backspace)
(if (cond ((eq normal-erase-is-backspace 'maybe)
(and (not noninteractive)
(or (memq system-type '(ms-dos windows-nt))
--- 5344,5350 ----
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
(unless frame (setq frame (selected-frame)))
(with-selected-frame frame
! (when (terminal-parameter nil 'normal-erase-is-backspace)
(if (cond ((eq normal-erase-is-backspace 'maybe)
(and (not noninteractive)
(or (memq system-type '(ms-dos windows-nt))
Károly Lőrentey
2006-03-29 16:46:59 UTC
Permalink
Post by Dan Nicolaescu
The problem is an inverted condition in simple.el. Quite obvious if
you look at the test on the next line...
*** simple.el.orig Mon Mar 27 11:13:28 2006
--- simple.el Tue Mar 28 19:19:14 2006
*************** call `normal-erase-is-backspace-mode' (w
*** 5344,5350 ****
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
(unless frame (setq frame (selected-frame)))
(with-selected-frame frame
! (unless (terminal-parameter nil 'normal-erase-is-backspace)
(if (cond ((eq normal-erase-is-backspace 'maybe)
(and (not noninteractive)
(or (memq system-type '(ms-dos windows-nt))
--- 5344,5350 ----
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
(unless frame (setq frame (selected-frame)))
(with-selected-frame frame
! (when (terminal-parameter nil 'normal-erase-is-backspace)
(if (cond ((eq normal-erase-is-backspace 'maybe)
(and (not noninteractive)
(or (memq system-type '(ms-dos windows-nt))
That doesn't seem right: `normal-erase-is-backspace-mode' should only
be set up once on a terminal. The original condition prevents the
mode from being set up more than once, and it seems correct to me.
The terminal parameter n-e-i-b-m is nil if this function has not yet
run on the terminal, and non-nil (0 or 1) otherwise.

I agree that the bug is probably somewhere around
normal-erase-is-backspace-mode, though. Maybe it sets up some
frame-local parameters? (It should only touch terminal-specific
settings.)
--
K?roly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : http://lists.fnord.hu/pipermail/multi-tty/attachments/20060329/077da4da/attachment.pgp
Dan Nicolaescu
2006-03-29 17:45:51 UTC
Permalink
Post by Károly Lőrentey
I agree that the bug is probably somewhere around
normal-erase-is-backspace-mode, though. Maybe it sets up some
frame-local parameters? (It should only touch terminal-specific
settings.)
The value of local-function-keymap is changed after doing C-x 5 2.
AFAIU local-function-keymap should be terminal local, so C-x 5 2
should not changes.
Finding what changes local might solve this problem...
Dan Nicolaescu
2006-03-29 18:03:54 UTC
Permalink
Post by Dan Nicolaescu
Post by Károly Lőrentey
I agree that the bug is probably somewhere around
normal-erase-is-backspace-mode, though. Maybe it sets up some
frame-local parameters? (It should only touch terminal-specific
settings.)
The value of local-function-keymap is changed after doing C-x 5 2.
AFAIU local-function-keymap should be terminal local, so C-x 5 2
should not changes.
Finding what changes local might solve this problem...
Well, that seems to be it.

x-create-frame-with-faces calls x-setup-function-keys unconditionally,
and look at what x-setup-function-keys does:

(defun x-setup-function-keys (frame)
"Set up `function-key-map' on FRAME for the X window system."
;; Map certain keypad keys into ASCII characters that people usually expect.
(with-selected-frame frame
(define-key local-function-key-map [backspace] [127])
(define-key local-function-key-map [delete] [127])
^^^^^^

Shouldn't x-setup-function-keys be called only once per terminal, not
for each frame?
Károly Lőrentey
2006-04-01 13:37:37 UTC
Permalink
Post by Dan Nicolaescu
x-create-frame-with-faces calls x-setup-function-keys unconditionally,
(defun x-setup-function-keys (frame)
"Set up `function-key-map' on FRAME for the X window system."
;; Map certain keypad keys into ASCII characters that people usually expect.
(with-selected-frame frame
(define-key local-function-key-map [backspace] [127])
(define-key local-function-key-map [delete] [127])
^^^^^^
Shouldn't x-setup-function-keys be called only once per terminal, not
for each frame?
But of course! Thank you for debugging this. I added a fix in
patch-543, and now the delete key remains bound to 'delete-char.
--
K?roly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : http://lists.fnord.hu/pipermail/multi-tty/attachments/20060401/8d58a8e9/attachment.pgp
Continue reading on narkive:
Loading...