help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to rebind keys "C-j" to join-line -- SOLVED!


From: Alex Wei
Subject: Re: How to rebind keys "C-j" to join-line -- SOLVED!
Date: Tue, 7 Aug 2007 16:03:17 +0800

Hi all
 
I've figured out how to secure binding my keys :D , I found two hooks that will guarantee my key-bindings will not be overrided.
 
(defun my-key-binding ()
  "Customize my key bindings after Emacs startup."
  (interactive)
  ;; Key bindings                                                               
  (local-set-key (kbd "<RET>") 'newline-and-indent)
  (local-set-key (kbd "C-.") 'set-mark-command)
  (local-set-key (kbd "C--") 'kill-whole-line)
  (local-set-key (kbd "C-=") 'copy-whole-line)
  (local-set-key (kbd "C-o") 'open-newline)
  (local-set-key (kbd "C-j") 'join-line)
 )
 
(add-hook 'emacs-startup-hook 'my-key-binding)
(add-hook 'change-major-mode-hook 'my-key-binding)
Thanks anyway!
 
Best Regards
 
Alex Wei
Sierra Atlantic
----- Original Message -----
Sent: Tuesday, August 07, 2007 5:00 AM
Subject: Re: How to rebind keys "C-j" to join-line

"Alex Wei" <swei@arrayinc.com> writes:

> Thanks    H. Dieter Wilhelm

> I don't need the original C-j keybinding, the "M-^" needs to press 3 keys at

I see, (I, personally, count M+SHIFT as one key, pressed at the same time ;-)

> same time, so I want to rebind the C-j to join-line. I am just wondering how to
> rebind the key or how can I find the hook.

> After opening the Emacs, I type  (local-set-key (kbd "C-j") 'join-line)  and
> then Cx Ce, It works!!

Have you tried (global-set-key)?  Maybe local-set-key works only in
the *scratch* buffer at start-up?  Sorry I'm not sure.

--
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

reply via email to

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