emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prefix Argument to indent-line-function


From: JD Smith
Subject: Re: Prefix Argument to indent-line-function
Date: 02 Nov 2002 20:48:29 -0700

On Sat, 2002-11-02 at 19:31, Stefan Monnier wrote:
> > Prior versions of emacs passed any prefix argument to [Tab] through
> > `indent-for-tab-command' to `indent-line-function'.  Now, in Emacs 21.x,
> > that prefix argument is trapped and not passed.
> 
> Yes: many indent-line-functions don't expect an argument and crashed
> when you did C-u TAB.  So we removed it.

Aha.  My mode expects it...

> 
> > The variable `current-prefix-arg' does me no good, since the line-function
> > is called recursively.
> 
> I don't understand what you mean here.

You can use this variable, if I understand it correctly, to find the
prefix arg of the initial function called interactively in a stack of
function calls.  My indent-line-function looks for a prefix, and if it
finds it, calls code which calls itself again (non-interactively).  If
you test for current-prefix-arg, the purposefully non-interactive
invocations are confused, and an infinite loop ensues.  I suppose I
could set current-prefix-arg to nil on the first run-through.  

> 
> > Any suggestions for a workaround to get [C-u TAB] to behave like before?
> 
> Depends on the context.
> In lisp-mode, what we did was to rebind TAB to lisp-indent-line.
> I don't like this approach, admittedly, because it then disregards
> tab-always-indent.

I may resort to that.  I suppose there's no clever way to test if a
prefix argument is taken and only pass it then...

Thanks,

JD




reply via email to

[Prev in Thread] Current Thread [Next in Thread]