From 4f0d680bd861ed187898b6476bde2d14d43b8c1d Mon Sep 17 00:00:00 2001 From: Atreya Shankar <35427332+atreyasha@users.noreply.github.com> Date: Sun, 2 Oct 2022 23:00:02 +0200 Subject: [PATCH] Replace customizable boolean with hook instead This could provide the user with more freedom in parsing reftex label candidates --- company-reftex.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/company-reftex.el b/company-reftex.el index 7ed8e9d..bdb0b81 100644 --- a/company-reftex.el +++ b/company-reftex.el @@ -71,9 +71,10 @@ 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 +(defcustom company-reftex-parse-labels-hook '(reftex-parse-all) + "Hook to be run for parsing reftex labels." + :type 'hook + :options '(reftex-parse-all reftex-parse-one) :group 'company-reftex) (defcustom company-reftex-labels-regexp @@ -230,9 +231,7 @@ For more information on COMMAND and ARG see `company-backends'." (defun company-reftex-label-candidates (prefix) "Find all label candidates matching PREFIX." - (if company-reftex-labels-parse-all - (reftex-parse-all) - (reftex-parse-one)) + (run-hooks 'company-reftex-parse-labels-hook) (cl-loop for entry in (symbol-value reftex-docstruct-symbol) if (and (stringp (car entry)) (string-prefix-p prefix (car entry))) collect