From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: CUA mode, turn off Shift+Curvor Move to Select Date: Mon, 1 Sep 2008 09:57:24 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <2d6948d6-f1d5-4b89-bd2a-cd8886e8f7a2@t1g2000pra.googlegroups.com> <51a05da4-537d-4ad5-a023-2c138b4e0969@a8g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1220290854 5370 80.91.229.12 (1 Sep 2008 17:40:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2008 17:40:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 01 19:41:48 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KaDPL-0007HT-EO for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Sep 2008 19:41:43 +0200 Original-Received: from localhost ([127.0.0.1]:33305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaDOM-00056W-AF for geh-help-gnu-emacs@m.gmane.org; Mon, 01 Sep 2008 13:40:42 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!k36g2000pri.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 114 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1220288245 5997 127.0.0.1 (1 Sep 2008 16:57:25 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 1 Sep 2008 16:57:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k36g2000pri.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:161831 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57175 Archived-At: Xah wrote: =C2=ABCUA mode, turn off Shift+Curvor Move to Select=C2=BB Thanks Lennart... I've now solved my problem by attaching a deactivate-mark as a hook to every command. See the code below: ;;; -------------------------------------------------- ;;; FIX cua-mode ;; prevent cua-mode from going into selection mode when ;; commands with Shift key is used. (add-hook 'cua-mode-hook (lambda () (define-key cua-global-keymap (kbd "M-C") 'ergokeys-cua-scroll- down) (define-key cua-global-keymap (kbd "M-T") 'ergokeys-cua-scroll-up) (define-key cua-global-keymap (kbd "M-G") 'ergokeys-backward- paragraph) (define-key cua-global-keymap (kbd "M-R") 'ergokeys-forward- paragraph) (define-key cua-global-keymap (kbd "M-H") 'ergokeys-beginning-of- buffer) (define-key cua-global-keymap (kbd "M-N") 'ergokeys-end-of-buffer) (define-key cua-global-keymap (kbd "M-D") 'ergokeys-move-end-of- line) (defun ergokeys-move-end-of-line () "Move cursor to the end of line. This command is used in cua-mode to prevent it from selection when this command is bind to a key with Shift." (interactive) (let ((deactivate-mark t)) (move-end-of-line) ) ) (defun ergokeys-beginning-of-buffer () "Move cursor to the beginning of buffer. Like beginning-of-buffer, it marks the cursor position first, but does not activate the mark in transient-mark-mode. This command is used in cua-mode to prevent it from selection when this command is bind to a key with Shift." (interactive) (let ((deactivate-mark t)) (beginning-of-buffer) ) ) (defun ergokeys-end-of-buffer () "Move cursor to the end of buffer. Like end-of-buffer, it marks the cursor position first, but does not activate the mark in transient-mark-mode. This command is used in cua-mode to prevent it from selection when this command is bind to a key with Shift." (interactive) (let ((deactivate-mark t)) (end-of-buffer) ) ) (defun ergokeys-forward-paragraph () "Move cursor forward one paragraph. Used in cua-mode to prevent it from selection when this command is bind to a key with Shift." (interactive) (let ((deactivate-mark t)) (forward-paragraph) ) ) (defun ergokeys-backward-paragraph () "Move cursor backward one paragraph. Used in cua-mode to prevent it from selection when this command is bind to a event with Shift." (interactive) (let ((deactivate-mark t)) (backward-paragraph) ) ) (defun ergokeys-cua-scroll-up () "Page down. Used in cua-mode to prevent it from selection when this command is bind to a event with Shift." (interactive) (let ((deactivate-mark t)) (cua-scroll-up)) ) (defun ergokeys-cua-scroll-down () "Page up. Used in cua-mode to prevent it from selection when this command is bind to a event with Shift." (interactive) (let ((deactivate-mark t)) (cua-scroll-down)) ) ) ) btw, just curious, is there a way to consolidate the above? i.e. instead of defun each, simply use some mechanism that attach deactivate-mark to a list of functions... Xah =E2=88=91 http://xahlee.org/ =E2=98=84