From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Lilja Newsgroups: gmane.emacs.devel Subject: Re: Why isn't C-m listed here? Date: Mon, 16 Apr 2007 21:38:12 +0200 Message-ID: References: <87d524l7mx.fsf@catnip.gol.com> <20070416200316.GA2655@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1176752321 15244 80.91.229.12 (16 Apr 2007 19:38:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Apr 2007 19:38:41 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 16 21:38:35 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdX22-0005g0-10 for ged-emacs-devel@m.gmane.org; Mon, 16 Apr 2007 21:38:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdX6f-0002KU-HV for ged-emacs-devel@m.gmane.org; Mon, 16 Apr 2007 15:43:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HdX6c-0002KO-DN for emacs-devel@gnu.org; Mon, 16 Apr 2007 15:43:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HdX6Z-0002K9-Vl for emacs-devel@gnu.org; Mon, 16 Apr 2007 15:43:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdX6Z-0002K6-NN for emacs-devel@gnu.org; Mon, 16 Apr 2007 15:43:15 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HdX1v-0005Jk-Bl for emacs-devel@gnu.org; Mon, 16 Apr 2007 15:38:27 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HdX1n-0005jD-7c for emacs-devel@gnu.org; Mon, 16 Apr 2007 21:38:19 +0200 Original-Received: from cust.fiber-lan.vnet.lk.85.194.49.108.stunet.se ([85.194.49.108]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Apr 2007 21:38:19 +0200 Original-Received: from mindcooler by cust.fiber-lan.vnet.lk.85.194.49.108.stunet.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Apr 2007 21:38:19 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 59 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cust.fiber-lan.vnet.lk.85.194.49.108.stunet.se User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: <20070416200316.GA2655@muc.de> X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69507 Archived-At: Alan Mackenzie wrote: > 'Evening, Eric! > > On Mon, Apr 16, 2007 at 04:43:17PM +0200, Eric Lilja wrote: >> Miles Bader wrote: >>> Eric Lilja [snip quoted raw email address] writes: >>>> As the topic says: Why isn't C-m listed here: > >>>> and if it was, what would its description be? Alias for ? > >>> It's not an alias for RET, it _is_ RET. > >>> RET == C-m > >> Ok, thanks for the quick reply. So, C-m is RET which means newline. C-j >> is newline-and-indent (C-m + ) so if I wanted a >> newline-and-indent when I press in cc mode I could do: >> (global-set-key "\C-m" "\C-j") >> in my c mode common hook? Proper way to do it? > > You could do this, but better might be this: > > (defun my-c-initialization-hook () > (define-key c-mode-base-map "\C-m" 'c-context-line-break)) > (add-hook 'c-initialization-hook 'my-c-initialization-hook) > > , as suggested by the (current) CC Mode manual (page "Sample .emacs > File"). > > This gives you proper continuation of comments and macros as well as > indentation of ordinary statements. Note also that you don't need to use > c-mode-common-hook here - it wouldn't do any harm, but you only need to > bind the key once, not every time you open a fresh CC Mode buffer. > Thanks for your reply, Alan! Actually, this is my c-mode-common-hook right now (edited today but before I saw this reply): (defun my-c-mode-common-hook () ;; my customizations for all of c-mode and related modes (message "Running my-c-mode-common-hook") (setq c-basic-offset 3) ; Use spaces, not tabs, for indentation. (setq-default indent-tabs-mode nil) ; Replace C-m (C-m == == newline) with C-j (newline-and-indent). (define-key c-mode-base-map "\C-m" 'newline-and-indent) ; Maybe on by default on windows and off by default on solaris? (delete-selection-mode 1) ; Since this is run for php-mode we want to be able to toggle to html ; mode while editing a .php-file with both php and html blocks. ; html-mode contains a key binding to toggle to php mode. (define-key c-mode-base-map "\C-c\C-h" 'html-mode) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) I will try c-context-line-break and also think about which of these I can move into the initialization hook. - Eric