From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Alex Wei" Newsgroups: gmane.emacs.help Subject: Re: How to rebind keys "C-j" to join-line -- SOLVED! Date: Tue, 7 Aug 2007 16:03:17 +0800 Message-ID: References: <1EA8C5CAFEE34474B0BC8809A468377F@array8f42e753d><87r6mkngx6.fsf@debby.local.net> <87ejigjs46.fsf@debby.local.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1702681996==" X-Trace: sea.gmane.org 1186473848 26366 80.91.229.12 (7 Aug 2007 08:04:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2007 08:04:08 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Dieter Wilhelm" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 10:04:06 2007 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 1IIK2o-0006IP-KY for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2007 10:04:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIK2m-0000Gn-MG for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2007 04:03:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IIK2S-0000GX-Ga for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 04:03:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IIK2I-0000Ao-PS for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 04:03:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIK2I-0000Aa-GH for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 04:03:26 -0400 Original-Received: from w98.arrayinc.com ([207.190.196.98] helo=barracuda.arrayinc.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IIK2G-0000cU-38 for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 04:03:25 -0400 X-ASG-Debug-ID: 1186473789-2f9900160000-2yy5ZX X-Barracuda-URL: http://172.22.0.241:8000/cgi-bin/mark.cgi X-Barracuda-Connect: unknown[59.37.5.20] X-Barracuda-Start-Time: 1186473789 Original-Received: from array8f42e753d (unknown [59.37.5.20]) by barracuda.arrayinc.com (Spam Firewall) with ESMTP id E1496397A8; Tue, 7 Aug 2007 04:03:12 -0400 (EDT) X-ASG-Orig-Subj: Re: How to rebind keys "C-j" to join-line -- SOLVED! X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 12.0.1184 X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1184 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at arrayinc.com X-Detected-Kernel: Linux 2.4-2.6 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:46369 Archived-At: This is a multi-part message in MIME format. --===============1702681996== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0056_01C7D90C.77CA4C90" This is a multi-part message in MIME format. ------=_NextPart_000_0056_01C7D90C.77CA4C90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 = =20 (local-set-key (kbd "") 'newline-and-indent) (local-set-key (kbd "C-.") 'set-mark-command) (local-set-key (kbd "C--") 'kill-whole-line) (local-set-key (kbd "C-=3D") '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=20 Sierra Atlantic ----- Original Message -----=20 From: Dieter Wilhelm=20 To: Alex Wei=20 Cc: help-gnu-emacs@gnu.org=20 Sent: Tuesday, August 07, 2007 5:00 AM Subject: Re: How to rebind keys "C-j" to join-line "Alex Wei" writes: > Thanks H. Dieter Wilhelm > =20 > 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. > =20 > 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. --=20 Best wishes H. Dieter Wilhelm Darmstadt, Germany ------=_NextPart_000_0056_01C7D90C.77CA4C90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all
 
I've figured out how to secure binding my keys :D , I found two = hooks that=20 will guarantee my key-bindings will not be overrided.
 
(defun my-key-binding ()
  "Customize my key bindings after = Emacs=20 startup."
  (interactive)
  ;; Key=20 bindings           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;   =20
  (local-set-key (kbd "<RET>") = 'newline-and-indent)
 =20 (local-set-key (kbd "C-.") 'set-mark-command)
  (local-set-key = (kbd=20 "C--") 'kill-whole-line)
  (local-set-key (kbd "C-=3D")=20 'copy-whole-line)
  (local-set-key (kbd "C-o") = 'open-newline)
 =20 (local-set-key (kbd "C-j") 'join-line)
 )
 
(add-hook 'emacs-startup-hook 'my-key-binding)
(add-hook=20 'change-major-mode-hook 'my-key-binding)
Thanks anyway!
 
Best Regards
 
Alex Wei
Sierra Atlantic
----- Original Message -----
From:=20 Dieter Wilhelm
Cc: help-gnu-emacs@gnu.org =
Sent: Tuesday, August 07, 2007 = 5:00=20 AM
Subject: Re: How to rebind keys = "C-j" to=20 join-line

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

>=20 Thanks    H. Dieter Wilhelm

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

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

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

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

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

--
    Best = wishes

   =20 H. Dieter Wilhelm
    Darmstadt,=20 Germany ------=_NextPart_000_0056_01C7D90C.77CA4C90-- --===============1702681996== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============1702681996==--