unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* add-log.el: Indenting broken.
@ 2002-11-23 15:44 Alfred M. Szmidt
  2002-11-26 23:52 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Alfred M. Szmidt @ 2002-11-23 15:44 UTC (permalink / raw)


The last commit to add-log.el introduce an annoying bug.  Now each
time you hit TAB it moves a "column" (where column is where the next
space is in the above row), instead as before it would just indent one
literal TAB and stop.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-23 15:44 add-log.el: Indenting broken Alfred M. Szmidt
@ 2002-11-26 23:52 ` Stefan Monnier
  2002-11-27  6:30   ` Eli Zaretskii
  2002-11-27 12:52   ` Alfred M. Szmidt
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2002-11-26 23:52 UTC (permalink / raw)
  Cc: emacs-devel

> The last commit to add-log.el introduce an annoying bug.  Now each
> time you hit TAB it moves a "column" (where column is where the next
> space is in the above row), instead as before it would just indent one
> literal TAB and stop.

I do see this change indeed between the RC code and the trunk,
but the last commit has not made any difference in this respect.
The change was introduced when I changed the default setting
of indent-line-function in indent.el (many months ago).

I didn't notice that it changed the behavior of change-log-mode,
but now that I see it I'm wondering if it's a bug or a feature.
What do people think ?


	Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-26 23:52 ` Stefan Monnier
@ 2002-11-27  6:30   ` Eli Zaretskii
  2002-11-27  6:44     ` Miles Bader
  2002-11-27 12:52   ` Alfred M. Szmidt
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2002-11-27  6:30 UTC (permalink / raw)
  Cc: Alfred M. Szmidt, emacs-devel


On Tue, 26 Nov 2002, Stefan Monnier wrote:

> I didn't notice that it changed the behavior of change-log-mode,
> but now that I see it I'm wondering if it's a bug or a feature.
> What do people think ?

Isn't this incompatible with what TAB does in other modes?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-27  6:30   ` Eli Zaretskii
@ 2002-11-27  6:44     ` Miles Bader
  0 siblings, 0 replies; 11+ messages in thread
From: Miles Bader @ 2002-11-27  6:44 UTC (permalink / raw)
  Cc: Stefan Monnier, Alfred M. Szmidt, emacs-devel

Eli Zaretskii <eliz@is.elta.co.il> writes:
> > I didn't notice that it changed the behavior of change-log-mode,
> > but now that I see it I'm wondering if it's a bug or a feature.
> > What do people think ?
> 
> Isn't this incompatible with what TAB does in other modes?

TAB in text-mode does that too.

In general, TAB doesn't have particularly consistent behavior across
modes, rather it has appropriate behavior in each mode, so what's most
important is whether people like it or not.

I don't hit TAB in change-log-mode very often, and can't see much reason
for inserting tabs other than at the left-margin (which the new mode
seems to do correctly) so the new behavior seems OK to me.

-Miles
-- 
80% of success is just showing up.  --Woody Allen

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-26 23:52 ` Stefan Monnier
  2002-11-27  6:30   ` Eli Zaretskii
@ 2002-11-27 12:52   ` Alfred M. Szmidt
  2002-11-28  1:50     ` Miles Bader
  2002-11-29 15:03     ` Richard Stallman
  1 sibling, 2 replies; 11+ messages in thread
From: Alfred M. Szmidt @ 2002-11-27 12:52 UTC (permalink / raw)
  Cc: emacs-devel

   I didn't notice that it changed the behavior of change-log-mode,
   but now that I see it I'm wondering if it's a bug or a feature.
   What do people think ?

Personally, I just find it really annoying.  Maybe I am used to the
previous behaviour.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-27 12:52   ` Alfred M. Szmidt
@ 2002-11-28  1:50     ` Miles Bader
  2002-11-28  6:12       ` Eli Zaretskii
  2002-11-29 15:03     ` Richard Stallman
  1 sibling, 1 reply; 11+ messages in thread
From: Miles Bader @ 2002-11-28  1:50 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

"Alfred M. Szmidt" <ams@kemisten.nu> writes:
> Personally, I just find it really annoying.  Maybe I am used to the
> previous behaviour.

What do you use the TAB key for in ChangeLog files?

-Miles
-- 
P.S.  All information contained in the above letter is false,
      for reasons of military security.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-28  1:50     ` Miles Bader
@ 2002-11-28  6:12       ` Eli Zaretskii
  2002-11-28  6:35         ` Miles Bader
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2002-11-28  6:12 UTC (permalink / raw)
  Cc: Alfred M. Szmidt, emacs-devel


On 28 Nov 2002, Miles Bader wrote:

> What do you use the TAB key for in ChangeLog files?

You didn't ask me, but I'll give my answer anyway: I use it to reindent 
the change log text, like I do in other modes.

For tabbing to the column of the next non-whitespace character on the 
previous line, I use indent-relative which I bind to M-i since time 
immemoriam.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-28  6:12       ` Eli Zaretskii
@ 2002-11-28  6:35         ` Miles Bader
  2002-12-02 16:10           ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Miles Bader @ 2002-11-28  6:35 UTC (permalink / raw)
  Cc: Alfred M. Szmidt, emacs-devel

Eli Zaretskii <eliz@is.elta.co.il> writes:
> > What do you use the TAB key for in ChangeLog files?
> 
> You didn't ask me, but I'll give my answer anyway: I use it to reindent 
> the change log text, like I do in other modes.

Ok, now I see what's going on -- I didn't try TAB in enough places.
It works fine if you're _after_ some change-log text (because the
preceding text will basically always start with a tab), but it screws up
if you're directly after a change-log header.

Now I agree, the new behavior is annoying, because it doesn't do the
right thing at the left-margin.

Something like the following seems appropriate to me:

(defun change-log-indent ()
  (interactive)
  (let ((cur-indent (current-indentation)))
    (cond ((> (current-column) cur-indent)
	   (insert ?\t))
	  ((= cur-indent 8)
	   (move-to-column cur-indent))
	  (t
	   (delete-horizontal-space)
	   (indent-to-column 8)))))

(set (make-local-variable 'indent-line-function) 'change-log-indent)

-Miles
-- 
Run away!  Run away!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-27 12:52   ` Alfred M. Szmidt
  2002-11-28  1:50     ` Miles Bader
@ 2002-11-29 15:03     ` Richard Stallman
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2002-11-29 15:03 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

Since there was no intention of changing TAB, and no reason
for changing it, I think it should be put back as it was.
Stefan, could you do that?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-11-28  6:35         ` Miles Bader
@ 2002-12-02 16:10           ` Stefan Monnier
  2002-12-03  2:55             ` Miles Bader
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2002-12-02 16:10 UTC (permalink / raw)
  Cc: Eli Zaretskii, Alfred M. Szmidt, emacs-devel

> Eli Zaretskii <eliz@is.elta.co.il> writes:
> > > What do you use the TAB key for in ChangeLog files?
> > 
> > You didn't ask me, but I'll give my answer anyway: I use it to reindent 
> > the change log text, like I do in other modes.
> 
> Ok, now I see what's going on -- I didn't try TAB in enough places.
> It works fine if you're _after_ some change-log text (because the
> preceding text will basically always start with a tab), but it screws up
> if you're directly after a change-log header.
> 
> Now I agree, the new behavior is annoying, because it doesn't do the
> right thing at the left-margin.

I've restored it to what it was originally.


	Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: add-log.el: Indenting broken.
  2002-12-02 16:10           ` Stefan Monnier
@ 2002-12-03  2:55             ` Miles Bader
  0 siblings, 0 replies; 11+ messages in thread
From: Miles Bader @ 2002-12-03  2:55 UTC (permalink / raw)
  Cc: Eli Zaretskii, Alfred M. Szmidt, emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:
> > Now I agree, the new behavior is annoying, because it doesn't do the
> > right thing at the left-margin.
> 
> I've restored it to what it was originally.

Your change seems like the right thing, but I noticed that
`indent-for-tab-command' actually does something stupid in this case:

   (defun indent-for-tab-command (&optional arg)
     ...
     (cond
      ((or ;; indent-to-left-margin is only meant for indenting,
           ;; so we force it to always insert a tab here.
           (eq indent-line-function 'indent-to-left-margin)
           ...
       (insert-tab arg))

It seems to me that this special case should only apply if point is not
within the left margin, so that doing `C-a TAB' will always have the
effect of `fixing' the current indentation (rather than just inserting a
tab), and won't modify the buffer if the indentation for the line is
already correct.

So perhaps a better test might be:

   (and (eq indent-line-function 'indent-to-left-margin)
        (< (current-column) left-margin))

[I don't like the special-casing in `indent-for-tab-command' at all, and
 would actually rather remove it, but it's already that way so I'm
 trying to be conservative.]

-Miles
-- 
自らを空にして、心を開く時、道は開かれる

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-12-03  2:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-23 15:44 add-log.el: Indenting broken Alfred M. Szmidt
2002-11-26 23:52 ` Stefan Monnier
2002-11-27  6:30   ` Eli Zaretskii
2002-11-27  6:44     ` Miles Bader
2002-11-27 12:52   ` Alfred M. Szmidt
2002-11-28  1:50     ` Miles Bader
2002-11-28  6:12       ` Eli Zaretskii
2002-11-28  6:35         ` Miles Bader
2002-12-02 16:10           ` Stefan Monnier
2002-12-03  2:55             ` Miles Bader
2002-11-29 15:03     ` Richard Stallman

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).