Discussion:
Text selection can't be erased by pressing delete
(too old to reply)
Gabriel TEIXEIRA
2010-08-20 12:08:57 UTC
Permalink
Hello all,

I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour. When I select a text in those windows
(like by pushing Shift and then the arrow keys), and then I push the key
Delete, I expect that the selected/highlighted text be erased, but
instead, it erases a single character to the left of the cursor (like
would happen without the selection) and the selection disappears
(although the same operation works with Backspace or Shift+Delete
normally). It seems that the Delete key is not anymore aware of the text
selection. It is even more weird the fact that this doesn't happen with
the window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some time
opened. Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?

Thanks in advance
Gabriel Teixeira
Eli Zaretskii
2010-08-20 12:27:27 UTC
Permalink
Date: Fri, 20 Aug 2010 14:08:57 +0200
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour. When I select a text in those windows
(like by pushing Shift and then the arrow keys), and then I push the key
Delete, I expect that the selected/highlighted text be erased, but
instead, it erases a single character to the left of the cursor (like
would happen without the selection) and the selection disappears
(although the same operation works with Backspace or Shift+Delete
normally). It seems that the Delete key is not anymore aware of the text
selection. It is even more weird the fact that this doesn't happen with
the window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some time
opened. Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
What does the following command display, when you invoke it from each
of the 3 windows?

C-h c <Delete>

That is, type "C-h c", the press the <Delete> key.

Also, what version of Emacs is that? What does "M-x emacs-version"
display?
Gabriel TEIXEIRA
2010-08-20 12:57:37 UTC
Permalink
In the ill windows:

DEL (translated from <backspace>) runs the command c-electric-backspace
DEL (translated from <backspace>) runs the command c-electric-backspace

And in the good windows:
DEL (translated from <backspace>) runs the command c-electric-backspace

And, yes, I forgot to tell the emacs version before asking. Here it is:
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of
2010-07-22 on kobe
Post by Eli Zaretskii
Date: Fri, 20 Aug 2010 14:08:57 +0200
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour. When I select a text in those windows
(like by pushing Shift and then the arrow keys), and then I push the key
Delete, I expect that the selected/highlighted text be erased, but
instead, it erases a single character to the left of the cursor (like
would happen without the selection) and the selection disappears
(although the same operation works with Backspace or Shift+Delete
normally). It seems that the Delete key is not anymore aware of the text
selection. It is even more weird the fact that this doesn't happen with
the window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some time
opened. Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
What does the following command display, when you invoke it from each
of the 3 windows?
C-h c<Delete>
That is, type "C-h c", the press the<Delete> key.
Also, what version of Emacs is that? What does "M-x emacs-version"
display?
Gabriel TEIXEIRA
2010-08-20 13:15:03 UTC
Permalink
Post by Eli Zaretskii
Date: Fri, 20 Aug 2010 14:08:57 +0200
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour. When I select a text in those windows
(like by pushing Shift and then the arrow keys), and then I push the key
Delete, I expect that the selected/highlighted text be erased, but
instead, it erases a single character to the left of the cursor (like
would happen without the selection) and the selection disappears
(although the same operation works with Backspace or Shift+Delete
normally). It seems that the Delete key is not anymore aware of the text
selection. It is even more weird the fact that this doesn't happen with
the window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some time
opened. Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
What does the following command display, when you invoke it from each
of the 3 windows?
C-h c<Delete>
That is, type "C-h c", the press the<Delete> key.
Also, what version of Emacs is that? What does "M-x emacs-version"
display?
Please, disconsider my last e-mail, here it is the correct stuff:

In the ill windows:

C-d (translated from <delete>) runs the command c-electric-delete-forward
C-d (translated from <delete>) runs the command c-electric-delete-forward

And in the good windows:
C-d (translated from <delete>) runs the command c-electric-delete-forward

And, yes, I forgot to tell the emacs version before asking. Here it is:
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of
2010-07-22 on kobe
Gabriel TEIXEIRA
2010-08-20 14:02:31 UTC
Permalink
Post by Gabriel TEIXEIRA
Post by Eli Zaretskii
Date: Fri, 20 Aug 2010 14:08:57 +0200
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour. When I select a text in those windows
(like by pushing Shift and then the arrow keys), and then I push the key
Delete, I expect that the selected/highlighted text be erased, but
instead, it erases a single character to the left of the cursor (like
would happen without the selection) and the selection disappears
(although the same operation works with Backspace or Shift+Delete
normally). It seems that the Delete key is not anymore aware of the text
selection. It is even more weird the fact that this doesn't happen with
the window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some time
opened. Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
What does the following command display, when you invoke it from each
of the 3 windows?
C-h c<Delete>
That is, type "C-h c", the press the<Delete> key.
Also, what version of Emacs is that? What does "M-x emacs-version"
display?
C-d (translated from <delete>) runs the command c-electric-delete-forward
C-d (translated from <delete>) runs the command c-electric-delete-forward
C-d (translated from <delete>) runs the command c-electric-delete-forward
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of
2010-07-22 on kobe
I also found that when doing a selection and hitting Enter or any other
character inserting key, the entire selection will be replaced by the
character in the good window but in the ill windows the character will
be just inserted and the selection will be unselected. Hopefully this
can help.
Uday Reddy
2010-12-08 15:26:24 UTC
Permalink
Post by Gabriel TEIXEIRA
C-d (translated from <delete>) runs the command c-electric-delete-forward
C-d (translated from <delete>) runs the command c-electric-delete-forward
C-d (translated from <delete>) runs the command c-electric-delete-forward
This means that either you don't have the CUA-mode turned on or you don't have
a region highlighted.

Try the original question again after turning on the CUA-mode and highlighting
regions.

Cheers,
Uday Reddy

Bob Proulx
2010-08-20 16:42:38 UTC
Permalink
Post by Gabriel TEIXEIRA
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour.
On what system are you running emacs? Is this GNU/Unix, Cygwin, MSYS,
other? Running in a terminal window, or under a X11, or other native
graphics?
Post by Gabriel TEIXEIRA
When I select a text in those windows (like by pushing Shift and
then the arrow keys), and then I push the key Delete, I expect that
the selected/highlighted text be erased, but instead, it erases a
single character to the left of the cursor (like would happen
without the selection) and the selection disappears (although the
same operation works with Backspace or Shift+Delete normally). It
seems that the Delete key is not anymore aware of the text
selection.
That would be the "normal" traditional behavior of Emacs on Unix
machines for all of time prior to the recent introduction of Microsoft
key bindings.
Post by Gabriel TEIXEIRA
It is even more weird the fact that this doesn't happen with the
window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some
time opened.
That does seem strange that it would change behavior depending upon
whether you have launched subsequent emacs processes.
Post by Gabriel TEIXEIRA
Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
I do not use CUA mode but the behavior makes me wonder if something is
causing it to be enabled and then disabled somehow.

http://www.emacswiki.org/CuaMode

What is the behavior when using emacs without customizations?

emacs -q

And without any initialization?

emacs -Q

Thinking that there must be something in the initialization that is
behaving undesirably.

Bob
Gabriel TEIXEIRA
2010-08-20 17:35:41 UTC
Permalink
Post by Bob Proulx
Post by Gabriel TEIXEIRA
I've been working with three simultaneous emacs windows, each one
containing a diferent project, and I noticed that two of those three are
presenting a weird behaviour.
On what system are you running emacs? Is this GNU/Unix, Cygwin, MSYS,
other? Running in a terminal window, or under a X11, or other native
graphics?
It is under Ubuntu Linux 10.04 x64 in the graphics mode.
Post by Bob Proulx
Post by Gabriel TEIXEIRA
When I select a text in those windows (like by pushing Shift and
then the arrow keys), and then I push the key Delete, I expect that
the selected/highlighted text be erased, but instead, it erases a
single character to the left of the cursor (like would happen
without the selection) and the selection disappears (although the
same operation works with Backspace or Shift+Delete normally). It
seems that the Delete key is not anymore aware of the text
selection.
That would be the "normal" traditional behavior of Emacs on Unix
machines for all of time prior to the recent introduction of Microsoft
key bindings.
Which I think is a good behaviour since the delete key is just above the
arrow keys in my keyboard while the backspace is a little further. Since
I do selections using Shift + arrows, the delete lies just within the
range of my middle finger, while the backspace would need to elevate the
entire hand up to there, so I prefer use the delete. Besides the fact
that I can just select the text and overwrite it directly.
Post by Bob Proulx
Post by Gabriel TEIXEIRA
It is even more weird the fact that this doesn't happen with the
window that I opened the last and the other windows that I opened
after to check the behaviour. I seems that emacs "wears" after some
time opened.
That does seem strange that it would change behavior depending upon
whether you have launched subsequent emacs processes.
As I told already, maybe I mistyped something that led to this
behaviour. Those instances are opened for weeks and the behaviour
appeared after some days. I would like to know how to resolve this
without doing the Microsoft solution (restarting emacs), which works,
but lose all the layout of windows and the undo history.
Post by Bob Proulx
Post by Gabriel TEIXEIRA
Anyone have any idea of what's this? Is this a bug or I typed
accidentaly any command that triggers this behaviour?
I do not use CUA mode but the behavior makes me wonder if something is
causing it to be enabled and then disabled somehow.
http://www.emacswiki.org/CuaMode
What is the behavior when using emacs without customizations?
emacs -q
It behaves in the "normal" mode, no deletion with delete
Post by Bob Proulx
And without any initialization?
emacs -Q
The same, 'course.
Post by Bob Proulx
Thinking that there must be something in the initialization that is
behaving undesirably.
More likely to be any crazy (or lazy) finger of mine, but I leave the
hypotesys of "time wear", like a bug caused by any memory leak,
overflowed counter or command that is disabling the mode unexpectedly
(which I think is very unlikely).
Post by Bob Proulx
Bob
Thanks for the advice about the cua-mode. I gave a read to the page and
when I did M-x cua-mode, it got back to my favourite mode! Now I must
figure out which command sequence is disabling the cua-mode in order
that I don't do this anymore. I think that ad infinitum I will stop
doing those mistakes. I noticed that emacs commands are easy to mistake
one for another while typing, like, in an AZERTY kb, the C-x (one of the
most used) for the C-w (after I deleted 100 lines of c code and saved
the file unaware of that. By luck, I had a copy in the CVS).

Gabriel Teixeira
Pascal J. Bourguignon
2010-12-08 15:25:47 UTC
Permalink
Post by Gabriel TEIXEIRA
Thanks for the advice about the cua-mode. I gave a read to the page
and when I did M-x cua-mode, it got back to my favourite mode! Now I
must figure out which command sequence is disabling the cua-mode in
order that I don't do this anymore. I think that ad infinitum I will
stop doing those mistakes. I noticed that emacs commands are easy to
mistake one for another while typing, like, in an AZERTY kb, the C-x
(one of the most used) for the C-w (after I deleted 100 lines of c
code and saved the file unaware of that. By luck, I had a copy in the
CVS).
Yes, using an AZERTY keyboard is really desperately seeking problems.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Loading...