From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: How to rebind keys "C-j" to join-line -- SOLVED! Date: Tue, 07 Aug 2007 22:36:11 +0200 Organization: The Church of Emacs Message-ID: <87abt3jd50.fsf@debby.local.net> 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: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1186518954 27347 80.91.229.12 (7 Aug 2007 20:35:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2007 20:35:54 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Alex Wei" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 22:35:52 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 1IIVmQ-0001HI-Tb for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2007 22:35:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIVmK-00048p-Ic for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2007 16:35:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IIVm6-00048U-5l for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 16:35:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IIVm2-00045m-JO for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 16:35:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IIVm2-00045W-B3 for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 16:35:26 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IIVlz-0005Gq-LP for help-gnu-emacs@gnu.org; Tue, 07 Aug 2007 16:35:25 -0400 Original-Received: from [89.12.127.14] (helo=debby.local.net) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2xA-1IIVli1WXV-0002Z8; Tue, 07 Aug 2007 22:35:07 +0200 Original-Received: from dieter by debby.local.net with local (Exim 4.63) (envelope-from ) id 1IIVml-0000pj-LT; Tue, 07 Aug 2007 22:36:11 +0200 In-Reply-To: (Alex Wei's message of "Tue\, 7 Aug 2007 16\:03\:17 +0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Provags-ID: V01U2FsdGVkX18XEnTOizqErNVnvNA1NnSIYT+o451fW1X4qKG lxV+lLuT/2z2bsi4vkWb+ytBVenCEvXJxJoQAS8TT2uXoAK+9P A7uLgGZBVpWJmV8bla19whL6UH1XyZ4 X-Detected-Kernel: Linux 2.6? (barebone, rare!) 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:46387 Archived-At: "Alex Wei" writes: > 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 "") 'newline-and-indent) > (local-set-key (kbd "C-.") 'set-mark-command) Why not the standard binding (C-SPC)? > (local-set-key (kbd "C--") 'kill-whole-line) the same here C-S-backspace? (OK, I answer it myself: One needs three keys.) But you are restricting yourself to M-- and C-u- for negative prefix arguments. > (local-set-key (kbd "C-=") 'copy-whole-line) Yes, this is a function I'm also missing badly in Emacs. > (local-set-key (kbd "C-o") 'open-newline) What is open-newline, something like C-e RET? > (local-set-key (kbd "C-j") 'join-line) As I said M-^ is not so bad either ;-) > (add-hook 'emacs-startup-hook 'my-key-binding) > (add-hook 'change-major-mode-hook 'my-key-binding) Sorry I do not know these hooks, but wouldn't for example: (global-set-key "\C-o" 'open-newline) in your .emacs have the same effect without adding hooks? > Thanks anyway! You are very welcome. -- Best wishes H. Dieter Wilhelm Darmstadt, Germany