unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* M-x occur bug: ^[^%]+'
@ 2003-01-27  1:27 Karl Berry
  2003-01-27  7:10 ` Dan Jacobson
  2003-01-27 11:04 ` Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: Karl Berry @ 2003-01-27  1:27 UTC (permalink / raw)


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 `@end \endthing'}%
     52:  \errhelp = \EMsimple
     53:  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
     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 `@end \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 `@end #1' doesn't have a matching `@#1'}%
}

% 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).
\def\@{{\tt\char64}}

% 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
  @gdef@lbracecmd[\{]%
  @gdef@rbracecmd[\}]%
@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 \errmessage{@dotless 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 \@M directly, because that causes trouble
 % if the definition is written into an index file.
 \global\let\tiepenalty = \@M
 \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}}

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

* Re: M-x occur bug: ^[^%]+'
  2003-01-27  1:27 M-x occur bug: ^[^%]+' Karl Berry
@ 2003-01-27  7:10 ` Dan Jacobson
  2003-01-27 11:04 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Jacobson @ 2003-01-27  7:10 UTC (permalink / raw)


BTW, while you guys are at it, add a basic "q" to quit out of occur mode.
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: M-x occur bug: ^[^%]+'
  2003-01-27  1:27 M-x occur bug: ^[^%]+' Karl Berry
  2003-01-27  7:10 ` Dan Jacobson
@ 2003-01-27 11:04 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2003-01-27 11:04 UTC (permalink / raw)
  Cc: bug-gnu-emacs

karl@freefriends.org (Karl Berry) writes:

|> 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 `@end \endthing'}%
|>      52:  \errhelp = \EMsimple
|>      53:  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
|>      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.

Note that [^%] includes the newline character, thus you have three matches
each spanning multiple lines.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2003-01-27 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-27  1:27 M-x occur bug: ^[^%]+' Karl Berry
2003-01-27  7:10 ` Dan Jacobson
2003-01-27 11:04 ` Andreas Schwab

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