emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: marking using shifted arrow keys (CUA mode)


From: Reiner Steib
Subject: Re: marking using shifted arrow keys (CUA mode)
Date: Sat, 21 Jul 2007 16:25:19 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

On Mon, Jul 16 2007, Reiner Steib wrote:

> - add index entry
> - add hint and a cross reference in (info "(emacs)Marking Objects")
> - "movement keys" -> "arrow keys"
... plus:

- Define cua-selection-mode using define-minor-mode.
- Document cua-selection-mode in the manual

Here's the patch.  I'm not sure how much of the documentation should
be in "Marking Objects" and how much in "CUA Bindings".

--8<---------------cut here---------------start------------->8---
Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11049.2.143
diff -u -r1.11049.2.143 ChangeLog
--- lisp/ChangeLog      21 Jul 2007 09:06:17 -0000      1.11049.2.143
+++ lisp/ChangeLog      21 Jul 2007 14:11:19 -0000
@@ -1,3 +1,8 @@
+2007-07-21  Reiner Steib  <address@hidden>
+
+       * emulation/cua-base.el (cua-selection-mode): Define using
+       cua-selection-mode to allow customization.
+
 2007-07-21  Thien-Thi Nguyen  <address@hidden>
 
        * emacs-lisp/lisp-mode.el (calculate-lisp-indent): In the
Index: lisp/emulation/cua-base.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emulation/cua-base.el,v
retrieving revision 1.78
diff -u -r1.78 cua-base.el
--- lisp/emulation/cua-base.el  24 Feb 2007 21:52:43 -0000      1.78
+++ lisp/emulation/cua-base.el  21 Jul 2007 14:11:20 -0000
@@ -1582,14 +1582,25 @@
                 (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " 
enabled" "")))
     (setq cua--saved-state nil))))
 
-
 ;;;###autoload
-(defun cua-selection-mode (arg)
-  "Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings."
-  (interactive "P")
-  (setq-default cua-enable-cua-keys nil)
-  (cua-mode arg))
-
+(define-minor-mode cua-selection-mode
+  "Toggle CUA selection mode without the C-z/C-x/C-c/C-v bindings.
+When enabled, using shifted movement keys will activate the
+region (and highlight the region using `transient-mark-mode'),
+and typed text replaces the active selection."
+  :global t
+  :group 'cua
+  :require 'cua-base
+  :lighter nil
+  :keymap nil
+  :link '(emacs-commentary-link "cua-base.el")
+  ;; nil nil nil
+  (if cua-selection-mode
+      (progn
+       (setq-default cua-enable-cua-keys nil)
+       (cua-mode 1))
+    (setq-default cua-enable-cua-keys t)
+    (cua-mode -1)))
 
 (defun cua-debug ()
   "Toggle CUA debugging."
Index: man/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/man/ChangeLog,v
retrieving revision 1.1267.2.23
diff -u -r1.1267.2.23 ChangeLog
--- man/ChangeLog       13 Jul 2007 20:36:29 -0000      1.1267.2.23
+++ man/ChangeLog       21 Jul 2007 14:11:22 -0000
@@ -1,3 +1,11 @@
+2007-07-21  Reiner Steib  <address@hidden>
+
+       * killing.texi (CUA Bindings): Add index entry for marking using
+       shifted arrow keys.  Document cua-selection-mode.  Reorder.
+
+       * mark.texi (Marking Objects): Document cua-selection-mode.  Add
+       refererence to CUA Bindings.
+
 2007-07-13  Eli Zaretskii  <address@hidden>
 
        * Makefile.in (../info/emacs-mime): Use --enable-encoding.
Index: man/killing.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/man/killing.texi,v
retrieving revision 1.60
diff -u -r1.60 killing.texi
--- man/killing.texi    11 Apr 2007 20:57:52 -0000      1.60
+++ man/killing.texi    21 Jul 2007 14:11:23 -0000
@@ -647,19 +647,22 @@
 paste (yank), and @kbd{C-z} undo.  Standard Emacs commands like
 @kbd{C-x C-c} still work, because @kbd{C-x} and @kbd{C-c} only take
 effect when the mark is active (and the region is highlighted).
-However, if you don't want to override these bindings in Emacs at all,
-set @code{cua-enable-cua-keys} to @code{nil}.
 
-  In CUA mode, using @kbd{Shift} together with the movement keys
-activates and highlights the region over which they move.  The
-standard (unshifted) movement keys deactivate the mark, and typed text
-replaces the active region as in Delete-Selection mode
-(@pxref{Mouse Commands}).
-
-  To enter an Emacs command like @kbd{C-x C-f} while the mark is
-active, use one of the following methods: either hold @kbd{Shift}
-together with the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type
-the prefix key twice, e.g. @kbd{C-x C-x C-f}.
+  To enter an Emacs command like @kbd{C-x C-f} while the mark is active,
+use one of the following methods: either hold @kbd{Shift} together with
+the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type the prefix key
+twice, e.g. @kbd{C-x C-x C-f}.  If you don't want to override these
+bindings in Emacs at all, set @code{cua-enable-cua-keys} to @code{nil}.
+
address@hidden marking, using shifted arrow keys
+  In CUA mode, using @kbd{Shift} together with the movement keys (the
+arrow keys, @kbd{C-f}, etc.) activates and highlights the region over
+which they move.  The standard (unshifted) movement keys deactivate the
+mark, and typed text replaces the active region as in Delete-Selection
+mode (@pxref{Mouse Commands}).  If you only want to use marking using
+shifted movement keys without the
address@hidden/@kbd{C-x}/@kbd{C-c}/@kbd{C-v} bindings, customize
address@hidden
 
 @cindex rectangle highlighting
   CUA mode provides enhanced rectangle support with visible
Index: man/mark.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/man/mark.texi,v
retrieving revision 1.39
diff -u -r1.39 mark.texi
--- man/mark.texi       21 Jan 2007 04:41:10 -0000      1.39
+++ man/mark.texi       21 Jul 2007 14:11:23 -0000
@@ -373,6 +373,13 @@
 
   In Transient Mark mode, all of these commands activate the mark.
 
address@hidden @cindex marking, using shifted arrow keys
address@hidden cua-selection-mode
address@hidden cua-selection-mode
+  With @code{cua-selection-mode}, @kbd{Shift} together with the movement
+keys (the arrow keys, @kbd{C-f}, etc.) activates and highlights the
+region over which they move.  @xref{CUA Bindings}.
+
 @node Mark Ring
 @section The Mark Ring
 
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]