Subject: bug#12552: closed (Re: bug#12552: 24.2; The setting of normal-erase-is-backspace-mode is erased when creating new frame)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 06 Oct 2012 02:27:02 +0000

Your bug report

#12552: 24.2; The setting of normal-erase-is-backspace-mode is erased when creating new frame

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12552: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12552
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12552: 24.2; The setting of normal-erase-is-backspace-mode is erased when creating new frame
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Fri, 05 Oct 2012 22:26:43 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.3

Thank you for the very clear report and patch.
It seems that this is already fixed in Emacs trunk, where a similar
change to the one you suggest was made 2012-06-22.

http://lists.gnu.org/archive/html/emacs-diffs/2012-06/msg00263.html

Subject: 24.2; The setting of normal-erase-is-backspace-mode is erased when creating new frame
From: Ikumi Keita <[email-masked]>
To: [email-masked]
Date: Tue, 02 Oct 2012 01:48:27 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

1. On X window, emacs -Q
2. M-x normal-erase-is-backspace-mode RET
3. At this stage, <delete> deletes backward. This is OK.
4. However, after creating new frame with C-x 5 2, <delete> deletes
   forward.  Creating new frame erased the setting of n-e-i-b-m.
   I think this behaviour is a bug.  On emacs 23, that did not happen.
   Emacs 23 retained the setting of n-e-i-b-m after creating new frame.
5. On emacs 24, the same thing occurs with C-x 5 b, C-x 5 o, etc.
   instead of C-x 5 2.

I think that the reason is that the function
normal-erase-is-backspace-mode does not store the right value in
terminal-paramter.  After the procedure of the item 2 in the above list,
M-: (terminal-parameter nil 'normal-erase-is-backspace) RET
reports nil.  However,  according to the elisp manual, the section
Terminal Parameters says:

        Here's a list of a few terminal parameters that have a special
     meaning:

     (snip)

     `normal-erase-is-backspace'
          Value is either 1 or 0, depending on whether
          `normal-erase-is-backspace-mode' is turned on or off on this
          terminal.  *Note DEL Does Not Delete: (emacs)DEL Does Not Delete.

Thus, the value of 0, instead of nil, should be stored in the terminal
parameter normal-erase-is-backspace in this case, and emacs 23 does
store 0.

Due to this issue, the function normal-erase-is-backspace-setup-frame
considers wrongly that the terminal paramter n-e-i-b is not initialized
yet when creating new frame, and resets the keybinds so that <delete>
deletes forward.

I confirmed that the following workaround fixes this problem.  (It
seems that it is cleaner to put the relavant codes in the function
body than to use variable: tag, though)

*** simple.el.orig	2012-08-23 14:33:42.000000000 +0900
--- simple.el	2012-09-28 15:43:25.000000000 +0900
*************** (define-minor-mode normal-erase-is-backs
*** 6747,6754 ****
  have both Backspace, Delete and F1 keys.
  
  See also `normal-erase-is-backspace'."
!   :variable (eq (terminal-parameter
!                  nil 'normal-erase-is-backspace) 1)
    (let ((enabled (eq 1 (terminal-parameter
                          nil 'normal-erase-is-backspace))))
  
--- 6747,6757 ----
  have both Backspace, Delete and F1 keys.
  
  See also `normal-erase-is-backspace'."
!   :variable ((eq (terminal-parameter
! 		  nil 'normal-erase-is-backspace) 1)
! 	     . (lambda (val)
! 		 (set-terminal-parameter nil 'normal-erase-is-backspace
! 					 (if val 1 0))))
    (let ((enabled (eq 1 (terminal-parameter
                          nil 'normal-erase-is-backspace))))

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/home/keita/scr/emacs-24.2/etc/DEBUG.

In GNU Emacs 24.2.1 (i386-unknown-freebsd9.0, GTK+ Version 2.24.6)
 of 2012-10-02 on localhost.my.domain
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ja_JP.eucJP
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: japanese-iso-8bit-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-h c <backspace> C-h c <delete> M-x n o r m a l <tab> 
e r <tab> <return> C-h c <delete> C-x 5 2 <switch-frame> 
C-h c <delete> <help-echo> <help-echo> <help-echo> 
<help-echo> <switch-frame> C-h c <delete> <switch-frame> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
M-x r e p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
DEL (translated from <backspace>) runs the command backward-delete-char-untabify
<deletechar> (translated from <delete>) runs the command delete-forward-char
Delete key deletes backward
DEL (translated from <delete>) runs the command backward-delete-char-untabify
<deletechar> (translated from <delete>) runs the command delete-forward-char [2 times]
Making completion list...
delete-forward-char: End of buffer

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-mode easymenu view time-date
japan-util tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win
x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)