[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: if I set home key to this macro then shift+home does not select text
From: |
Tolkin, Steve |
Subject: |
RE: if I set home key to this macro then shift+home does not select text in cua-mode |
Date: |
Tue, 25 Nov 2008 11:14:39 -0500 |
Dear Xah,
Thanks. Why did I have to compile it for it to work?
First I added this to my _emacs init file and then I tried it by doing a
load-file of ~/_emacs
But it did not work.
Then I ran byte-compile-file ~/_emacs and then a load-file of ~/_emacs.elc
I pasted this just after the global-set-key line in my _emacs file and
;;; next suggested by Xah Lee email 11/25/08
(add-hook 'cua-mode-hook
(lambda ()
(put 'my-home 'CUA 'move)
)
)
Steve
-----Original Message-----
From: help-gnu-emacs-bounces+steve.tolkin=fmr.com@gnu.org
[mailto:help-gnu-emacs-bounces+steve.tolkin=fmr.com@gnu.org] On Behalf Of Xah
Lee
Sent: Tuesday, November 25, 2008 8:57 AM
To: help-gnu-emacs@gnu.org
Subject: Re: if I set home key to this macro then shift+home does not
selecttext in cua-mode
On Nov 24, 4:21 pm, "Tolkin, Steve" <Steve.Tol...@FMR.COM> wrote:
> Summary: If I bind the home key to the macro below and press shift+home
> it does not select the text.
>
> Details:
> I am running GNU Emacs 22.3.1 on of 2008-09-96 on SOFT-MJASON. On
> windows XP SP2.
> This used to work in emacs 22. I suspect the problem has to do with
> changes to cua-mode (which I have on) and/or transient mark-mode (which
> I explicitly set on in v. 22,but now seems to be part of cua-mode.)
>
> Here is the macro definition:
>
> ;; Posted to comp.emacs by:
> ;; Kai Grossjohann <Kai.Grossjoh...@CS.Uni-Dortmund.DE>
> (defun my-home ()
> "Toggle the point between the beginning of the current line, and the
> first non-whitespace character on the line."
> (interactive)
> (let ((pos (save-excursion (back-to-indentation) (point))))
> (if (equal pos (point))
> (beginning-of-line)
> (back-to-indentation))))
>
> (global-set-key [home] 'my-home)
>
[some snipped]
As to your question, you can make it work by this:
(add-hook 'cua-mode-hook
(lambda ()
(put 'my-home 'CUA 'move)
)
)
[more snipped]
Xah
∑ http://xahlee.org/
☄