Re: Issues with japanese support

Ralf Angeli <[email protected]>
Newsgroups gmane.emacs.auc-tex
Message-ID <[email protected]>
* Masayuki Ataka (2005-02-16) writes:

> From: Ralf Angeli <[email protected]>
> Subject: Re: Issues with japanese support
> Date: Wed, 16 Feb 2005 10:28:48 +0100
>
>> Although I have a `re-search-forward' phobia since we had these
>> performance problems related to filling, I think this would be a
>> pragmatic solution.  At least there is not much difference in
>> execution time between the following two implementations (work only
>> with Emacs):
>> 
> Let me name the code for convenience.
>
> fill-cvs-emacs:
[...]
> fill-replace:
[...]
> And new code.
>
> fill-skip-char:
[...]
> In my computer and Emacs-21.4, `fill-re-search' is faster
> than `fill-cvs-emacs':
>   (fill-cvs-emacs) 2.065401077270508
>   (fill-replace)   1.1991240978240967
>   (fill-skip-char) 0.9685571193695068
> But, after byte-compile, `fill-cvs-emacs' becomes much
> faster:
>   (fill-cvs-emacs) 0.5713150501251221
>   (fill-replace)   1.1394240856170654
>   (fill-skip-char) 0.9528110027313232

Argh, byte compilation ... (c:

> Yes.  `re-search-forward' has a performance problem.
> `fill-cvs-emacs' is the fastest.  `fill-skip-char' is better
> than `re-search-forward'.  So, our new function will be...
>
> (defun LaTeX-fill-delete-newlines (from to justify nosqueeze squeeze-after)
>   ;; COMPATIBILITY for Emacs <= 22.1

This should be "... for Emacs < 22.1 and XEmacs".

>   (if (fboundp 'fill-delete-newlines)
>       (fill-delete-newlines from to justify nosqueeze squeeze-after)
>     (if (featurep 'xemacs)
>         (when (featurep 'mule)
>           (goto-char from)
>           (while (re-search-forward "\\(\\cj\\)\n\\(\\cj\\)" to t)

It would be good to use something like the value of
`word-across-newline' in the regular expression,
i.e. "\\(\\cj\\|\\cc\\|\\ct\\)\n\\(\\cj\\|\\cc\\|\\ct\\)".  If the
variable `word-across-newline' should be used, one somehow will have
to silence the byte compiler.

>               (skip-chars-backward "^\n")
>               (delete-char -1)))
>       ;; This else-sentence was copied from the function `fill-delete-newlines'
>       ;; in `fill.el' (CVS Emacs, 2005-02-17).
>       (while (search-forward "\n" nil t)
>         (let ((prev (char-before (match-beginning 0)))
>               (next (following-char)))
>           (when (or (aref (char-category-set next) ?|)
>                     (aref (char-category-set prev) ?|))
>             (delete-char -1)))))
>
> (snip) (snip) (snip)
> ;; Is comment appropriate?

Yep.  You could add something like "... and adapted accordingly"
because the checks for the fill-space text property were removed.
(AFAICS this property is not used in Emacs 21.3.)

>> What I don't like is the name `LaTeX-word-across-newline'.  What about
>> something matching better its value/purpose, like
>> `LaTeX-nospace-between-words-char-regexp'.  Argh, I created a
>> monster.  A little bit shorter: `LaTeX-nospace-between-char-regexp'.
>> Any better suggestions?
>
> I like it.

With the above function we don't even need it.

-- 
Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.