[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: On cut, copy, paste etc...
From: |
Lennart Borgman (gmail) |
Subject: |
Re: On cut, copy, paste etc... |
Date: |
Fri, 01 Aug 2008 21:53:18 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
Eli Zaretskii wrote:
Okay, but what does all this have to do with the original issue? You
are asking for a different behavior of C-w; I'm saying that no matter
how it behaves wrt the X selection and the clipboard, we could modify
kill-region in small ways so that clipboard-kill-region would be
unnecessary, and we then could bind kill-region to menu-bar>Edit>Cut.
It sounds like a good thing to me.
Beside that I suggest applying something like the patch below to
cua-base.el for similar reasons.
Index: cua-base.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emulation/cua-base.el,v
retrieving revision 1.98
diff -u -b -r1.98 cua-base.el
--- cua-base.el 27 Jun 2008 07:34:47 -0000 1.98
+++ cua-base.el 1 Aug 2008 19:44:20 -0000
@@ -1514,6 +1514,61 @@
(defvar cua--saved-state nil)
+(defun cua-show-cua-in-edit-menu()
+ "Change the binding hints in the menus for CUA keys.
+If `cua-mode' is on then this function may change the binding
+hint text in the edit menu for the CUA keys C-c, C-x and C-v to
+show those strings.
+
+For this to happen the variable `cua-show-cua-in-edit-menu' must
+also be non-nil and `cua-enable-cua-keys' must be t.
+
+Otherwise the binding hints are reset to their default, ie
+<copy>, <cut> and <paste>.
+
+This function should be called after turning on/off `cua-mode'."
+ (if (and cua-mode
+ cua-show-cua-in-edit-menu
+ (eq cua-enable-cua-keys t))
+ (progn
+ (define-key menu-bar-edit-menu [paste]
+ '(menu-item "Paste"
+ ;;clipboard-yank
+ cua-paste
+ :help "Paste text from clipboard"
+ :keys "C-v"))
+ (define-key menu-bar-edit-menu [copy]
+ '(menu-item "Copy"
+ ;;clipboard-kill-ring-save
+ cua-copy-region
+ :enable mark-active
+ :help "Copy text in region to the clipboard"
+ :keys "C-c"))
+ (define-key menu-bar-edit-menu [cut]
+ '(menu-item "Cut"
+ ;;clipboard-kill-region
+ cua-cut-region
+ :enable mark-active
+ :help "Delete text in region and copy it to the
clipboard"
+ :keys "C-x"))
+ )
+ (define-key menu-bar-edit-menu [paste]
+ (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
+ (define-key menu-bar-edit-menu [copy]
+ (cons "Copy" (cons "Copy text in region to the clipboard"
+ 'clipboard-kill-ring-save)))
+ (define-key menu-bar-edit-menu [cut]
+ (cons "Cut" (cons "Delete text in region and copy it to the
clipboard"
+ 'clipboard-kill-region)))))
+
+(defcustom cua-show-cua-in-edit-menu t
+ "Show C-c, C-x and C-v in the edit menu."
+ :set (lambda(sym val)
+ (set-default sym val)
+ (cua-show-cua-in-edit-menu))
+ :type 'boolean
+ :group 'cua)
+
;;;###autoload
(define-minor-mode cua-mode
"Toggle CUA key-binding mode.
@@ -1604,7 +1659,8 @@
(if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and"
"")
(if (nth 2 cua--saved-state) " PC-Selection" "")
(if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) "
enabled" "")))
- (setq cua--saved-state nil))))
+ (setq cua--saved-state nil)))
+ (cua-show-cua-in-edit-menu))
;;;###autoload
- Re: On cut, copy, paste etc..., (continued)
- Re: On cut, copy, paste etc..., Angelo Graziosi, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/01
- Re: On cut, copy, paste etc..., Angelo Graziosi, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/01
- Re: On cut, copy, paste etc..., Sven Joachim, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/01
- Re: On cut, copy, paste etc..., Sven Joachim, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/01
- Re: On cut, copy, paste etc..., David De La Harpe Golden, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/01
- Re: On cut, copy, paste etc...,
Lennart Borgman (gmail) <=
- Re: On cut, copy, paste etc..., Kim F. Storm, 2008/08/16
- Re: On cut, copy, paste etc..., David De La Harpe Golden, 2008/08/01
- Re: On cut, copy, paste etc..., Eli Zaretskii, 2008/08/02