all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Teemu Likonen <tlikonen@iki.fi>, 8196@debbugs.gnu.org
Subject: bug#8196: 23.1; Feature request with code: "C-x TAB" to understand tab-stop-list
Date: Fri, 12 Jul 2013 12:11:31 -0700 (PDT)	[thread overview]
Message-ID: <2b9b23f3-8622-4a4e-847f-a2f751c2c881@default> (raw)
In-Reply-To: <87oba74rww.fsf@mithlond.arda>

> > I think it would be better if "C-x TAB" (bound to indent-rigidly)
> > advanced the indentation to the next tab stop (as in tab-stop-list) by
> > default, instead of by 1. Similarly, if negative prefix argument were
> > given (with "C-u -") it would change the indentation to the previous
> > tab stop.

Sorry, that does not make sense to me.

What is the "next" or "previous" tab stop?  Relative to what/where?

`indent-rigidly' is for indenting the lines in the region, all of which
might all be currently indented to different columns.  Do you pick the
indentation of one of those lines to measure the "next" or "previous" tab
stop from?  If so, which one?  Or do you measure from point (in which case
it matters which end of the region point is.

Even if you abandon the notion of a next/previous tab stop, because there
is no good answer to "Next/previous to what?", you still have a problem
if you intend to indent to ANY particular tab stop.  You cannot indent lines
RIGIDLY to any particular tab stop, unless they all happen to be indented to
the same column to begin with.  Otherwise, "to" any column has no sense.

Indenting rigidly is about indenting a particular amount, not indenting to
some column.

What you can do is indent the region rigidly a certain number of tab stops
(either direction).  For that, see below.

> > Only when the prefix argument is actual number, positive or
> > negative integer, it would move the indentation to the left or right
> > by the given count.
> 
> Any opinions on this? If you want to use the code in my first message
> just go on. The copyright assignment paperwork is done.

I am definitely against such a change, regardless of what you might actually
mean by the next/previous tab stop.

Such a change would not be great for interactive use, and it would certainly
be bad for Lisp use.  Existing code depends on the current behavior.

If you want a command that indents rigidly a certain number of tab stops (and
not TO a particular tab stop), that is easy enough to define.  Here is one
such definition.  The prefix arg specifies the number of tab stops to indent,
and a negative number means count backwards from the end of `tab-stop-list':

(defun indent-rigidly-to-tab-stop (start end nth)
  "Indent the region rigidly according to the NTH tab stop.
`tab-stop-list' defines the available tab stops.  NTH is the numeric
prefix arg.  One means indent rigidly the amount given by the first
tab stop.  If NTH is negative then indent negatively (outdent)."
  (interactive "r\np")
  (unless (zerop nth)
    (let ((tabstop  (nth (mod (1- (abs nth)) (length tab-stop-list))
                         tab-stop-list)))
      (indent-rigidly start end (if (natnump nth) tabstop (- tabstop))))))





  reply	other threads:[~2013-07-12 19:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 18:19 bug#8196: 23.1; Feature request with code: "C-x TAB" to understand tab-stop-list Teemu Likonen
2013-07-12 17:19 ` Teemu Likonen
2013-07-12 19:11   ` Drew Adams [this message]
2013-07-12 19:18     ` Drew Adams
2013-07-12 20:05     ` Teemu Likonen
2013-07-12 21:18       ` Drew Adams
2013-07-12 22:53         ` Jambunathan K
2013-07-13  5:43           ` Teemu Likonen
2013-07-13  4:49         ` Teemu Likonen
2013-07-13  4:59           ` Drew Adams
2013-07-13 20:02 ` Stefan Monnier
2013-07-14 14:41   ` Teemu Likonen
2013-10-08  6:18     ` Stefan Monnier
2013-10-08 15:12       ` Drew Adams
2013-10-08 15:34         ` Teemu Likonen
2013-10-08 16:21           ` Drew Adams

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=2b9b23f3-8622-4a4e-847f-a2f751c2c881@default \
    --to=drew.adams@oracle.com \
    --cc=8196@debbugs.gnu.org \
    --cc=tlikonen@iki.fi \
    /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.