GNU bug report logs - #6248
23.1; justify (esc q) broken in Latex mode

Previous Next

Package: emacs;

Reported by: mark.lillibridge <at> hp.com

Date: Sat, 22 May 2010 17:53:02 UTC

Severity: normal

Found in version 23.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6248 in the body.
You can then email your comments to 6248 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Sat, 22 May 2010 17:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mark.lillibridge <at> hp.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 May 2010 17:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; justify (esc q) broken in Latex mode
Date: Sat, 22 May 2010 10:51:42 -0700
To reproduce the bug, paste the following text into a new .txt file:

====================  cut here  ====================
    This is a sample paragraph of text that is long enough that it may
need to be filled.  Here's a second sentence to continue the paragraph.  And one more
sentence for good measure.
====================  cut here  ====================

If you request justification via esc Q, the paragraph is reformatted to:

    This is a sample paragraph of text that is long enough that it may
need to be filled.  Here's a second sentence to continue the
paragraph.  And one more sentence for good measure.


Repeat the steps using instead a suffix of .tex (latex mode); this time
you instead obtain the following incorrect result:

    This is a sample paragraph of text that is long enough that it may
    need to be filled.  Here's a second sentence to continue the
    paragraph.  And one more sentence for good measure.


Justify in latex mode worked correctly in Emacs 21, but does not work
correctly in 22 or 23.  Please fix.

- Mark




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Sun, 23 May 2010 01:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mark.lillibridge <at> hp.com
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Sat, 22 May 2010 21:37:06 -0400
> Repeat the steps using instead a suffix of .tex (latex mode); this time
> you instead obtain the following incorrect result:

>     This is a sample paragraph of text that is long enough that it may
>     need to be filled.  Here's a second sentence to continue the
>     paragraph.  And one more sentence for good measure.

> Justify in latex mode worked correctly in Emacs 21, but does not work
> correctly in 22 or 23.  Please fix.

It's not a bug, it's a feature.  The change is because Emacs-21 did not
offer indentation for LaTeX, whereas Emacs>=22 does.
To get the behavior you want, you'll want to set
fill-indent-according-to-mode, e.g.

 (add-hook 'latex-mode-hook
           (lambda ()
             (set (make-local-variable 'fill-indent-according-to-mode) nil)))

-- Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Tue, 25 May 2010 00:27:03 GMT) Full text and rfc822 format available.

Message #11 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Mon, 24 May 2010 17:26:10 -0700
Stefan wrote:
>  I (Mark) wrote:
>  > Repeat the steps using instead a suffix of .tex (latex mode); this time
>  > you instead obtain the following incorrect result:
>  >
>  >     This is a sample paragraph of text that is long enough that it may
>  >     need to be filled.  Here's a second sentence to continue the
>  >     paragraph.  And one more sentence for good measure.
>  
>  > Justify in latex mode worked correctly in Emacs 21, but does not work
>  > correctly in 22 or 23.  Please fix.
>  
>  It's not a bug, it's a feature.  The change is because Emacs-21 did not
>  offer indentation for LaTeX, whereas Emacs>=22 does.
>  To get the behavior you want, you'll want to set
>  fill-indent-according-to-mode, e.g.
>  
>   (add-hook 'latex-mode-hook
>             (lambda ()
>               (set (make-local-variable 'fill-indent-according-to-mode) nil)))

    While that workaround does work, I'm still not convinced this isn't
a bug.  Why is this broken behavior a feature?  

- Mark




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Tue, 25 May 2010 02:44:02 GMT) Full text and rfc822 format available.

Message #14 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mark.lillibridge <at> hp.com
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Mon, 24 May 2010 22:43:00 -0400
>> > Repeat the steps using instead a suffix of .tex (latex mode); this time
>> > you instead obtain the following incorrect result:
>> >
>> >     This is a sample paragraph of text that is long enough that it may
>> >     need to be filled.  Here's a second sentence to continue the
>> >     paragraph.  And one more sentence for good measure.
>> 
>> > Justify in latex mode worked correctly in Emacs 21, but does not work
>> > correctly in 22 or 23.  Please fix.
>> 
>> It's not a bug, it's a feature.  The change is because Emacs-21 did not
>> offer indentation for LaTeX, whereas Emacs>=22 does.
>> To get the behavior you want, you'll want to set
>> fill-indent-according-to-mode, e.g.
>> 
>> (add-hook 'latex-mode-hook
>> (lambda ()
>> (set (make-local-variable 'fill-indent-according-to-mode) nil)))

>     While that workaround does work, I'm still not convinced this isn't
> a bug.  Why is this broken behavior a feature?  

It's a feature if you consider LaTeX as code rather than as text, so you
want the text parts of the LaTeX code to be properly indented, like
any other.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Thu, 27 May 2010 02:47:02 GMT) Full text and rfc822 format available.

Message #17 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Wed, 26 May 2010 19:46:16 -0700
>  >> It's not a bug, it's a feature.  The change is because Emacs-21 did not
>  >> offer indentation for LaTeX, whereas Emacs>=22 does.
>  >> To get the behavior you want, you'll want to set
>  >> fill-indent-according-to-mode, e.g.
>  >> 
>  >> (add-hook 'latex-mode-hook
>  >> (lambda ()
>  >> (set (make-local-variable 'fill-indent-according-to-mode) nil)))
>  
>  >     While that workaround does work, I'm still not convinced this isn't
>  > a bug.  Why is this broken behavior a feature?  
>  
>  It's a feature if you consider LaTeX as code rather than as text, so you
>  want the text parts of the LaTeX code to be properly indented, like
>  any other.

    I tend to view latex as text with intermixed code so I see this
differently.  I can see an argument for why text inside of a specific
environment might need to be indented specially, I don't see why that
would apply to top-level text outside of any environment.

    I suspect we're going to agree to disagree on this one; feel free to
close this bug.

- Mark




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Thu, 27 May 2010 04:25:01 GMT) Full text and rfc822 format available.

Message #20 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mark.lillibridge <at> hp.com
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Thu, 27 May 2010 00:24:11 -0400
>     I tend to view latex as text with intermixed code so I see this
> differently.  I can see an argument for why text inside of a specific
> environment might need to be indented specially, I don't see why that
> would apply to top-level text outside of any environment.

So you're saying that filling should not use indentation when filling
top-level text and that would solve your use case?

Hmm... I see some problems with that:
- your original message reported that the whole paragraph was indented
  (apparently by 4 spaces), so either that paragraph was not "outside
  of any environment" or there is something I don't understand.
- that would introduce unexpected difference between otherwise similar
  circumstances (top-level or not-top-level text).

>     I suspect we're going to agree to disagree on this one; feel free to
> close this bug.

Yes, I don't think we can satisfy everyone without someone having to do
some extra configuration to express his preference (which is what
fill-indent-according-to-mode is for).

But I could offer another "way out", based on your example text: the
indentation code could potentially be modified to try and recognize
paragraph-beginnings and indent them by some extra N spaces, so as to
look like:

         This is a sample paragraph of text that is long enough that it
     may need to be filled.  Here's a second sentence to continue the
     paragraph.  And one more sentence for good measure.

I personally wouldn't like it, so it would still need to be controlled
by some configuration variable.  And I'm not sure it could be made
reliable enough.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Thu, 03 Jun 2010 23:03:02 GMT) Full text and rfc822 format available.

Message #23 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Mark Lillibridge <mark.lillibridge <at> hp.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Thu, 03 Jun 2010 16:02:06 -0700
Stefan wrote:
>  So you're saying that filling should not use indentation when filling
>  top-level text and that would solve your use case?

    I think so; in particular, text at the top level not containing
latex commands should have the same filling rules as text in text mode.


>  Hmm... I see some problems with that:
>  - your original message reported that the whole paragraph was indented
>    (apparently by 4 spaces), so either that paragraph was not "outside
>    of any environment" or there is something I don't understand.

    I think there is something else going on; that paragraph was
contained in absolutely no environment.  As an experiment, I indented
the first line only of the original paragraph by 20 spaces.  The result
was that the entire paragraph is indented 20 spaces.  I can't think of
any argument for why this makes sense.

- Mark





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Fri, 04 Jun 2010 13:42:02 GMT) Full text and rfc822 format available.

Message #26 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mark.lillibridge <at> hp.com
Cc: 6248 <at> debbugs.gnu.org
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Fri, 04 Jun 2010 09:41:04 -0400
>> Hmm... I see some problems with that:
>> - your original message reported that the whole paragraph was indented
>> (apparently by 4 spaces), so either that paragraph was not "outside
>> of any environment" or there is something I don't understand.

>     I think there is something else going on; that paragraph was
> contained in absolutely no environment.  As an experiment, I indented
> the first line only of the original paragraph by 20 spaces.  The result
> was that the entire paragraph is indented 20 spaces.  I can't think of
> any argument for why this makes sense.

Oh, I see what's going on: the filling only reindents the lines after
the first (i.e. only the lines that come after a newline inserted by the
filling code), and the filling code simply trusts the first line to be
properly indented.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6248; Package emacs. (Mon, 31 Jan 2022 17:05:02 GMT) Full text and rfc822 format available.

Message #29 received at 6248 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6248 <at> debbugs.gnu.org, mark.lillibridge <at> hp.com
Subject: Re: bug#6248: 23.1; justify (esc q) broken in Latex mode
Date: Mon, 31 Jan 2022 18:04:25 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Oh, I see what's going on: the filling only reindents the lines after
> the first (i.e. only the lines that come after a newline inserted by the
> filling code), and the filling code simply trusts the first line to be
> properly indented.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This is generally how the filling code works, so skimming this thread,
there doesn't seem to be anything to be fixed on the Emacs side here,
and I'm therefore closing this bug report.  (If I misunderstood, please
respond to the debbugs address and we'll reopen.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 6248 <at> debbugs.gnu.org and mark.lillibridge <at> hp.com Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 31 Jan 2022 17:05:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Mar 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.