unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Arash Esbati <arash@gnu.org>
To: Melody Y <melodyhaya@gmail.com>
Cc: 56655@debbugs.gnu.org
Subject: bug#56655: 29.0.50; symbol's function definition is void: reftex-all-used-citation-keys
Date: Fri, 22 Jul 2022 15:41:19 +0200	[thread overview]
Message-ID: <86fsit5kow.fsf@gnu.org> (raw)
In-Reply-To: <CAL5mW5NEVm+rsfZCoaSht+Vc60FvVDHpT+L+oeFWjU14V26TFw@mail.gmail.com> (Melody Y.'s message of "Wed, 20 Jul 2022 11:16:07 +0800")

Melody Y <melodyhaya@gmail.com> writes:

> When I cite after an escaping symbol, the following citation item can
> not be extracted with `reftex-all-used-citation-keys`. For example,
> \%\cite{gaoEfficientKnowledgeGraph2019}, the key
> `gaoEfficientKnowledgeGraph2019` can't be exported. But if i make
> \cite{gaoEfficientKnowledgeGraph2019} to a new line, the export will
> work. Is it possible to solve this bug?

Thanks for the report.  Can you please elaborate what you mean with
"after an escaping symbol"?  Does your description above apply only to
\% or also to other control symbols in TeX?  The way I understand the
regexp in `reftex-all-used-citation-keys' it should only apply to \%.

Can you please try this version of the function and report back if it
works?  In order to use is, you need to:

 • Copy the code into into scratch buffer

 • Load your .tex file and hit 'C-c [' to make sure that reftex-cite.el
   is loaded

 • Switch to scratch buffer and eval the function, i.e., put cursor
   after the last parenthesis and hit 'C-x C-e'

 • Switch to your .tex file again and run
   `reftex-all-used-citation-keys'.

--8<---------------cut here---------------start------------->8---
(defun reftex-all-used-citation-keys ()
  (reftex-access-scan-info)
  (let ((files (reftex-all-document-files)) file keys kk k)
    (save-current-buffer
      (while (setq file (pop files))
        (set-buffer (reftex-get-file-buffer-force file 'mark))
        (save-excursion
          (save-restriction
            (widen)
            (goto-char (point-min))
            (while (re-search-forward
                    (concat "\\(?:^\\|\\=\\)"
                            "\\(?:[^%\n\r]*?\\(?:\\\\%\\)?[^%\n\r]*?\\)"
                            "\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)"
                            "\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}")
                    nil t)
              (setq kk (match-string-no-properties 3))
              (while (string-match "%.*\n?" kk)
                (setq kk (replace-match "" t t kk)))
              (setq kk (split-string kk "[, \t\r\n]+"))
              (while (setq k (pop kk))
                (or (member k keys)
                    (setq keys (cons k keys)))))))))
    (reftex-kill-temporary-buffers)
    keys))
--8<---------------cut here---------------end--------------->8---

TIA.  Best, Arash





  reply	other threads:[~2022-07-22 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  3:16 bug#56655: 29.0.50; symbol's function definition is void: reftex-all-used-citation-keys Melody Y
2022-07-22 13:41 ` Arash Esbati [this message]
2022-08-08 14:34   ` Arash Esbati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fsit5kow.fsf@gnu.org \
    --to=arash@gnu.org \
    --cc=56655@debbugs.gnu.org \
    --cc=melodyhaya@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).