bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

M-x occur bug: ^[^%]+'


From: Karl Berry
Subject: M-x occur bug: ^[^%]+'
Date: Sun, 26 Jan 2003 20:27:47 -0500

Emacs 21.2, gnu/linux 2.4.18-14 (red hat 8.0).

$ emacs -q --no-site testfile  # contents of testfile below
M-x occur RET
^[^%]+' RET

Resulting *Occur* buffer:

3 lines matching "^[^%]+'" in buffer test/tmp.
     38:      \errhelp = \EMsimple
     39:      \errmessage{Undefined command address@hidden \endthing'}%
     52:  \errhelp = \EMsimple
     53:  \errmessage{This address@hidden #1' doesn't have a matching 
address@hidden'}%
     92:\let\, = \c
     93:\let\dotaccent = \.
     94:\def\ringaccent#1{{\accent23 #1}}
     95:\let\tieaccent = \t
     96:\let\ubaraccent = \b
     97:\let\udotaccent = \d
     98:\let\acuteaccent = \'  % workaround aux file using ' as escape


The three matches it found are correct (on lines 39, 53, and 98).
However, it is also showing a number of lines that do not match.

Here is the test file (an excerpt from texinfo.tex).

% Change the active space to expand to nothing.
%
\begingroup
  \obeyspaces
  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
\endgroup


\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}

%% These are used to keep @begin/@end levels from running away
%% Call \inENV within environments (after a \begingroup)
\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
\def\ENVcheck{%
\ifENV\errmessage{Still within an environment; press RETURN to continue}
\endgroup\fi} % This is not perfect, but it should reduce lossage

% @begin foo  is the same as @foo, for now.
\newhelp\EMsimple{Press RETURN to continue.}

\outer\def\begin{\parsearg\beginxxx}

\def\beginxxx #1{%
\expandafter\ifx\csname #1\endcsname\relax
{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
\csname #1\endcsname\fi}

% @end foo executes the definition of \Efoo.
%
\def\end{\parsearg\endxxx}
\def\endxxx #1{%
  \removeactivespaces{#1}%
  \edef\endthing{\the\toks0}%
  %
  \expandafter\ifx\csname E\endthing\endcsname\relax
    \expandafter\ifx\csname \endthing\endcsname\relax
      % There's no \foo, i.e., no ``environment'' foo.
      \errhelp = \EMsimple
      \errmessage{Undefined command address@hidden \endthing'}%
    \else
      \unmatchedenderror\endthing
    \fi
  \else
    % Everything's ok; the right environment has been started.
    \csname E\endthing\endcsname
  \fi
}

% There is an environment #1, but it hasn't been started.  Give an error.
%
\def\unmatchedenderror#1{%
  \errhelp = \EMsimple
  \errmessage{This address@hidden #1' doesn't have a matching address@hidden'}%
}

% Define the control sequence \E#1 to give an unmatched @end error.
%
\def\defineunmatchedend#1{%
  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
}


%% Simple single-character @ commands

% @@ prints an @
% Kludge this until the fonts are right (grr).
address@hidden

% This is turned off because it was never documented
% and you can use @w{...} around a quote to suppress ligatures.
%% Define @` and @' to be the same as ` and '
%% but suppressing ligatures.
%\def\`{{`}}
%\def\'{{'}}

% Used to generate quoted braces.
\def\mylbrace {{\tt\char123}}
\def\myrbrace {{\tt\char125}}
\let\{=\mylbrace
\let\}=\myrbrace
\begingroup
  % Definitions to produce actual \{ & \} command in an index.
  \catcode`\{ = \other \catcode`\} = \other
  \catcode`\[ = 1 \catcode`\] = 2
  \catcode`\@ = 0 \catcode`\\ = \other
  @address@hidden
  @address@hidden
@endgroup

% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
\let\, = \c
\let\dotaccent = \.
\def\ringaccent#1{{\accent23 #1}}
\let\tieaccent = \t
\let\ubaraccent = \b
\let\udotaccent = \d
\let\acuteaccent = \'  % workaround aux file using ' as escape

% Other special characters: @questiondown @exclamdown
% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
\def\questiondown{?`}
\def\exclamdown{!`}

% Dotless i and dotless j, used for accents.
\def\imacro{i}
\def\jmacro{j}
\def\dotless#1{%
  \def\temp{#1}%
  \ifx\temp\imacro \ptexi
  \else\ifx\temp\jmacro \j
  \else address@hidden can be used only with i or j}%
  \fi\fi
}

% Be sure we're in horizontal mode when doing a tie, since we make space
% equivalent to this in @example-like environments. Otherwise, a space
% at the beginning of a line will start with \penalty -- and
% since \penalty is valid in vertical mode, we'd end up putting the
% penalty on the vertical list instead of in the new paragraph.
{\catcode`@ = 11
 % Avoid using address@hidden directly, because that causes trouble
 % if the definition is written into an index file.
 \global\let\tiepenalty = address@hidden
 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
}

% @: forces normal size whitespace following.
\def\:{\spacefactor=1000 }

% @* forces a line break.
\def\*{\hfil\break\hbox{}\ignorespaces}

% @. is an end-of-sentence period.
\def\.{.\spacefactor=3000 }

% @! is an end-of-sentence bang.
\def\!{!\spacefactor=3000 }

% @? is an end-of-sentence query.
\def\?{?\spacefactor=3000 }

% @w prevents a word break.  Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would
% produce a whole line of output instead of starting the paragraph.
\def\w#1{\leavevmode\hbox{#1}}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]