From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: [emacs] tabs, spaces, and indentation Date: Fri, 8 Oct 2010 14:44:22 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1286574316 17782 80.91.229.12 (8 Oct 2010 21:45:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Oct 2010 21:45:16 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 08 23:45:14 2010 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.69) (envelope-from ) id 1P4Kkb-0006Y0-EB for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Oct 2010 23:45:13 +0200 Original-Received: from localhost ([127.0.0.1]:43340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4Kka-0000xV-RC for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Oct 2010 17:45:12 -0400 Original-Received: from [140.186.70.92] (port=41712 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4Kjr-0000uA-OZ for Help-gnu-emacs@gnu.org; Fri, 08 Oct 2010 17:44:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4Kjq-0003R7-Gt for Help-gnu-emacs@gnu.org; Fri, 08 Oct 2010 17:44:27 -0400 Original-Received: from p3plsmtpa01-03.prod.phx3.secureserver.net ([72.167.82.83]:46088) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P4Kjq-0003Qy-6S for Help-gnu-emacs@gnu.org; Fri, 08 Oct 2010 17:44:26 -0400 Original-Received: (qmail 20534 invoked from network); 8 Oct 2010 21:44:23 -0000 Original-Received: from unknown (209.85.213.41) by p3plsmtpa01-03.prod.phx3.secureserver.net (72.167.82.83) with ESMTP; 08 Oct 2010 21:44:23 -0000 Original-Received: by ywt2 with SMTP id 2so734377ywt.0 for ; Fri, 08 Oct 2010 14:44:22 -0700 (PDT) Original-Received: by 10.90.106.19 with SMTP id e19mr1764713agc.42.1286574262120; Fri, 08 Oct 2010 14:44:22 -0700 (PDT) Original-Received: by 10.42.5.138 with HTTP; Fri, 8 Oct 2010 14:44:22 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:75098 Archived-At: On Wed, Oct 6, 2010 at 9:22 PM, PJ Weisberg w= rote: > Setting indent-line-function and indent-region-function doesn't seem > to do a damn thing, but (local-set-key "\t" 'self-insert-command) > works for #1 when it's called after you've switched to the major mode > you're using. > > Also, if you configure tab-always-indent to nil Tab will only indent > if the cursor is at the start of the line. =A0You can always insert a > literal tab with C-q Tab. > > Dunno what to do about #2. =A0The help docs lead me to believe setting > indent-line-function and indent-region-function is the answer, but > like I said those don't seem to do anything. I guess there isn't an easier way to do it, because a few hours after I wrote this somebody posted a proposal on emacs-devel for making #2 easier to turn on and off, because right now every major mode does it it's own way. (Personally, I'd also prefer it to be off. I can press TAB when I want the line indented in the standard way. If I indented it differently I don't want it changed because I fixed some punctuation.) Anyway, I've discovered that c-mode binds certain keys (semicolor, comma, etc) to functions that indent the line in addition to inserting a character. You can "fix" those by rebinding them to 'self-insert-command, just like you can with TAB. -PJ