Hi Gustavo,

gusbrs <gusbrs.2...@gmail.com> writes:

> On Thu, 11 Apr 2024 at 12:46, Arash Esbati <ar...@gnu.org> wrote:
>
> Just "someone" playing a little with this:
>
> (defun reftex-all-used-citation-keys-alt ()
>   (let* (keys)
>     (if (reftex-using-biblatex-p)
>         (let* ((master (reftex-TeX-master-file))
>                (bbl-file (file-name-with-extension master ".bbl")))
>           (when (file-exists-p bbl-file)
>             (with-temp-buffer
>               (insert-file-contents bbl-file)
>               (goto-char (point-min))
>               (while (re-search-forward "\\\\entry{\\([^}]*\\)}" nil t)
>                 (push (match-string-no-properties 1) keys)))))
>       (reftex-access-scan-info)
>       (let* ((files (reftex-all-document-files))
>              (aux-files (mapcar (lambda (x) (file-name-with-extension x 
> ".aux"))
>                                 files))
>              file)
>         (while (setq file (pop aux-files))
>           (when (file-exists-p file)
>             (with-temp-buffer
>               (insert-file-contents file)
>               (goto-char (point-min))
>               (while (re-search-forward "^\\\\citation{\\([^}]*\\)}" nil t)
>                 (let ((key (match-string-no-properties 1)))
>                   (unless (member key keys)
>                     (push key keys)))))))))
>     (nreverse keys)))
>
> Quickly cooked, certainly needs polishing. But not a bad proof of
> concept, I think. Of course, this approach requires that the document
> has been compiled and the generated files are up to date with the main
> document.

Thanks, nice.  But I think the necessity you mention is also the weak
point of this approach: You can't just load a .tex file, run the caller
`reftex-create-bibtex-file' and close the file; you have to compile the
file.  So I don't think we should replace the current implementation
with the above.

>                   (unless (member key keys)
>                     (push key keys))

Can be written as:

  (cl-pushnew key keys :test #'string=)

Best, Arash



_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to