[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C-u prefix behavior of TAB broken
From: |
Miles Bader |
Subject: |
Re: C-u prefix behavior of TAB broken |
Date: |
Sun, 23 Dec 2007 10:39:39 +0900 |
Stefan Monnier <address@hidden> writes:
>>> Can't indent-for-tab-command simply, if there's a prefix argument given,
>>> rigidly indent the following sexp by the change in indentation? That
>>> doesn't seem hard at all, and matches the behavior I remember (perhaps
>>> there are corner cases where it would differ, but I don't think I know
>>> about them...).
>
>> For `tab-always-indent' t it might make sense to do `beginning-of-line'
>> before the `forward-sexp'. Otherwise it should work wherever
>> `forward-sexp' behaves reasonably. BTW, isn't
>
>> ((memq indent-line-function '(indent-relative indent-relative-maybe))
>> (funcall indent-line-function))
>> ;; Indent the line.
>> (t
>> (indent-according-to-mode))
>
>> semantically equivalent to
>
>> (t
>> (funcall indent-line-function))
>
> No, it's not: check the definition of indent-according-to-mode.
>
> The difference is to distinguish between the case where the user hits
> TAB (and hence wants some kind of effect) as opposed to when
> line-indentation is done non-interactively (e.g. by skeleton).
>
> Stefan
But indent-according-to-mode is defined like this:
(defun indent-according-to-mode ()
....
(if (memq indent-line-function
'(indent-relative indent-relative-maybe))
... do some stuff ...
;; The normal case.
(funcall indent-line-function)))
So this:
(cond
...
((memq indent-line-function '(indent-relative indent-relative-maybe))
(funcall indent-line-function))
;; Indent the line.
(t
(indent-according-to-mode))
Is equivalent to this:
(cond
...
((memq indent-line-function '(indent-relative indent-relative-maybe))
(funcall indent-line-function))
;; Indent the line.
(t
(if (memq indent-line-function
'(indent-relative indent-relative-maybe))
... do some stuff ...
;; The normal case.
(funcall indent-line-function)))
and since the first cond branch catches the same cases that the `if'
catches, it will always use the `else' part, meaning it's actually:
(cond
...
((memq indent-line-function '(indent-relative indent-relative-maybe))
(funcall indent-line-function))
;; Indent the line.
(t
(funcall indent-line-function)))
Which of course is the same as:
(funcall indent-line-function)
-Miles
--
Occam's razor split hairs so well, I bought the whole argument!
- Re: C-u prefix behavior of TAB broken, (continued)
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/20
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/21
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/21
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/22
- Re: C-u prefix behavior of TAB broken,
Miles Bader <=
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/23
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/23
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/23
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/24
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/24
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/26
- Re: C-u prefix behavior of TAB broken, Vinicius Jose Latorre, 2007/12/26
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/26