From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Chris Hobbs" Newsgroups: gmane.emacs.help Subject: Re: Tab within comments in C/C++ mode Date: Thu, 31 Oct 2002 01:28:23 GMT Organization: Prodigy Internet http://www.prodigy.com Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <878z0fa9wo.fsf@enberg.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: main.gmane.org 1036028041 5769 80.91.224.249 (31 Oct 2002 01:34:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 31 Oct 2002 01:34:01 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1874Df-0001Uu-00 for ; Thu, 31 Oct 2002 02:34:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 1874BR-0003Wu-00; Wed, 30 Oct 2002 20:31:41 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.triton.net!triton.net!newsfeeder.triton.net!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr21.news.prodigy.com.POSTED!3144c1a9!not-for-mail User-Agent: Pan/0.13.0 (The whole remains beautiful) Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 63.207.93.34 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: newssvr21.news.prodigy.com 1036027703 ST000 63.207.93.34 (Wed, 30 Oct 2002 20:28:23 EST) Original-NNTP-Posting-Date: Wed, 30 Oct 2002 20:28:23 EST X-UserInfo1: TSU[@IONVZU[RTT^YROF_RDB]JT@QDDMEPWXODMMHXMTWA]EPMTC@AWZWDXZXQ[K\FFSKCVM@F_N_DOBWVWG__LG@VVOIPLIGX\\BU_B@\P\PFX\B[APHTWAHDCKJF^NHD[YJAZMCY_CWG[SX\Y]^KC\HSZRWSWKGAY_PC[BQ[BXAS\F\\@DMTLFZFUE@\VL Original-Xref: shelby.stanford.edu gnu.emacs.help:106598 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3148 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3148 Thanks for the info guys. The "C - q" worked. I will test out the function later on, or work out something similar. This is just the info I needed. I had no idea c++ mode was trying a function instead of the literal. Guess I should have checked the key bindings. :) - Chris On Wed, 30 Oct 2002 22:34:15 +0100, Henrik Enberg wrote: > "Chris Hobbs" writes: > >> I am looking for a way to allow the tab key while inside comments in C and >> C++ mode. Currently, the mode will not allow a tab (let alone multiple >> tabs) to be placed while in a comment. It seems to insist on formatting >> the contents of the comment. Not really formatting per se, mainly just >> disallowing any format I want to put in there. > > `C-q TAB' should do what you want. C-q runs `quoted-insert' which > insets the next thing you type verbatim. > > If you think that is annoying you could try putting this (untested) code > in ~/.emacs.el > > (add-hook 'post-command-hook > (lambda () > (when (memq major-mode '(c-mode c++-mode java-mode)) > (if (eq (get-text-property (point) 'face) > 'font-lock-comment-face) > (local-set-key (kbd "") 'tab-to-tab-stop) > (local-set-key (kbd "") 'c-indent-command)))))