unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53390: 29.0.50; [PATCH] Don't look for invalid whitespaces
@ 2022-01-20 13:28 Arash Esbati
  2022-01-20 14:16 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Arash Esbati @ 2022-01-20 13:28 UTC (permalink / raw)
  To: 53390

Hi all,

I'd like to suggest a minor change to `ispell-tex-skip-alists' which
looks for valid code and doesn't fix an apparent bug:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index ae3b18ed17..6382b402c0 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1673,14 +1673,13 @@ ispell-tex-skip-alists
      ("\\\\bibliographystyle"           ispell-tex-arg-end)
      ("\\\\makebox"                     ispell-tex-arg-end 0)
      ("\\\\e?psfig"                     ispell-tex-arg-end)
-     ("\\\\document\\(class\\|style\\)" .
-      "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}"))
+     ("\\\\document\\(class\\|style\\)" . "\\\\begin[ \t\n]*{document}"))
     (;; delimited with \begin.  In ispell: displaymath, eqnarray, eqnarray*,
      ;; equation, minipage, picture, tabular, tabular* (ispell)
      ("\\(figure\\|table\\)\\*?"        ispell-tex-arg-end 0)
      ("list"                            ispell-tex-arg-end 2)
-     ("program"                . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}")
-     ("verbatim\\*?"   . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}"))))
+     ("program"      . "\\\\end[ \t]*{program}")
+     ("verbatim\\*?" . "\\\\end[ \t]*{verbatim\\*?}"))))
   "Lists of regions to be skipped in TeX mode.
 First list is used raw.
 Second list has key placed inside \\begin{}.
--8<---------------cut here---------------end--------------->8---

Currently, the regexps would accept the following cases:

1.
\documentclass{article}
\begin{ document}
foo
\end{document}

Running LaTeX on the file gives:

! LaTeX Error: Environment  document undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.3 \begin{ document}

Note that space is significant in environment names.

2.
\documentclass{article}
\usepackage{program}
\begin{document}
\begin{program}
  foo bar
\end{ program}
\end{document}

Running LaTeX on the file above says:
! LaTeX Error: \begin{program} on input line 4 ended by \end{ program}.

3.
\documentclass{article}
\begin{document}
\begin{verbatim}
foo
\end {verbatim}

\end{document}

Running LaTeX on the file above says:
Runaway argument?
^^Mfoo^^M\end {verbatim}^^M^^M\end{document}^^M^^M^^M^^M^^M^^M^^M^^M^^M\ETC.
! File ended while scanning use of \@xverbatim.
<inserted text>
                \par

This one is delicate since vanilla LaTeX looks exactly for 14 characters
\end{verbatim} and packages like verbatim.sty lift this limitation and
allow a whitespace (and not a linebreak) between \end and {verbatim}.

Please let me know if I should install this change.

Best, Arash






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

* bug#53390: 29.0.50; [PATCH] Don't look for invalid whitespaces
  2022-01-20 13:28 bug#53390: 29.0.50; [PATCH] Don't look for invalid whitespaces Arash Esbati
@ 2022-01-20 14:16 ` Lars Ingebrigtsen
  2022-01-20 18:29   ` Arash Esbati
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-20 14:16 UTC (permalink / raw)
  To: Arash Esbati; +Cc: 53390

Arash Esbati <arash@gnu.org> writes:

> This one is delicate since vanilla LaTeX looks exactly for 14 characters
> \end{verbatim} and packages like verbatim.sty lift this limitation and
> allow a whitespace (and not a linebreak) between \end and {verbatim}.
>
> Please let me know if I should install this change.

It's been a while since I've done much LaTeXing, but it looks good to
me, I think.  

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





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

* bug#53390: 29.0.50; [PATCH] Don't look for invalid whitespaces
  2022-01-20 14:16 ` Lars Ingebrigtsen
@ 2022-01-20 18:29   ` Arash Esbati
  0 siblings, 0 replies; 3+ messages in thread
From: Arash Esbati @ 2022-01-20 18:29 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53390

Lars Ingebrigtsen <larsi@gnus.org> writes:

> It's been a while since I've done much LaTeXing, but it looks good to
> me, I think.  

Thanks, I pushed that change and will close this report.

Best, Arash





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

end of thread, other threads:[~2022-01-20 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 13:28 bug#53390: 29.0.50; [PATCH] Don't look for invalid whitespaces Arash Esbati
2022-01-20 14:16 ` Lars Ingebrigtsen
2022-01-20 18:29   ` Arash Esbati

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