From 481f8f7dcc763c1f608637ad11f982e0168e3b76 Mon Sep 17 00:00:00 2001 From: Atreya Shankar <35427332+atreyasha@users.noreply.github.com> Date: Sat, 1 Oct 2022 15:28:15 +0200 Subject: [PATCH] Add option to disable `reftex-parse-all` Addresses #11 --- company-reftex.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/company-reftex.el b/company-reftex.el index ca8613e..7ed8e9d 100644 --- a/company-reftex.el +++ b/company-reftex.el @@ -71,6 +71,11 @@ See `reftex-format-citation'." :type '(choice (const :tag "Off" nil) integer) :group 'company-reftex) +(defcustom company-reftex-labels-parse-all t + "Whether to rescan labels in entire document." + :type 'boolean + :group 'company-reftex) + (defcustom company-reftex-labels-regexp (rx "\\" ;; List taken from `reftex-ref-style-alist' @@ -225,8 +230,9 @@ For more information on COMMAND and ARG see `company-backends'." (defun company-reftex-label-candidates (prefix) "Find all label candidates matching PREFIX." - (reftex-access-scan-info) - (reftex-parse-all) + (if company-reftex-labels-parse-all + (reftex-parse-all) + (reftex-parse-one)) (cl-loop for entry in (symbol-value reftex-docstruct-symbol) if (and (stringp (car entry)) (string-prefix-p prefix (car entry))) collect