unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* tex-terminate-paragraph ignores paragraph-start and paragraph-separate
@ 2007-09-09  6:35 Joe Wells
  2007-09-09  8:47 ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Wells @ 2007-09-09  6:35 UTC (permalink / raw)
  To: bug-gnu-emacs

The tex-terminate-paragraph command has "\n\n" hard-coded into it as
the paragraph divider and ignores paragraph-start and
paragraph-separate.  As a result, it reports false errors.

To reproduce the reporting of false errors by tex-terminate-paragraph,
first create a .tex file containing this text:

---------------------------
\documentclass{article}
\begin{document}

This is the main paragraph.

\begin{quote}
This is the first paragraph of a multi-paragraph quote.
\end{quote}

\end{document}
---------------------------

Then, move point to the end of the line that says “This is the first
paragraph of a multi-paragraph quote.”.  Then, type C-j to invoke
tex-terminate-paragraph.

The correct behavior would be to silently insert two newline
characters.  The actually buggy behavior is that
tex-terminate-paragraph also emits the false message that “Paragraph
being closed appears to contain a mismatch”.

The cause of the problem is that tex-terminate-paragraph is including
the “\begin{quote}” in the text it checks for validity but not the
corresponding “\end{quote}”, causing an error when it uses
forward-sexp to check for balance.  It is an error to include the
“\begin{quote}” because it is not part of the current paragraph.  It
makes a mistake about what is in the paragraph because it uses the
hard-coded "\n\n" as the paragraph divider.

The fix is to make tex-terminate-paragraph use a better approach to
finding the start of the current paragraph.  At the very least, it
should honor paragraph-start and paragraph-separate.

I hope this bug report is helpful.

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

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

* Re: tex-terminate-paragraph ignores paragraph-start and paragraph-separate
  2007-09-09  6:35 tex-terminate-paragraph ignores paragraph-start and paragraph-separate Joe Wells
@ 2007-09-09  8:47 ` martin rudalics
  2007-09-09 10:28   ` Joe Wells
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2007-09-09  8:47 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

> The fix is to make tex-terminate-paragraph use a better approach to
> finding the start of the current paragraph.  At the very least, it
> should honor paragraph-start and paragraph-separate.

I think the "(search-backward "\n\n" nil t)" in `tex-validate-buffer'
should then be replaced as well.

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

* Re: tex-terminate-paragraph ignores paragraph-start and paragraph-separate
  2007-09-09  8:47 ` martin rudalics
@ 2007-09-09 10:28   ` Joe Wells
  2007-09-19  7:30     ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Wells @ 2007-09-09 10:28 UTC (permalink / raw)
  To: martin rudalics; +Cc: bug-gnu-emacs

martin rudalics <rudalics@gmx.at> writes:

>> The fix is to make tex-terminate-paragraph use a better approach to
>> finding the start of the current paragraph.  At the very least, it
>> should honor paragraph-start and paragraph-separate.
>
> I think the "(search-backward "\n\n" nil t)" in `tex-validate-buffer'
> should then be replaced as well.

Both places should probably just use the standard paragraph motion
functions.  (By the way, what is tex-validate-buffer doing with
paragraphs anyway?)

-- 
Joe

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

* Re: tex-terminate-paragraph ignores paragraph-start and paragraph-separate
  2007-09-09 10:28   ` Joe Wells
@ 2007-09-19  7:30     ` Glenn Morris
  2007-09-19  8:28       ` Joe Wells
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2007-09-19  7:30 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

Joe Wells wrote:

> martin rudalics <rudalics@gmx.at> writes:
>
>>> The fix is to make tex-terminate-paragraph use a better approach to
>>> finding the start of the current paragraph.  At the very least, it
>>> should honor paragraph-start and paragraph-separate.
>>
>> I think the "(search-backward "\n\n" nil t)" in `tex-validate-buffer'
>> should then be replaced as well.
>
> Both places should probably just use the standard paragraph motion
> functions. 

Yes, I think just using backward-paragraph in tex-terminate-paragraph
(which doesn't seem like a very useful function to me) is good enough.
I'm still thinking about tex-validate-buffer.

> (By the way, what is tex-validate-buffer doing with paragraphs
> anyway?)

It's checking each "paragraph" is balanced in terms of parens, etc.
tex-validate-region is more like "find first mismatch in region". Just
calling tex-validate-region on the whole buffer would never produce
more than one error. Not very useful. I'm not convinced it's a very
useful function anyway though. As it stands, you get up to one error
per "paragraph".




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

* Re: tex-terminate-paragraph ignores paragraph-start and paragraph-separate
  2007-09-19  7:30     ` Glenn Morris
@ 2007-09-19  8:28       ` Joe Wells
  2007-09-20  3:13         ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Wells @ 2007-09-19  8:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: bug-gnu-emacs

Glenn Morris <rgm@gnu.org> writes:

> Joe Wells wrote:
>
>> martin rudalics <rudalics@gmx.at> writes:
>>
>>>> The fix is to make tex-terminate-paragraph use a better approach to
>>>> finding the start of the current paragraph.  At the very least, it
>>>> should honor paragraph-start and paragraph-separate.
>>>
>>> I think the "(search-backward "\n\n" nil t)" in `tex-validate-buffer'
>>> should then be replaced as well.
>>
>> Both places should probably just use the standard paragraph motion
>> functions.
>
> Yes, I think just using backward-paragraph in tex-terminate-paragraph
> (which doesn't seem like a very useful function to me) is good enough.

Sounds good.

> I'm still thinking about tex-validate-buffer.
>
>> (By the way, what is tex-validate-buffer doing with paragraphs
>> anyway?)
>
> It's checking each "paragraph" is balanced in terms of parens, etc.

Sure, but why does it need to operate on paragraphs?  Why doesn't it
just check the whole buffer?

> tex-validate-region is more like "find first mismatch in region". Just
> calling tex-validate-region on the whole buffer would never produce
> more than one error. Not very useful. I'm not convinced it's a very
> useful function anyway though. As it stands, you get up to one error
> per "paragraph".

If you want to completely remove the functionality, I won't complain!
People who really want checking can use lacheck or chktex from AUCTeX.

I was reporting a bug only because the documented functionality didn't
work correctly.

-- 
Joe




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

* Re: tex-terminate-paragraph ignores paragraph-start and paragraph-separate
  2007-09-19  8:28       ` Joe Wells
@ 2007-09-20  3:13         ` Glenn Morris
  0 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2007-09-20  3:13 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

Joe Wells wrote:

>> I'm still thinking about tex-validate-buffer.

I think I got it now.

> I was reporting a bug only because the documented functionality didn't
> work correctly.

Absolutely. I was only thinking aloud.




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

end of thread, other threads:[~2007-09-20  3:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-09  6:35 tex-terminate-paragraph ignores paragraph-start and paragraph-separate Joe Wells
2007-09-09  8:47 ` martin rudalics
2007-09-09 10:28   ` Joe Wells
2007-09-19  7:30     ` Glenn Morris
2007-09-19  8:28       ` Joe Wells
2007-09-20  3:13         ` Glenn Morris

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