auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Re: Impending release...


From: David Kastrup
Subject: Re: [AUCTeX-devel] Re: Impending release...
Date: Tue, 10 May 2005 13:54:06 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Angeli <address@hidden> writes:

> * David Kastrup (2005-05-10) writes:
>
>> Ralf Angeli <address@hidden> writes:
>>
>>> And how do you make sure that `forward-comment' will look into a
>>> line starting with a "%" character rather than skip it?
>>
>> What has that to do with limiting the search?
>
> As this seems to be working so good right now,

As _what_ seems to be working now?  Ignoring my questions and coming
up with something completely unrelated?  Could you be so kind as to
tell me just _what_ kind of work is achieved well by that?  Maybe we
can arrive at a less annoying and more constructive way of achieving
the goal that you appear to be aiming for.

> let me carry on with asking questions. (c;
>
> Have you looked at what `font-latex-forward-comment' does in docTeX
> mode in contrast to `forward-comment' and how it is used in
> `font-latex-match-command-with-arguments'?

The point of call still is

        (while (and (< (point) limit) (font-latex-forward-comment)))

and it appears nonsensical to let font-latex-forward-comment not take
a look at limit.

Then we have the code:

      (progn
        (when (bolp) (skip-chars-forward "%"))
        (skip-chars-forward " \t\n")
        (while (and (looking-at "^%*[ \t]*$") (not (eobp)))
          (beginning-of-line 2))
        (when (bolp) (skip-chars-forward "%"))
        (skip-chars-forward " \t")
        (when (eq (char-after) ?%)
          (beginning-of-line 2)))

It is quite hard to guess what this is supposed to be about.  The code
is rather obfuscated.  So if we are at the beginning of a line, we
skip across single line that may start with comment characters,
followed by any number of whitespace-only lines.  Then while we are
looking at any such lines that are not completely empty, we move to
the beginning of the next line.

Then if we are at the beginning of a line, we skip percent characters,
followed by non-newline whitespace.  And if any non-newline whitespace
has been skipped and there happens to be a percent character after
this skipping, we move to the next line.

Ralf, this is simply insane.

The comment says:
(defun font-latex-forward-comment ()
  "Like `forward-comment' but with special provisions for docTeX mode.
In docTeX mode \"%\" at the start of a line will be treated as whitespace."

And forward-comment says:

    forward-comment is a built-in function in `src/syntax.c'.
    (forward-comment COUNT)

    Move forward across up to COUNT comments.  If COUNT is negative,
    move backward.  Stop scanning if we find something other than a
    comment or whitespace.  Set point to where scanning stops.  If
    COUNT comments are found as expected, with nothing except
    whitespace between them, return t; otherwise return nil.

Ok, so what you seem to be trying to do is to skip across white space
and at most one comment not starting in column 1.  I have no clue why
you'd want to do that, but assuming that you do, you'd have to do
something like

(while (and (< (point) limit)
            (progn (if (bolp) (skip-chars-forward "%" limit))
                   (> (skip-chars-forward " \t\n" limit) 0))))
(when (< (point) limit)
  (when (eq (char-after) ?%)
    (beginning-of-line 2)))

But as I already said: it seems easier to just do a narrow-to-region
in order to have `limit' heeded.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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