* Prefix Argument to indent-line-function
@ 2002-11-02 23:43 JD Smith
2002-11-03 2:31 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: JD Smith @ 2002-11-02 23:43 UTC (permalink / raw)
Re: indent-for-tab-command, in indent.el
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. The variable
`current-prefix-arg' does me no good, since the line-function is called
recursively. Any suggestions for a workaround to get [C-u TAB] to
behave like before?
Thanks,
JD
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Prefix Argument to indent-line-function
2002-11-02 23:43 Prefix Argument to indent-line-function JD Smith
@ 2002-11-03 2:31 ` Stefan Monnier
2002-11-03 3:48 ` JD Smith
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2002-11-03 2:31 UTC (permalink / raw)
Cc: emacs-devel
> 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.
> The variable `current-prefix-arg' does me no good, since the line-function
> is called recursively.
I don't understand what you mean here.
> 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.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Prefix Argument to indent-line-function
2002-11-03 2:31 ` Stefan Monnier
@ 2002-11-03 3:48 ` JD Smith
2002-11-03 14:30 ` Kai Großjohann
0 siblings, 1 reply; 4+ messages in thread
From: JD Smith @ 2002-11-03 3:48 UTC (permalink / raw)
Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Prefix Argument to indent-line-function
2002-11-03 3:48 ` JD Smith
@ 2002-11-03 14:30 ` Kai Großjohann
0 siblings, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2002-11-03 14:30 UTC (permalink / raw)
JD Smith <jdsmith@as.arizona.edu> writes:
> 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.
Yes, something like
(if current-prefix-arg
(let ((current-prefix-arg nil))
...call.myself...))
seems promising.
kai
--
~/.signature is: umop ap!sdn (Frank Nobis)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-11-03 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-02 23:43 Prefix Argument to indent-line-function JD Smith
2002-11-03 2:31 ` Stefan Monnier
2002-11-03 3:48 ` JD Smith
2002-11-03 14:30 ` Kai Großjohann
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).