Skip to content

Commit

Permalink
Replace customizable boolean with hook instead
Browse files Browse the repository at this point in the history
This could provide the user with more freedom in parsing reftex label
candidates
  • Loading branch information
atreyasha committed Oct 2, 2022
1 parent 8822be9 commit 4f0d680
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions company-reftex.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f0d680

Please sign in to comment.