From: Miles Bader <miles@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: martin rudalics <rudalics@gmx.at>, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: C-u prefix behavior of TAB broken
Date: Sun, 23 Dec 2007 10:39:39 +0900 [thread overview]
Message-ID: <87hcia6vfo.fsf@catnip.gol.com> (raw)
In-Reply-To: <jwvfxxujkr7.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 22 Dec 2007 19:55:03 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> 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!
next prev parent reply other threads:[~2007-12-23 1:39 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-16 22:07 C-u prefix behavior of TAB broken Miles Bader
2007-12-17 12:48 ` martin rudalics
2007-12-17 14:27 ` Miles Bader
2007-12-17 19:03 ` martin rudalics
2007-12-21 0:20 ` Stefan Monnier
2007-12-21 19:49 ` Richard Stallman
2007-12-22 0:11 ` Miles Bader
2007-12-22 9:28 ` martin rudalics
2007-12-22 13:48 ` Miles Bader
2007-12-22 17:41 ` martin rudalics
2007-12-22 19:52 ` Miles Bader
2007-12-22 22:35 ` martin rudalics
2007-12-22 22:59 ` Miles Bader
2008-02-24 19:05 ` Juri Linkov
2008-02-24 19:26 ` Miles Bader
2008-02-24 19:40 ` Juri Linkov
2008-02-25 2:56 ` Miles Bader
2007-12-23 0:55 ` Stefan Monnier
2007-12-23 1:39 ` Miles Bader [this message]
2007-12-23 21:49 ` Stefan Monnier
2007-12-22 21:08 ` Richard Stallman
2007-12-22 22:08 ` martin rudalics
2007-12-23 21:11 ` Richard Stallman
2007-12-23 21:44 ` martin rudalics
2007-12-24 21:55 ` Richard Stallman
2007-12-24 22:33 ` martin rudalics
2007-12-26 5:29 ` Richard Stallman
2007-12-26 13:49 ` Vinicius Jose Latorre
2007-12-26 21:26 ` Richard Stallman
2007-12-27 20:19 ` Juri Linkov
2007-12-28 13:55 ` Richard Stallman
2007-12-28 13:55 ` Richard Stallman
2008-01-03 21:52 ` Juri Linkov
2008-01-03 23:50 ` Miles Bader
2007-12-23 0:51 ` Stefan Monnier
2007-12-23 9:13 ` martin rudalics
2007-12-26 3:00 ` Miles Bader
2007-12-18 2:24 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hcia6vfo.fsf@catnip.gol.com \
--to=miles@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.org \
--cc=rudalics@gmx.at \
/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 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).