auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] A real-life problem...


From: Ralf Angeli
Subject: Re: [AUCTeX-devel] A real-life problem...
Date: Tue, 07 Jun 2005 11:08:20 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

* David Kastrup (2005-06-07) writes:

> Loading or saving a large file with a few thousand \index entries
> takes up about 10 minutes here, which is quite intolerable.  Things
> get quite more acceptable with the following:
>
>
> --- tex.el    05 Jun 2005 19:07:23 +0200      5.524
> +++ tex.el    07 Jun 2005 04:51:13 +0200      
> @@ -2669,28 +2669,72 @@
>    :group 'TeX-parse)
>    (make-variable-buffer-local 'TeX-auto-x-regexp-list)
>  
> +(defun TeX-regexp-group-count (regexp)
> +  "Return number of groups in a regexp.  This assumes the following
> +heuristic:  Any occurrence of the pattern `\\\\([^?]' is an opening group,
> +so if you want to have something like `\\\\\\\\(', write it as 
> `\\\\\\\\[(]'."

Hm, probably nobody will think about that when writing a regexp.
Couldn't the function recognize such constructs itself and disregard
them?

> +  (let (start (n 0))
> +    (while (string-match "\\\\([^?]" regexp start)
> +      (setq start (1- (match-end 0))
> +         n (1+ n)))
> +    n))
> +
>  (defun TeX-auto-parse-region (regexp-list beg end)
>    "Parse TeX information according to REGEXP-LIST between BEG and END."
>    (if (symbolp regexp-list)
>        (setq regexp-list (and (boundp regexp-list) (symbol-value 
> regexp-list))))
>     (if regexp-list
>         ;; Extract the information.
> -       (let ((regexp (concat "\\("
> -                          (mapconcat 'car regexp-list "\\)\\|\\(")
> -                          "\\)")))
> +       (let* (groups
> +           (count 1)
> +           (regexp (concat "\\("
> +                           (mapconcat
> +                            #'(lambda(x)

Isn't #'(lambda ...) a pleonasm?  As far as I understand (info
"(elisp)Anonymous Functions") a bare (lambda ...) should suffice
because `lambda' already implies `function' and #' is a shorthand for
`function'.

> The question is whether I am going actually overboard here with trying
> to keep the order of the lists more or less in-sequence like it was
> previously the case.
>
> Does anybody have enough of a clue to tell whether the order is
> important here?  If not, one can leave off the sequencing stuff using
> `count', maybe making this more efficient.

I am not too much into this code right now but if I had to guess I'd
say it is not important.

-- 
Ralf




reply via email to

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