all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* unassigning cntl-Z in cua mode
@ 2015-03-23  4:21 Stuart McGraw
  2015-03-23  4:44 ` Alexis
  2015-03-23 15:41 ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Stuart McGraw @ 2015-03-23  4:21 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

I have recently started using CUA mode and it is ok except for
one thing... I don't like having cntl-z mapped to undo.  I run
emacs in a terminal window (emacs -nw) a lot and routinely need
to suspend emacs with cntl-z, do something in the shell, then
resume emacs.

How can I undo the mapping the CUA mode applies to the cntl-z
key?  I am elisp-illiterate so a cut and paste solution would
be greatly appreciated.

Emacs 24.4 on Fedora 21 if it matters.  Thanks much...




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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  4:21 Stuart McGraw
@ 2015-03-23  4:44 ` Alexis
  2015-03-23  4:54   ` Stuart McGraw
  2015-03-23  4:55   ` Drew Adams
  2015-03-23 15:41 ` Eli Zaretskii
  1 sibling, 2 replies; 14+ messages in thread
From: Alexis @ 2015-03-23  4:44 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-03-23T15:21:51+1100, Stuart McGraw <smcg4191@frii.com> 
said:

 SM> Hello all,

 SM> I have recently started using CUA mode and it is ok except 
 for SM> one thing... I don't like having cntl-z mapped to undo. 
 I run SM> emacs in a terminal window (emacs -nw) a lot and 
 routinely need SM> to suspend emacs with cntl-z, do something in 
 the shell, then SM> resume emacs.

 SM> How can I undo the mapping the CUA mode applies to the cntl-z 
 SM> key?  I am elisp-illiterate so a cut and paste solution would 
 be SM> greatly appreciated.

(global-unset-key (kbd "C-z"))

might do the trick ....


Alexis.






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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  4:44 ` Alexis
@ 2015-03-23  4:54   ` Stuart McGraw
  2015-03-23  5:05     ` Alexis
  2015-03-23  4:55   ` Drew Adams
  1 sibling, 1 reply; 14+ messages in thread
From: Stuart McGraw @ 2015-03-23  4:54 UTC (permalink / raw)
  To: help-gnu-emacs

On 03/22/2015 10:44 PM, Alexis wrote:
> On 2015-03-23T15:21:51+1100, Stuart McGraw <smcg4191@frii.com> said:
>
> SM> Hello all,
>
> SM> I have recently started using CUA mode and it is ok except for SM>
> one thing... I don't like having cntl-z mapped to undo. I run SM> emacs
> in a terminal window (emacs -nw) a lot and routinely need SM> to suspend
> emacs with cntl-z, do something in the shell, then SM> resume emacs.
>
> SM> How can I undo the mapping the CUA mode applies to the cntl-z SM>
> key?  I am elisp-illiterate so a cut and paste solution would be SM>
> greatly appreciated.
>
> (global-unset-key (kbd "C-z"))
>
> might do the trick ....

Ah, I was try to set it to nil.
I just tried your suggestion instead but still no joy.
No errors or messages but no effect either, ctrl-z still
tries to do an undo.





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

* RE: unassigning cntl-Z in cua mode
  2015-03-23  4:44 ` Alexis
  2015-03-23  4:54   ` Stuart McGraw
@ 2015-03-23  4:55   ` Drew Adams
  2015-03-23  4:59     ` Stuart McGraw
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2015-03-23  4:55 UTC (permalink / raw)
  To: Alexis, help-gnu-emacs

> (global-unset-key (kbd "C-z")) might do the trick ....

That doesn't sound too good.

I don't use CUA mode (never have), but looking around a little
gives me the impression that you can just customize this option
to nil: `cua-enable-cua-keys'.

,----
| cua-enable-cua-keys is a variable defined in `cua-base.el'.
| Its value is t
| 
| Documentation:
| Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
| If the value is t, these mappings are always enabled.  If the value is
| `shift', these keys are only enabled if the last region was marked with
| a shifted movement key.  If the value is nil, these keys are never
| enabled.
| 
| You can customize this variable.
`----



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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  4:55   ` Drew Adams
@ 2015-03-23  4:59     ` Stuart McGraw
  2015-03-23 13:27       ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Stuart McGraw @ 2015-03-23  4:59 UTC (permalink / raw)
  To: help-gnu-emacs

On 03/22/2015 10:55 PM, Drew Adams wrote:
>> (global-unset-key (kbd "C-z")) might do the trick ....
>
> That doesn't sound too good.
>
> I don't use CUA mode (never have), but looking around a little
> gives me the impression that you can just customize this option
> to nil: `cua-enable-cua-keys'.
>
> ,----
> | cua-enable-cua-keys is a variable defined in `cua-base.el'.
> | Its value is t
> |
> | Documentation:
> | Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
> | If the value is t, these mappings are always enabled.  If the value is
> | `shift', these keys are only enabled if the last region was marked with
> | a shifted movement key.  If the value is nil, these keys are never
> | enabled.
> |
> | You can customize this variable.
> `----

But I don't want to disable all of them, just ctrl-z.





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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  4:54   ` Stuart McGraw
@ 2015-03-23  5:05     ` Alexis
  2015-03-23  5:19       ` Stuart McGraw
  0 siblings, 1 reply; 14+ messages in thread
From: Alexis @ 2015-03-23  5:05 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-03-23T15:54:01+1100, Stuart McGraw <smcg4191@frii.com> 
said:

 SM> Ah, I was try to set it to nil.  I just tried your suggestion 
 SM> instead but still no joy.  No errors or messages but no 
 effect SM> either, ctrl-z still tries to do an undo.

Odd. What does Emacs say when you ask about the C-z keybinding:

C-h k C-z

?


Alexis.




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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  5:05     ` Alexis
@ 2015-03-23  5:19       ` Stuart McGraw
  2015-03-23  5:39         ` Alexis
  0 siblings, 1 reply; 14+ messages in thread
From: Stuart McGraw @ 2015-03-23  5:19 UTC (permalink / raw)
  To: help-gnu-emacs

On 03/22/2015 11:05 PM, Alexis wrote:
> On 2015-03-23T15:54:01+1100, Stuart McGraw <smcg4191@frii.com> said:
>
> SM> Ah, I was try to set it to nil.  I just tried your suggestion SM>
> instead but still no joy.  No errors or messages but no effect SM>
> either, ctrl-z still tries to do an undo.
>
> Odd. What does Emacs say when you ask about the C-z keybinding:
>
> C-h k C-z

Still seems to be bound to undo:

| C-z runs the command undo, which is an interactive compiled Lisp
| function in `simple.el'.
|
| It is bound to C-z, C-_, <undo>, C-/, C-x u, <menu-bar> <edit> <undo>.
|...

The "(global-unset-key (kbd "C-z"))" line is at the bottom
of my .emacs file, I didn't do something silly like putting
it above the cua-enabling stuff.





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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  5:19       ` Stuart McGraw
@ 2015-03-23  5:39         ` Alexis
  2015-03-23  5:58           ` Stuart McGraw
  0 siblings, 1 reply; 14+ messages in thread
From: Alexis @ 2015-03-23  5:39 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-03-23T16:19:34+1100, Stuart McGraw <smcg4191@frii.com> 
said:

 SM> On 03/22/2015 11:05 PM, Alexis wrote:

 >> On 2015-03-23T15:54:01+1100, Stuart McGraw <smcg4191@frii.com> 
 >> said:
 >> 
 SM> Ah, I was try to set it to nil.  I just tried your suggestion 
 SM> 
 >> instead but still no joy.  No errors or messages but no effect 
 >> SM> either, ctrl-z still tries to do an undo.
 >> 
 >> Odd. What does Emacs say when you ask about the C-z 
 >> keybinding:
 >> 
 >> C-h k C-z

 SM> Still seems to be bound to undo:

 SM> | C-z runs the command undo, which is an interactive compiled 
 SM> Lisp | function in `simple.el'.  | | It is bound to C-z, C-_, 
 SM> <undo>, C-/, C-x u, <menu-bar> <edit> <undo>.  |...

 SM> The "(global-unset-key (kbd "C-z"))" line is at the bottom of 
 my SM> .emacs file, I didn't do something silly like putting it 
 above SM> the cua-enabling stuff.

*nod*

Perhaps instead try:

(setq cua-remap-control-z nil)

?


Alexis.



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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  5:39         ` Alexis
@ 2015-03-23  5:58           ` Stuart McGraw
  2015-03-23  6:05             ` Alexis
  0 siblings, 1 reply; 14+ messages in thread
From: Stuart McGraw @ 2015-03-23  5:58 UTC (permalink / raw)
  To: help-gnu-emacs

On 03/22/2015 11:39 PM, Alexis wrote:
> On 2015-03-23T16:19:34+1100, Stuart McGraw <smcg4191@frii.com> said:
> SM> On 03/22/2015 11:05 PM, Alexis wrote:
>  >> On 2015-03-23T15:54:01+1100, Stuart McGraw <smcg4191@frii.com> >> said:
>  >> SM> Ah, I was try to set it to nil.  I just tried your suggestion
> SM> >> instead but still no joy.  No errors or messages but no effect >>
> SM> either, ctrl-z still tries to do an undo.
>  >> >> Odd. What does Emacs say when you ask about the C-z >> keybinding:
>  >> >> C-h k C-z
>
> SM> Still seems to be bound to undo:
>
> SM> | C-z runs the command undo, which is an interactive compiled SM>
> Lisp | function in `simple.el'.  | | It is bound to C-z, C-_, SM>
> <undo>, C-/, C-x u, <menu-bar> <edit> <undo>.  |...
>
> SM> The "(global-unset-key (kbd "C-z"))" line is at the bottom of my SM>
> .emacs file, I didn't do something silly like putting it above SM> the
> cua-enabling stuff.
>
> *nod*
>
> Perhaps instead try:
>
> (setq cua-remap-control-z nil)

Bingo!  When put above the cua-enabling code it works excellently.
Thank you!!





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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  5:58           ` Stuart McGraw
@ 2015-03-23  6:05             ` Alexis
  0 siblings, 0 replies; 14+ messages in thread
From: Alexis @ 2015-03-23  6:05 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-03-23T16:58:47+1100, Stuart McGraw <smcg4191@frii.com> 
said:
 
 >> Perhaps instead try:
 >> 
 >> (setq cua-remap-control-z nil)

 SM> Bingo!  When put above the cua-enabling code it works SM> 
 excellently.  Thank you!!

:-) You're welcome!


Alexis.



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

* RE: unassigning cntl-Z in cua mode
  2015-03-23  4:59     ` Stuart McGraw
@ 2015-03-23 13:27       ` Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2015-03-23 13:27 UTC (permalink / raw)
  To: Stuart McGraw, help-gnu-emacs

> > I don't use CUA mode (never have), but looking around a little
> > gives me the impression that you can just customize this option
> > to nil: `cua-enable-cua-keys'.
> 
> But I don't want to disable all of them, just ctrl-z.

Sorry, I meant customize option `cua-remap-control-z'.
I was looking at that one but I copied the wrong one.

`M-x customize-group cua' shows you the available options.

(In my case, I visited `cua-base.el' and searched for `C-z'
to find it.)



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

* Re: unassigning cntl-Z in cua mode
  2015-03-23  4:21 Stuart McGraw
  2015-03-23  4:44 ` Alexis
@ 2015-03-23 15:41 ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2015-03-23 15:41 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Stuart McGraw <smcg4191@frii.com>
> Date: Sun, 22 Mar 2015 22:21:51 -0600
> 
> I have recently started using CUA mode and it is ok except for
> one thing... I don't like having cntl-z mapped to undo.  I run
> emacs in a terminal window (emacs -nw) a lot and routinely need
> to suspend emacs with cntl-z, do something in the shell, then
> resume emacs.
> 
> How can I undo the mapping the CUA mode applies to the cntl-z
> key?  I am elisp-illiterate so a cut and paste solution would
> be greatly appreciated.

"C-x C-z" also suspends, so you can have both suspend and undo.



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

* Re: unassigning cntl-Z in cua mode
       [not found] <mailman.2569.1427085318.31049.help-gnu-emacs@gnu.org>
@ 2015-03-23 18:04 ` Emanuel Berg
  2015-03-23 23:00   ` Emanuel Berg
  0 siblings, 1 reply; 14+ messages in thread
From: Emanuel Berg @ 2015-03-23 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

Stuart McGraw <smcg4191@frii.com> writes:

> I have recently started using CUA mode and it is ok
> except for one thing... I don't like having cntl-z
> mapped to undo. I run emacs in a terminal window
> (emacs -nw) a lot and routinely need to suspend
> emacs with cntl-z, do something in the shell, then
> resume emacs.

If you are a terminal, 'emacs -nw' and shell user are
you sure you want Cua-mode? If you take a look on the
keyboard and see where the kill and yank keys are
positioned you see they are closer, and therefore
faster and more ergonomic than the "Cua" keys, which
is also important to your thinking. So if you dont
"mind", using the kill and yank keys will in time make
you take an interest in the mechanics of the kill ring
which is a very practical tool when writing tons of
data and text and code everyday (and especially every
night). In time, you will want all that functionality
anyway so then you'll have a hybrid between the
standard kill/yank keys and the kill/yank keys that
aren't covered by the Cua keys.

As for suspending Emacs, instead of doing that, have
a tabbed terminal (urxvt had a Perl module for this,
I remember) or have several windows in X, plus
a window manager so you can switch quickly: e.g.,
Openbox and then just M-TAB (in Emacs notation) to
iterate the windows. Or, if you want to stick with one
window, use tmux with different panes that are easily
switched between (some people use screen for that).
Or, do

    M-x shell RET

and do the shell work in Emacs as well.

> How can I undo the mapping the CUA mode applies to
> the cntl-z key? I am elisp-illiterate so a cut and
> paste solution would be greatly appreciated.

I'm sure you have already received help, so I won't
tell you again, instead, why not "start stopping"
being an Elisp illiterate right now by picking apart
the (very simple) form you got, to understand what it
does. Baby steps first. It is a very good way of
acquiring LISP because you do simple and useful things
that work, and then you continue, all the while
increasing the complexity (or quantity at least).
So you learn LISP not to learn LISP but while
sharpening your tools and increasing your
understanding of them. Make it work, by outworking
the opposition!

> Emacs 24.4 on Fedora 21 if it matters.

I don't think it should matter unless the Cua-mode
changed dramatically since a previous version.
The distribution do not matter, it is rather the
terminal emulator that matters because that intercepts
the keystroke before Emacs can do anything with it.
For example, C-z doesn't do what you describe for me,
neither in the Linux VTs nor in X with xterm. I don't
remember configuring that, but there have been so many
configurations. `suspend-frame' is related for the
dreamer and digger.

-- 
underground experts united


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

* Re: unassigning cntl-Z in cua mode
  2015-03-23 18:04 ` unassigning cntl-Z in cua mode Emanuel Berg
@ 2015-03-23 23:00   ` Emanuel Berg
  0 siblings, 0 replies; 14+ messages in thread
From: Emanuel Berg @ 2015-03-23 23:00 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> ... For example, C-z doesn't do what you describe
> for me, neither in the Linux VTs nor in X with
> xterm. I don't remember configuring that, but there
> have been so many configurations. `suspend-frame' is
> related for the dreamer and digger.

It seems it is not the terminal emulator that does
this - or, at some level it must do IO, yes, but this
particular issue seems to be nevertheless configurable
on the shell and editor (Emacs) levels.

If you don't want Emacs to be suspended:

    (put 'suspend-frame    'disabled     t)

and/or disable the key:

    (global-unset-key "\C-z")

I was about to say, *rebind* it to something else that
is useful, but one has to be Houdini to actually use
it with any enjoyment - one's left little finger *and*
ring finger?

If one on the other hand suspend Emacs and tries to
resume it with 'fg' and the shell says

    fg: no job control in this shell

or the equivalent, that means job control is disabled
in the shell, so examine the rc files - e.g., in zsh
this

    setopt nomonitor

disables job control.

-- 
underground experts united


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

end of thread, other threads:[~2015-03-23 23:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2569.1427085318.31049.help-gnu-emacs@gnu.org>
2015-03-23 18:04 ` unassigning cntl-Z in cua mode Emanuel Berg
2015-03-23 23:00   ` Emanuel Berg
2015-03-23  4:21 Stuart McGraw
2015-03-23  4:44 ` Alexis
2015-03-23  4:54   ` Stuart McGraw
2015-03-23  5:05     ` Alexis
2015-03-23  5:19       ` Stuart McGraw
2015-03-23  5:39         ` Alexis
2015-03-23  5:58           ` Stuart McGraw
2015-03-23  6:05             ` Alexis
2015-03-23  4:55   ` Drew Adams
2015-03-23  4:59     ` Stuart McGraw
2015-03-23 13:27       ` Drew Adams
2015-03-23 15:41 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.