unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6248: 23.1; justify (esc q) broken in Latex mode
@ 2010-05-22 17:51 Mark Lillibridge
  2010-05-23  1:37 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Lillibridge @ 2010-05-22 17:51 UTC (permalink / raw)
  To: 6248


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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-22 17:51 bug#6248: 23.1; justify (esc q) broken in Latex mode Mark Lillibridge
@ 2010-05-23  1:37 ` Stefan Monnier
  2010-05-25  0:26   ` Mark Lillibridge
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-05-23  1:37 UTC (permalink / raw)
  To: mark.lillibridge; +Cc: 6248

> 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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-23  1:37 ` Stefan Monnier
@ 2010-05-25  0:26   ` Mark Lillibridge
  2010-05-25  2:43     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Lillibridge @ 2010-05-25  0:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6248


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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-25  0:26   ` Mark Lillibridge
@ 2010-05-25  2:43     ` Stefan Monnier
  2010-05-27  2:46       ` Mark Lillibridge
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-05-25  2:43 UTC (permalink / raw)
  To: mark.lillibridge; +Cc: 6248

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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-25  2:43     ` Stefan Monnier
@ 2010-05-27  2:46       ` Mark Lillibridge
  2010-05-27  4:24         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Lillibridge @ 2010-05-27  2:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6248


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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-27  2:46       ` Mark Lillibridge
@ 2010-05-27  4:24         ` Stefan Monnier
  2010-06-03 23:02           ` Mark Lillibridge
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-05-27  4:24 UTC (permalink / raw)
  To: mark.lillibridge; +Cc: 6248

>     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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-05-27  4:24         ` Stefan Monnier
@ 2010-06-03 23:02           ` Mark Lillibridge
  2010-06-04 13:41             ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Lillibridge @ 2010-06-03 23:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6248


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






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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-06-03 23:02           ` Mark Lillibridge
@ 2010-06-04 13:41             ` Stefan Monnier
  2022-01-31 17:04               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-06-04 13:41 UTC (permalink / raw)
  To: mark.lillibridge; +Cc: 6248

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





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

* bug#6248: 23.1; justify (esc q) broken in Latex mode
  2010-06-04 13:41             ` Stefan Monnier
@ 2022-01-31 17:04               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-31 17:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6248, mark.lillibridge

Stefan Monnier <monnier@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





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

end of thread, other threads:[~2022-01-31 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-22 17:51 bug#6248: 23.1; justify (esc q) broken in Latex mode Mark Lillibridge
2010-05-23  1:37 ` Stefan Monnier
2010-05-25  0:26   ` Mark Lillibridge
2010-05-25  2:43     ` Stefan Monnier
2010-05-27  2:46       ` Mark Lillibridge
2010-05-27  4:24         ` Stefan Monnier
2010-06-03 23:02           ` Mark Lillibridge
2010-06-04 13:41             ` Stefan Monnier
2022-01-31 17:04               ` Lars Ingebrigtsen

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