unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
@ 2013-12-11  1:28 Juri Linkov
  2013-12-11  4:58 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2013-12-11  1:28 UTC (permalink / raw)
  To: 16109

In delete-selection-mode, <delete> deletes the region, but
its keypad counterpart <kp-delete> doesn't delete the region.

This is what `C-h k <delete>' displays:

    <deletechar> (translated from <delete>) runs the command
    delete-forward-char, which is an interactive compiled Lisp function in
    `simple.el'.

And this is displayed by `C-h k <kp-delete>':

    C-d (translated from <kp-delete>) runs the command
    delete-char, which is an interactive built-in function in
    `cmds.c'.

What could be done:

1. Change `delete-char' to delete the active region (might need a poll
since I recall some disagreements about this default).

2. Bind <kp-delete> to the same command `delete-forward-char'
as for <delete>.

3. Add `delete-char' back to delsel.el since typing `C-d' is handy
anyway to delete the region.





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

* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
  2013-12-11  1:28 bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode Juri Linkov
@ 2013-12-11  4:58 ` Stefan Monnier
  2013-12-11  8:49   ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-12-11  4:58 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16109

> What could be done:

> 1. Change `delete-char' to delete the active region (might need a poll
> since I recall some disagreements about this default).

> 2. Bind <kp-delete> to the same command `delete-forward-char'
> as for <delete>.

> 3. Add `delete-char' back to delsel.el since typing `C-d' is handy
> anyway to delete the region.

Shouldn't `kp-delete' be remapped to `delete'?


        Stefan





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

* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
  2013-12-11  4:58 ` Stefan Monnier
@ 2013-12-11  8:49   ` Andreas Schwab
  2013-12-11 14:23     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2013-12-11  8:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16109

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Shouldn't `kp-delete' be remapped to `delete'?

It is mapped to ?\C-d in local-function-key-map (if
normal-erase-is-backspace).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





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

* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
  2013-12-11  8:49   ` Andreas Schwab
@ 2013-12-11 14:23     ` Stefan Monnier
  2013-12-12  0:07       ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-12-11 14:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 16109-done

>> Shouldn't `kp-delete' be remapped to `delete'?
> It is mapped to ?\C-d in local-function-key-map (if
> normal-erase-is-backspace).

Oh, right, now I remember: we don't apply function-key-map repeatedly so
if we have a remapping from kp-delete to delete, it's not combined with
the mapping from delete to deletechar.

I installed the patch below instead which should fix the problem.


        Stefan


--- lisp/simple.el	2013-12-03 01:19:24 +0000
+++ lisp/simple.el	2013-12-11 14:20:27 +0000
@@ -7435,7 +7435,7 @@
 	     (if enabled
 		 (progn
 		   (define-key local-function-key-map [delete] [deletechar])
-		   (define-key local-function-key-map [kp-delete] [?\C-d])
+		   (define-key local-function-key-map [kp-delete] [deletechar])
 		   (define-key local-function-key-map [backspace] [?\C-?])
                    (dolist (b bindings)
                      ;; Not sure if input-decode-map is really right, but






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

* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
  2013-12-11 14:23     ` Stefan Monnier
@ 2013-12-12  0:07       ` Juri Linkov
  2013-12-12 18:31         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2013-12-12  0:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16109, Andreas Schwab

>>> Shouldn't `kp-delete' be remapped to `delete'?
>> It is mapped to ?\C-d in local-function-key-map (if
>> normal-erase-is-backspace).
>
> Oh, right, now I remember: we don't apply function-key-map repeatedly so
> if we have a remapping from kp-delete to delete, it's not combined with
> the mapping from delete to deletechar.

Thanks.  I discovered another case: in delete-selection-mode it's handy
to select the region of unnecessary shell output and delete with <delete>
(without putting to the kill ring).  But now neither <delete> nor <kp-delete>
delete the active region in shell.  comint.el has these lines:

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

It seems `delete-char' needs to be replaced with `delete-forward-char'
like in their global bindings?  The comment is also wrong because
globally [delete] and [kp-delete] are not aliased to C-d now.





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

* bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode
  2013-12-12  0:07       ` Juri Linkov
@ 2013-12-12 18:31         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-12-12 18:31 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 16109, Andreas Schwab

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

> It seems `delete-char' needs to be replaced with `delete-forward-char'
> like in their global bindings?

Indeed.


        Stefan





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

end of thread, other threads:[~2013-12-12 18:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11  1:28 bug#16109: 24.3.50; <kp-delete> doesn't delete region in delete-selection-mode Juri Linkov
2013-12-11  4:58 ` Stefan Monnier
2013-12-11  8:49   ` Andreas Schwab
2013-12-11 14:23     ` Stefan Monnier
2013-12-12  0:07       ` Juri Linkov
2013-12-12 18:31         ` Stefan Monnier

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