GNU bug report logs - #5668
23.1.93; comint-mode-map key definitions for [delete] and [kp-delete]

Previous Next

Package: emacs;

Reported by: "Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com>

Date: Mon, 1 Mar 2010 22:37:02 UTC

Severity: minor

Tags: notabug

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5668 in the body.
You can then email your comments to 5668 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5668; Package emacs. (Mon, 01 Mar 2010 22:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Mar 2010 22:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 23.1.93; comint-mode-map key definitions for [delete] and [kp-delete]
Date: Mon, 1 Mar 2010 16:32:05 -0600
[Message part 1 (text/plain, inline)]
This bug report will be sent to the Free Software Foundation,

not to your local site managers!

Please write in English if possible, because the Emacs maintainers

usually do not have translators to read other languages for them.



Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,

and to the gnu.emacs.bug news group.



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':





In comint.el, the following key definitions have been added to

comint-mode-map:



    ;; The following two are standardly aliased to C-d,

    ;; but they should never do EOF, just delete.

    (define-key map [delete]           'delete-char)

    (define-key map [kp-delete]       'delete-char)



Now, I understand the motivation here BUT, typically, one only defines

mode-specific C-c bindings and mode-specific pull-down menu

bindings in mode maps. In my case, I have delete and kp-delete assigned

to perform an entirely different function. This is the first time any

mode map has ever usurped my custom assignments to the delete and kp-delete

keys. In addition, the above reassignment assumes the user is using a PC

type of keyboard.  If one is using a DEC VT series keyboard, or a DEC VT

terminal series emulator, then the Delete key is located where the PC

Backspace key is located.  In this case, the Delete key assignment in

the global-map will be to DEL, not C-d.



A better approach is NOT to make these assignments unilaterally.

Instead, the code should examine the current key assignment for delete

and kp-delete in current-global-map. ONLY IF the current assignment is

"C-d" should the above redefinitions be made.





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

/users/gallagk/src/emacs-23.1.93/etc/DEBUG.





In GNU Emacs 23.1.93.1 (i686-pc-linux-gnu, GTK+ Version 2.10.4)

 of 2010-02-28 on houfcs101

Windowing system distributor `AT&T Laboratories Cambridge', version 11.0.3332

configured using `configure  '--prefix=/users/gallagk/usr/local53''



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: C

  value of $XMODIFIERS: nil

  locale-coding-system: nil

  default enable-multibyte-characters: t



Major mode: Emacs-Lisp



Minor modes in effect:

  shell-dirtrack-mode: t

  show-paren-mode: t

  display-time-mode: t

  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-encryption-mode: t

  auto-compression-mode: t

  line-number-mode: t

  transient-mark-mode: t



Recent input:

~ / s r c / <backspace> <backspace> <backspace> <backspace>

u s r / l o c a l <backspace> <backspace> <backspace>

<backspace> <backspace> <backspace> <backspace> <backspace>

<backspace> . l i s p <tab> <return> SPC SPC SPC SPC

SPC SPC SPC SPC SPC SPC f SPC p f <escape> x e d i

f f SPC b u f f SPC <return> <return> <return> n n

n n p n p n p n p n n n p n n n n n n n n n n n n n

n n n n n n <switch-frame> <down-mouse-1> <mouse-movement>

<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-1>

<down-mouse-1> <mouse-1> <down-mouse-5> <mouse-5> <down-mouse-5>

<mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5>

<triple-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>

<mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5>

<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>

<mouse-5> <down-mouse-4> <mouse-4> <double-down-mouse-4>

<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4>

<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4>

<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4>

<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>

<mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5>

<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5>

<down-mouse-4> <mouse-4> <down-mouse-1> <mouse-movement>

<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-1>

<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>

<help-echo> <down-mouse-1> <mouse-movement> <drag-mouse-1>

C-h k e o C-/ <help-echo> <down-mouse-1> <mouse-1>

q <help-echo> <down-mouse-1> <mouse-movement> <drag-mouse-1>

<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>

<mouse-movement> <mouse-movement> <drag-mouse-1> <help-echo>

<down-mouse-1> <mouse-1> <switch-frame> q y <help-echo>

C-h i q C-h f c o m i n t - d e l c h a r - o r - m

a y b e - e o f <return> <help-echo> <down-mouse-1>

<mouse-1> C-x 1 <down-mouse-5> <mouse-5> <down-mouse-5>

<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>

<down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4>

<triple-down-mouse-4> <triple-mouse-4> <down-mouse-5>

<mouse-5> <down-mouse-5> <mouse-5> <insert> <insert>

<delete> <delete> <delete> <insert> C-h k <delete>

C-h k <kp-decimal> C-h k <delete> <help-echo> <down-mouse-1>

<mouse-movement> <mouse-1> <help-echo> <down-mouse-1>

<mouse-1> <help-echo> <down-mouse-1> <mouse-1> C-x

1 <f12> b SPC SPC f <down-mouse-1> <mouse-movement>

<mouse-movement> <drag-mouse-1> <escape> x r e p o

r SPC b u g SPC <return>



Recent messages:

Only white-space differences in region 22

Refining difference region 23 ...

Region 24 in buffer A is empty [2 times]

Type C-x 4 C-o RET to restore the other window.

Undo!

Quit this Ediff session? (y or n)

Composing main Info directory...done

Type C-x 4 C-o RET to restore the other window.

Type C-x 1 to delete the help window.

Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help.



Load-path shadows:

None found.



Features:

(shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec

password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231

rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc

time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1

hex-util hashcash mail-utils emacsbug info ediff-merg ediff-diff

ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff

multi-isearch dired-aux help-mode view ansi-color shell edt picture

ehelp electric clearcase advice help-fns advice-preload tq reporter

executable easymenu dired regexp-opt comint ring cl cl-19 filladapt

paren time tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win

x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register

page menu-bar rfn-eshadow timer select scroll-bar mldrag 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 loaddefs button

minibuffer faces cus-face files text-properties overlay md5 base64

format env code-pages mule custom widget hashtable-print-readable

backquote make-network-process dbusbind system-font-setting

font-render-setting gtk x-toolkit x multi-tty emacs)



[Message part 2 (text/html, inline)]

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 02 Mar 2010 19:47:02 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Jul 2011 16:52:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 5668 <at> debbugs.gnu.org and "Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Jul 2011 16:52:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5668; Package emacs. (Wed, 13 Jul 2011 17:00:04 GMT) Full text and rfc822 format available.

Message #14 received at 5668 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Gallagher\, Kevin" <Kevin.Gallagher <at> boeing.com>
Cc: 5668 <at> debbugs.gnu.org
Subject: Re: 23.1.93;
	comint-mode-map key definitions for [delete] and [kp-delete]
Date: Wed, 13 Jul 2011 18:51:09 +0200
"Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com> writes:

>     ;; The following two are standardly aliased to C-d,
>     ;; but they should never do EOF, just delete.
>     (define-key map [delete]           'delete-char)
>     (define-key map [kp-delete]       'delete-char)

[...]

> Now, I understand the motivation here BUT, typically, one only defines
> mode-specific C-c bindings and mode-specific pull-down menu bindings
> in mode maps. In my case, I have delete and kp-delete assigned to
> perform an entirely different function.

Yes, binding [kp-delete] seems rather gratuitous, but many modes bind
[delete].  If you want to rebind them to something else, you can use the
mode hooks to alter their definitions.  So I don't really think this is
a bug.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5668; Package emacs. (Wed, 13 Jul 2011 20:02:01 GMT) Full text and rfc822 format available.

Message #17 received at 5668 <at> debbugs.gnu.org (full text, mbox):

From: "Gallagher, Kevin" <Kevin.Gallagher <at> boeing.com>
To: "5668 <at> debbugs.gnu.org" <5668 <at> debbugs.gnu.org>
Subject: RE: bug#5668 acknowledged by developer         (control message for
	bug #5668)
Date: Wed, 13 Jul 2011 15:01:29 -0500
[Message part 1 (text/plain, inline)]
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> Yes, binding [kp-delete] seems rather gratuitous, but many modes bind
> [delete].  If you want to rebind them to something else, you can use the
> mode hooks to alter their definitions.  So I don't really think this is
> a bug.

I should have been more specific.  The above change affects the EDT Emulation package (bundled with GNU Emacs) in a shell window.  (I am the maintainer of this package.).  Now, EDT Emulation does not run as a mode.  Instead, it copies the global map, escape map, etc., and modifies the copies of these maps, saving off the originals.

During first time setup, when using a Window system, a user executes edt-mapper.el to bind EDT functions to the keypad keys, function keys, and some other keys like Home, PageUp, End, PageDown, Delete, Insert, etc.  This allows the user to map EDT functions to the same (or almost the same) physical location they are bound to on DEC VT-100/VT-200 series keyboards when using the actual EDT editor on DEC VMS computers.

Normally, on a PC keyboard, an EDT Emulation user will map [delete] and [kp-delete] to the function edt-select to correspond to the default mapping in the EDT editor, but users are free to map it differently if they choose.  However, the recent change made to comint.el overrides these EDT Emulation bindings in a shell window, which really puzzled me, at first, until I cracked open comint.el and saw what was going on.

Recently, I discovered in Emacs 23.x that the keymap, local-function-key-map, has new bindings made to all the keypad keys.  These bindings override the behavior expected by edt-mapper.el and prevent it from doing the right thing.  I did develop a workaround to deal with this, but it is rather ugly.  In my .emacs file, I have to unbind all the PC keypad keys like this:

(defun undef-keys-for-edt-mapper ()
  (define-key local-function-key-map [kp-0] nil)
  (define-key local-function-key-map [kp-1] nil)
  (define-key local-function-key-map [kp-2] nil)
  (define-key local-function-key-map [kp-3] nil)
  (define-key local-function-key-map [kp-4] nil)
  (define-key local-function-key-map [kp-5] nil)
  (define-key local-function-key-map [kp-6] nil)
  (define-key local-function-key-map [kp-7] nil)
  (define-key local-function-key-map [kp-8] nil)
  (define-key local-function-key-map [kp-9] nil)
  (define-key local-function-key-map [kp-divide] nil)
  (define-key local-function-key-map [kp-multiply] nil)
  (define-key local-function-key-map [kp-subtract] nil)
  (define-key local-function-key-map [kp-add] nil)
  (define-key local-function-key-map [kp-enter] nil)
  (define-key local-function-key-map [kp-decimal] nil)
  (define-key local-function-key-map [delete] nil)
  ))

And start the EDT Emulation like this:

(defun my-term-setup ()
  ;; Allow rebinding of keypad keys and delete key in EDT
  ;; Emulation by edt-mapper.el. This is accomplished by removing
  ;; lower level redirection of these keys.
  (undef-keys-for-edt-mapper))
  ;; On MS Windows, normal-erase-is-backspace-mode is turned on by
  ;; default. When on, it also remaps most of the keypad keys,
  ;; which breaks EDT Emulation. So, it is turned off, here, to
  ;; prevent the remapping.
  (normal-erase-is-backspace-mode nil)
  (setq edt-word-entities '(?\t ?- ?/))
  (edt-emulation-on)
)
(add-hook 'term-setup-hook 'my-term-setup)

Kevin Gallagher


[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Aug 2011 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 358 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.