From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Rutt Newsgroups: gmane.emacs.help Subject: Re: Tabs (yikes) Date: Tue, 18 Mar 2003 13:44:20 -0500 Organization: The Ohio State University Dept. of Computer and Info. Science Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1048013229 6677 80.91.224.249 (18 Mar 2003 18:47:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2003 18:47:09 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 18 19:47:08 2003 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 18vM79-0001jZ-00 for ; Tue, 18 Mar 2003 19:47:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vM5s-0004Ni-07 for gnu-help-gnu-emacs@m.gmane.org; Tue, 18 Mar 2003 13:45:48 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.ems.psu.edu!news.cis.ohio-state.edu!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: gamma.cis.ohio-state.edu Mail-Copies-To: nobody User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (sparc-sun-solaris2.8) Cancel-Lock: sha1:4Qi0AnitwncYG5ItyYsnbRnVOlE= Original-Xref: shelby.stanford.edu gnu.emacs.help:111188 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7687 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7687 "Tony Vitonis" writes: > My problem is this: In text mode, I want the Tab key to move to the > next default-tab-width stop, no matter what the context. I've been > able to do it with these options: > > (define-key text-mode-map [tab] 'tab-to-tab-stop) > (setq tab-stop-list '(3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 > 51 54 57 60 63 66 69 72 75 78)) > > But I can *not* seem to find a way to make it happen using my > default-tab-width, which I've specified this way: tab-width (which is derived from default-tab-width if unset) is used to control the display of tabs in buffers, not to control what happens when you press the TAB key. Your solution of setting the tab-stop-list is basically the right idea. I use the following code in several places to build up the list appropriately in various major modes: (defun my-build-tab-stop-list (width) (interactive "nEnter desired width: ") (let ((num-tab-stops (/ 80 width)) (counter 1) (ls nil)) (while (<= counter num-tab-stops) (setq ls (cons (* width counter) ls)) (setq counter (1+ counter))) (setq tab-stop-list (nreverse ls)))) Then, in your case, you can do a (my-build-tab-stop-list 3), which is a little cleaner. Note that you'll also want (setq tab-width 3) in text-mode so that your displayed tabs look correct on files you've created with the above settings. -- Benjamin