all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Benjamin Rutt <rutt+news@cis.ohio-state.edu>
Subject: Re: Tabs (yikes)
Date: Tue, 18 Mar 2003 13:44:20 -0500	[thread overview]
Message-ID: <wc3y93ctszf.fsf@gamma.cis.ohio-state.edu> (raw)
In-Reply-To: sJGdnbGJpLOm1eqjXTWcpQ@comcast.com

"Tony Vitonis" <vitonis@comcast.deletethis.net> 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

  parent reply	other threads:[~2003-03-18 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18 16:24 Tabs (yikes) Tony Vitonis
2003-03-18 18:40 ` Karl Pflästerer
2003-03-18 18:44 ` Benjamin Rutt [this message]
     [not found] ` <5lu1e0wl2u.fsf@rum.cs.yale.edu>
2003-03-18 19:28   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wc3y93ctszf.fsf@gamma.cis.ohio-state.edu \
    --to=rutt+news@cis.ohio-state.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.