[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Updating xparse.el
From: |
Ikumi Keita |
Subject: |
Re: Updating xparse.el |
Date: |
Fri, 26 Jun 2020 20:02:23 +0900 |
Hi Arash,
>>>>> Arash Esbati <arash@gnu.org> writes:
> This means that we'll need to move code from xparse.el into latex.el.
> Until now, xparse.el doesn't support parsing .tex files. I've updated
> xparse.el to do so and would like to ask for comments here before I move
> to the code into the AUCTeX repo. The .el file is attached, the diff is
> attached below. Any comments welcome.
I have no knowledge about xparse.sty, so I'll comment on very minor
aspects.
> (defun LaTeX-xparse-macro-parse (type)
> "Process parsed macro and environment definitions.
> TYPE is one of the symobols mac or env."
> (dolist (xcmd (if (eq type 'mac)
> (LaTeX-xparse-macro-list)
> (LaTeX-xparse-environment-list)))
> (let ((name (car xcmd))
> (spec (cadr xcmd))
> args opt-star opt-token)
> (with-temp-buffer
> (with-syntax-table LaTeX-mode-syntax-table
Since we are working in temporal buffer, we need not use
`with-syntax-table'. Just (set-syntax-table LaTeX-mode-syntax-table)
would be enough.
> (goto-char (point-min))
> (save-excursion
> (insert (replace-regexp-in-string "[ \t\r\n%]" "" spec)))
Maybe it's a bit efficient to do in the order of `insert' followed by
`goto-char' without `save-excursion' :-)
> ;; Fully-expandable document commands
> '("DeclareExpandableDocumentCommand"
> TeX-arg-define-macro "Argument specification" t)
It seems that other "Expandable" variants should be added as well.
Cheers,
Ikumi Keita